X-Git-Url: http://these/git/?a=blobdiff_plain;f=crates%2Fdb_schema%2Fsrc%2Faggregates%2Fstructs.rs;h=e526b49ddaa6a60155ff1c5dd56272d2b7de9968;hb=0aeb78b8f39f777cd5d1af292258897964e58f2a;hp=15fce13b2bb849d00d6167dabfa682702bf653fc;hpb=f2537ba7db39b338617e07f36c5cd6b11f59795e;p=lemmy.git diff --git a/crates/db_schema/src/aggregates/structs.rs b/crates/db_schema/src/aggregates/structs.rs index 15fce13b..e526b49d 100644 --- a/crates/db_schema/src/aggregates/structs.rs +++ b/crates/db_schema/src/aggregates/structs.rs @@ -6,6 +6,7 @@ use crate::schema::{ comment_aggregates, community_aggregates, person_aggregates, + person_post_aggregates, post_aggregates, site_aggregates, }; @@ -76,6 +77,28 @@ pub struct PostAggregates { #[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] +#[cfg_attr(feature = "full", diesel(table_name = person_post_aggregates))] +#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::person::Person)))] +pub struct PersonPostAggregates { + pub id: i32, + pub person_id: PersonId, + pub post_id: PostId, + pub read_comments: i64, + pub published: chrono::NaiveDateTime, +} + +#[derive(Clone, Default)] +#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))] +#[cfg_attr(feature = "full", diesel(table_name = person_post_aggregates))] +pub struct PersonPostAggregatesForm { + pub person_id: PersonId, + pub post_id: PostId, + pub read_comments: i64, + pub published: Option, +} + +#[derive(PartialEq, Debug, Serialize, Deserialize, Clone)] +#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))] #[cfg_attr(feature = "full", diesel(table_name = site_aggregates))] #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::site::Site)))] pub struct SiteAggregates {