]> Untitled Git - lemmy.git/blob - crates/db_views_actor/src/structs.rs
Making community_follower.pending column not null.
[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 };
11 use serde::{Deserialize, Serialize};
12
13 #[derive(Debug, Serialize, Deserialize, Clone)]
14 pub struct CommunityBlockView {
15   pub person: PersonSafe,
16   pub community: CommunitySafe,
17 }
18
19 #[derive(Debug, Serialize, Deserialize, Clone)]
20 pub struct CommunityFollowerView {
21   pub community: CommunitySafe,
22   pub follower: PersonSafe,
23   pub pending: bool,
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: bool,
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: bool,                    // 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 }