]> Untitled Git - lemmy.git/blob - crates/db_views_moderator/src/structs.rs
Add Modlog Filters (#2313)
[lemmy.git] / crates / db_views_moderator / src / structs.rs
1 use lemmy_db_schema::{
2   newtypes::{CommunityId, PersonId},
3   source::{
4     comment::Comment,
5     community::CommunitySafe,
6     moderator::{
7       AdminPurgeComment,
8       AdminPurgeCommunity,
9       AdminPurgePerson,
10       AdminPurgePost,
11       ModAdd,
12       ModAddCommunity,
13       ModBan,
14       ModBanFromCommunity,
15       ModHideCommunity,
16       ModLockPost,
17       ModRemoveComment,
18       ModRemoveCommunity,
19       ModRemovePost,
20       ModStickyPost,
21       ModTransferCommunity,
22     },
23     person::{PersonSafe, PersonSafeAlias1},
24     post::Post,
25   },
26 };
27 use serde::{Deserialize, Serialize};
28
29 #[derive(Debug, Serialize, Deserialize, Clone)]
30 pub struct ModAddCommunityView {
31   pub mod_add_community: ModAddCommunity,
32   pub moderator: Option<PersonSafe>,
33   pub community: CommunitySafe,
34   pub modded_person: PersonSafeAlias1,
35 }
36
37 #[derive(Debug, Serialize, Deserialize, Clone)]
38 pub struct ModAddView {
39   pub mod_add: ModAdd,
40   pub moderator: Option<PersonSafe>,
41   pub modded_person: PersonSafeAlias1,
42 }
43
44 #[derive(Debug, Serialize, Deserialize, Clone)]
45 pub struct ModBanFromCommunityView {
46   pub mod_ban_from_community: ModBanFromCommunity,
47   pub moderator: Option<PersonSafe>,
48   pub community: CommunitySafe,
49   pub banned_person: PersonSafeAlias1,
50 }
51
52 #[derive(Debug, Serialize, Deserialize, Clone)]
53 pub struct ModBanView {
54   pub mod_ban: ModBan,
55   pub moderator: Option<PersonSafe>,
56   pub banned_person: PersonSafeAlias1,
57 }
58
59 #[derive(Debug, Serialize, Deserialize, Clone)]
60 pub struct ModHideCommunityView {
61   pub mod_hide_community: ModHideCommunity,
62   pub admin: Option<PersonSafe>,
63   pub community: CommunitySafe,
64 }
65
66 #[derive(Debug, Serialize, Deserialize, Clone)]
67 pub struct ModLockPostView {
68   pub mod_lock_post: ModLockPost,
69   pub moderator: Option<PersonSafe>,
70   pub post: Post,
71   pub community: CommunitySafe,
72 }
73
74 #[derive(Debug, Serialize, Deserialize, Clone)]
75 pub struct ModRemoveCommentView {
76   pub mod_remove_comment: ModRemoveComment,
77   pub moderator: Option<PersonSafe>,
78   pub comment: Comment,
79   pub commenter: PersonSafeAlias1,
80   pub post: Post,
81   pub community: CommunitySafe,
82 }
83
84 #[derive(Debug, Serialize, Deserialize, Clone)]
85 pub struct ModRemoveCommunityView {
86   pub mod_remove_community: ModRemoveCommunity,
87   pub moderator: Option<PersonSafe>,
88   pub community: CommunitySafe,
89 }
90
91 #[derive(Debug, Serialize, Deserialize, Clone)]
92 pub struct ModRemovePostView {
93   pub mod_remove_post: ModRemovePost,
94   pub moderator: Option<PersonSafe>,
95   pub post: Post,
96   pub community: CommunitySafe,
97 }
98
99 #[derive(Debug, Serialize, Deserialize, Clone)]
100 pub struct ModStickyPostView {
101   pub mod_sticky_post: ModStickyPost,
102   pub moderator: Option<PersonSafe>,
103   pub post: Post,
104   pub community: CommunitySafe,
105 }
106
107 #[derive(Debug, Serialize, Deserialize, Clone)]
108 pub struct ModTransferCommunityView {
109   pub mod_transfer_community: ModTransferCommunity,
110   pub moderator: Option<PersonSafe>,
111   pub community: CommunitySafe,
112   pub modded_person: PersonSafeAlias1,
113 }
114
115 #[derive(Debug, Serialize, Deserialize, Clone)]
116 pub struct AdminPurgeCommentView {
117   pub admin_purge_comment: AdminPurgeComment,
118   pub admin: Option<PersonSafe>,
119   pub post: Post,
120 }
121
122 #[derive(Debug, Serialize, Deserialize, Clone)]
123 pub struct AdminPurgeCommunityView {
124   pub admin_purge_community: AdminPurgeCommunity,
125   pub admin: Option<PersonSafe>,
126 }
127
128 #[derive(Debug, Serialize, Deserialize, Clone)]
129 pub struct AdminPurgePersonView {
130   pub admin_purge_person: AdminPurgePerson,
131   pub admin: Option<PersonSafe>,
132 }
133
134 #[derive(Debug, Serialize, Deserialize, Clone)]
135 pub struct AdminPurgePostView {
136   pub admin_purge_post: AdminPurgePost,
137   pub admin: Option<PersonSafe>,
138   pub community: CommunitySafe,
139 }
140
141 #[derive(Debug, Serialize, Deserialize, Clone, Copy)]
142 pub struct ModlogListParams {
143   pub community_id: Option<CommunityId>,
144   pub mod_person_id: Option<PersonId>,
145   pub other_person_id: Option<PersonId>,
146   pub page: Option<i64>,
147   pub limit: Option<i64>,
148   pub hide_modlog_names: bool,
149 }