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,
25 #[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
26 #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
27 #[cfg_attr(feature = "full", table_name = "community_aggregates")]
28 pub struct CommunityAggregates {
30 pub community_id: CommunityId,
34 pub published: chrono::NaiveDateTime,
35 pub users_active_day: i64,
36 pub users_active_week: i64,
37 pub users_active_month: i64,
38 pub users_active_half_year: i64,
41 #[derive(PartialEq, Debug, Serialize, Deserialize, Clone, Default)]
42 #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
43 #[cfg_attr(feature = "full", table_name = "person_aggregates")]
44 pub struct PersonAggregates {
46 pub person_id: PersonId,
49 pub comment_count: i64,
50 pub comment_score: i64,
53 #[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
54 #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
55 #[cfg_attr(feature = "full", table_name = "post_aggregates")]
56 pub struct PostAggregates {
64 pub published: chrono::NaiveDateTime,
65 pub newest_comment_time_necro: chrono::NaiveDateTime, // A newest comment time, limited to 2 days, to prevent necrobumping
66 pub newest_comment_time: chrono::NaiveDateTime,
69 #[derive(PartialEq, Debug, Serialize, Deserialize, Clone)]
70 #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
71 #[cfg_attr(feature = "full", table_name = "site_aggregates")]
72 pub struct SiteAggregates {
79 pub users_active_day: i64,
80 pub users_active_week: i64,
81 pub users_active_month: i64,
82 pub users_active_half_year: i64,