-use crate::newtypes::{CommentId, CommunityId, PersonId, PostId};
-use serde::{Deserialize, Serialize};
-
+use crate::newtypes::{CommentId, CommunityId, PersonId, PostId, SiteId};
#[cfg(feature = "full")]
use crate::schema::{
comment_aggregates,
community_aggregates,
person_aggregates,
+ person_post_aggregates,
post_aggregates,
site_aggregates,
};
+use serde::{Deserialize, Serialize};
#[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
pub score: i64,
pub upvotes: i64,
pub downvotes: i64,
- pub stickied: bool,
pub published: chrono::NaiveDateTime,
pub newest_comment_time_necro: chrono::NaiveDateTime, // A newest comment time, limited to 2 days, to prevent necrobumping
pub newest_comment_time: chrono::NaiveDateTime,
+ pub featured_community: bool,
+ pub featured_local: bool,
+}
+
+#[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<chrono::NaiveDateTime>,
}
#[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)]
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::site::Site)))]
pub struct SiteAggregates {
pub id: i32,
- pub site_id: i32,
+ pub site_id: SiteId,
pub users: i64,
pub posts: i64,
pub comments: i64,