]> Untitled Git - lemmy.git/blob - crates/db_views_actor/src/structs.rs
Revert "Add pending, and change use specific API response for FollowCommunity…" ...
[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 }
24
25 #[derive(Debug, Serialize, Deserialize, Clone)]
26 pub struct CommunityModeratorView {
27   pub community: CommunitySafe,
28   pub moderator: PersonSafe,
29 }
30
31 #[derive(Debug, Serialize, Deserialize, Clone)]
32 pub struct CommunityPersonBanView {
33   pub community: CommunitySafe,
34   pub person: PersonSafe,
35 }
36
37 #[derive(Debug, Serialize, Deserialize, Clone)]
38 pub struct CommunityView {
39   pub community: CommunitySafe,
40   pub subscribed: bool,
41   pub blocked: bool,
42   pub counts: CommunityAggregates,
43 }
44
45 #[derive(Debug, Serialize, Deserialize, Clone)]
46 pub struct PersonBlockView {
47   pub person: PersonSafe,
48   pub target: PersonSafeAlias1,
49 }
50
51 #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
52 pub struct PersonMentionView {
53   pub person_mention: PersonMention,
54   pub comment: Comment,
55   pub creator: PersonSafe,
56   pub post: Post,
57   pub community: CommunitySafe,
58   pub recipient: PersonSafeAlias1,
59   pub counts: CommentAggregates,
60   pub creator_banned_from_community: bool, // Left Join to CommunityPersonBan
61   pub subscribed: bool,                    // Left join to CommunityFollower
62   pub saved: bool,                         // Left join to CommentSaved
63   pub creator_blocked: bool,               // Left join to PersonBlock
64   pub my_vote: Option<i16>,                // Left join to CommentLike
65 }
66
67 #[derive(Debug, Serialize, Deserialize, Clone)]
68 pub struct PersonViewSafe {
69   pub person: PersonSafe,
70   pub counts: PersonAggregates,
71 }