]> Untitled Git - lemmy.git/blob - crates/db_views_actor/src/structs.rs
b45728af541f5ce1e65dbca5fe32e57e9f1f0699
[lemmy.git] / crates / db_views_actor / src / structs.rs
1 use lemmy_db_schema::{
2   aggregates::structs::{CommentAggregates, CommunityAggregates, PersonAggregates},
3   source::{
4     comment::Comment,
5     community::CommunitySafe,
6     person::{PersonSafe, PersonSafeAlias1},
7     person_mention::PersonMention,
8     post::Post,
9   },
10   SubscribedType,
11 };
12 use serde::{Deserialize, Serialize};
13
14 #[derive(Debug, Serialize, Deserialize, Clone)]
15 pub struct CommunityBlockView {
16   pub person: PersonSafe,
17   pub community: CommunitySafe,
18 }
19
20 #[derive(Debug, Serialize, Deserialize, Clone)]
21 pub struct CommunityFollowerView {
22   pub community: CommunitySafe,
23   pub follower: PersonSafe,
24 }
25
26 #[derive(Debug, Serialize, Deserialize, Clone)]
27 pub struct CommunityModeratorView {
28   pub community: CommunitySafe,
29   pub moderator: PersonSafe,
30 }
31
32 #[derive(Debug, Serialize, Deserialize, Clone)]
33 pub struct CommunityPersonBanView {
34   pub community: CommunitySafe,
35   pub person: PersonSafe,
36 }
37
38 #[derive(Debug, Serialize, Deserialize, Clone)]
39 pub struct CommunityView {
40   pub community: CommunitySafe,
41   pub subscribed: SubscribedType,
42   pub blocked: bool,
43   pub counts: CommunityAggregates,
44 }
45
46 #[derive(Debug, Serialize, Deserialize, Clone)]
47 pub struct PersonBlockView {
48   pub person: PersonSafe,
49   pub target: PersonSafeAlias1,
50 }
51
52 #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
53 pub struct PersonMentionView {
54   pub person_mention: PersonMention,
55   pub comment: Comment,
56   pub creator: PersonSafe,
57   pub post: Post,
58   pub community: CommunitySafe,
59   pub recipient: PersonSafeAlias1,
60   pub counts: CommentAggregates,
61   pub creator_banned_from_community: bool, // Left Join to CommunityPersonBan
62   pub subscribed: SubscribedType,          // Left join to CommunityFollower
63   pub saved: bool,                         // Left join to CommentSaved
64   pub creator_blocked: bool,               // Left join to PersonBlock
65   pub my_vote: Option<i16>,                // Left join to CommentLike
66 }
67
68 #[derive(Debug, Serialize, Deserialize, Clone)]
69 pub struct PersonViewSafe {
70   pub person: PersonSafe,
71   pub counts: PersonAggregates,
72 }