2022-05-03 17:44:13 +00:00
|
|
|
use lemmy_db_schema::{
|
|
|
|
aggregates::structs::{CommentAggregates, CommunityAggregates, PersonAggregates},
|
|
|
|
source::{
|
|
|
|
comment::Comment,
|
2022-07-30 03:55:59 +00:00
|
|
|
comment_reply::CommentReply,
|
2022-05-03 17:44:13 +00:00
|
|
|
community::CommunitySafe,
|
2022-09-26 14:09:32 +00:00
|
|
|
person::PersonSafe,
|
2022-05-03 17:44:13 +00:00
|
|
|
person_mention::PersonMention,
|
|
|
|
post::Post,
|
|
|
|
},
|
2022-06-22 12:05:41 +00:00
|
|
|
SubscribedType,
|
2022-05-03 17:44:13 +00:00
|
|
|
};
|
|
|
|
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,
|
2022-06-22 12:05:41 +00:00
|
|
|
pub subscribed: SubscribedType,
|
2022-05-03 17:44:13 +00:00
|
|
|
pub blocked: bool,
|
|
|
|
pub counts: CommunityAggregates,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
pub struct PersonBlockView {
|
|
|
|
pub person: PersonSafe,
|
2022-09-26 14:09:32 +00:00
|
|
|
pub target: PersonSafe,
|
2022-05-03 17:44:13 +00:00
|
|
|
}
|
|
|
|
|
2022-09-26 14:09:32 +00:00
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
|
2022-05-03 17:44:13 +00:00
|
|
|
pub struct PersonMentionView {
|
|
|
|
pub person_mention: PersonMention,
|
|
|
|
pub comment: Comment,
|
|
|
|
pub creator: PersonSafe,
|
|
|
|
pub post: Post,
|
|
|
|
pub community: CommunitySafe,
|
2022-09-26 14:09:32 +00:00
|
|
|
pub recipient: PersonSafe,
|
2022-05-03 17:44:13 +00:00
|
|
|
pub counts: CommentAggregates,
|
|
|
|
pub creator_banned_from_community: bool, // Left Join to CommunityPersonBan
|
2022-06-22 12:05:41 +00:00
|
|
|
pub subscribed: SubscribedType, // Left join to CommunityFollower
|
2022-05-03 17:44:13 +00:00
|
|
|
pub saved: bool, // Left join to CommentSaved
|
|
|
|
pub creator_blocked: bool, // Left join to PersonBlock
|
|
|
|
pub my_vote: Option<i16>, // Left join to CommentLike
|
|
|
|
}
|
|
|
|
|
2022-09-26 14:09:32 +00:00
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
|
2022-07-30 03:55:59 +00:00
|
|
|
pub struct CommentReplyView {
|
|
|
|
pub comment_reply: CommentReply,
|
|
|
|
pub comment: Comment,
|
|
|
|
pub creator: PersonSafe,
|
|
|
|
pub post: Post,
|
|
|
|
pub community: CommunitySafe,
|
2022-09-26 14:09:32 +00:00
|
|
|
pub recipient: PersonSafe,
|
2022-07-30 03:55:59 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2022-05-03 17:44:13 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
pub struct PersonViewSafe {
|
|
|
|
pub person: PersonSafe,
|
|
|
|
pub counts: PersonAggregates,
|
|
|
|
}
|