9c3efe32e7
* First pass at adding comment trees. - Extracted comment replies into its own table. - Added ltree column to comment - Added parent_id param to GetComments to fetch a tree branch - No paging / limiting yet * Adding child_count to comment_aggregates. * Adding parent comment update counts * Fix unit tests. * Comment tree paging mostly done. * Fix clippy * Fix drone tests wrong postgres version. * Fix unit tests. * Add back in delete in unit test. * Add postgres upgrade script. * Fixing some PR comments. * Move update ltree into Comment::create * Updating based on comments. * Fix send soft fail.
89 lines
2.7 KiB
Rust
89 lines
2.7 KiB
Rust
use lemmy_db_schema::{
|
|
aggregates::structs::{CommentAggregates, CommunityAggregates, PersonAggregates},
|
|
source::{
|
|
comment::Comment,
|
|
comment_reply::CommentReply,
|
|
community::CommunitySafe,
|
|
person::{PersonSafe, PersonSafeAlias1},
|
|
person_mention::PersonMention,
|
|
post::Post,
|
|
},
|
|
SubscribedType,
|
|
};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
pub struct CommunityBlockView {
|
|
pub person: PersonSafe,
|
|
pub community: CommunitySafe,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
pub struct CommunityFollowerView {
|
|
pub community: CommunitySafe,
|
|
pub follower: PersonSafe,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
pub struct CommunityModeratorView {
|
|
pub community: CommunitySafe,
|
|
pub moderator: PersonSafe,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
pub struct CommunityPersonBanView {
|
|
pub community: CommunitySafe,
|
|
pub person: PersonSafe,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
pub struct CommunityView {
|
|
pub community: CommunitySafe,
|
|
pub subscribed: SubscribedType,
|
|
pub blocked: bool,
|
|
pub counts: CommunityAggregates,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
pub struct PersonBlockView {
|
|
pub person: PersonSafe,
|
|
pub target: PersonSafeAlias1,
|
|
}
|
|
|
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
|
pub struct PersonMentionView {
|
|
pub person_mention: PersonMention,
|
|
pub comment: Comment,
|
|
pub creator: PersonSafe,
|
|
pub post: Post,
|
|
pub community: CommunitySafe,
|
|
pub recipient: PersonSafeAlias1,
|
|
pub counts: CommentAggregates,
|
|
pub creator_banned_from_community: bool, // Left Join to CommunityPersonBan
|
|
pub subscribed: SubscribedType, // Left join to CommunityFollower
|
|
pub saved: bool, // Left join to CommentSaved
|
|
pub creator_blocked: bool, // Left join to PersonBlock
|
|
pub my_vote: Option<i16>, // Left join to CommentLike
|
|
}
|
|
|
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
|
pub struct CommentReplyView {
|
|
pub comment_reply: CommentReply,
|
|
pub comment: Comment,
|
|
pub creator: PersonSafe,
|
|
pub post: Post,
|
|
pub community: CommunitySafe,
|
|
pub recipient: PersonSafeAlias1,
|
|
pub counts: CommentAggregates,
|
|
pub creator_banned_from_community: bool, // Left Join to CommunityPersonBan
|
|
pub subscribed: SubscribedType, // Left join to CommunityFollower
|
|
pub saved: bool, // Left join to CommentSaved
|
|
pub creator_blocked: bool, // Left join to PersonBlock
|
|
pub my_vote: Option<i16>, // Left join to CommentLike
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
pub struct PersonViewSafe {
|
|
pub person: PersonSafe,
|
|
pub counts: PersonAggregates,
|
|
}
|