1 use crate::newtypes::{CommentId, CommunityId, PersonId, PostId};
2 use serde::{Deserialize, Serialize};
4 #[cfg(feature = "full")]
13 #[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
14 #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
15 #[cfg_attr(feature = "full", table_name = "comment_aggregates")]
16 pub struct CommentAggregates {
18 pub comment_id: CommentId,
22 pub published: chrono::NaiveDateTime,
26 #[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
27 #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
28 #[cfg_attr(feature = "full", table_name = "community_aggregates")]
29 pub struct CommunityAggregates {
31 pub community_id: CommunityId,
35 pub published: chrono::NaiveDateTime,
36 pub users_active_day: i64,
37 pub users_active_week: i64,
38 pub users_active_month: i64,
39 pub users_active_half_year: i64,
42 #[derive(PartialEq, Debug, Serialize, Deserialize, Clone, Default)]
43 #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
44 #[cfg_attr(feature = "full", table_name = "person_aggregates")]
45 pub struct PersonAggregates {
47 pub person_id: PersonId,
50 pub comment_count: i64,
51 pub comment_score: i64,
54 #[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
55 #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
56 #[cfg_attr(feature = "full", table_name = "post_aggregates")]
57 pub struct PostAggregates {
65 pub published: chrono::NaiveDateTime,
66 pub newest_comment_time_necro: chrono::NaiveDateTime, // A newest comment time, limited to 2 days, to prevent necrobumping
67 pub newest_comment_time: chrono::NaiveDateTime,
70 #[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
71 #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
72 #[cfg_attr(feature = "full", table_name = "site_aggregates")]
73 pub struct SiteAggregates {
80 pub users_active_day: i64,
81 pub users_active_week: i64,
82 pub users_active_month: i64,
83 pub users_active_half_year: i64,