]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/moderator.rs
Hide community v2 (#2055)
[lemmy.git] / crates / db_schema / src / source / moderator.rs
1 use crate::{
2   newtypes::{CommentId, CommunityId, PersonId, PostId},
3   schema::{
4     mod_add,
5     mod_add_community,
6     mod_ban,
7     mod_ban_from_community,
8     mod_hide_community,
9     mod_lock_post,
10     mod_remove_comment,
11     mod_remove_community,
12     mod_remove_post,
13     mod_sticky_post,
14     mod_transfer_community,
15   },
16 };
17 use serde::{Deserialize, Serialize};
18
19 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
20 #[table_name = "mod_remove_post"]
21 pub struct ModRemovePost {
22   pub id: i32,
23   pub mod_person_id: PersonId,
24   pub post_id: PostId,
25   pub reason: Option<String>,
26   pub removed: Option<bool>,
27   pub when_: chrono::NaiveDateTime,
28 }
29
30 #[derive(Insertable, AsChangeset)]
31 #[table_name = "mod_remove_post"]
32 pub struct ModRemovePostForm {
33   pub mod_person_id: PersonId,
34   pub post_id: PostId,
35   pub reason: Option<String>,
36   pub removed: Option<bool>,
37 }
38
39 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
40 #[table_name = "mod_lock_post"]
41 pub struct ModLockPost {
42   pub id: i32,
43   pub mod_person_id: PersonId,
44   pub post_id: PostId,
45   pub locked: Option<bool>,
46   pub when_: chrono::NaiveDateTime,
47 }
48
49 #[derive(Insertable, AsChangeset)]
50 #[table_name = "mod_lock_post"]
51 pub struct ModLockPostForm {
52   pub mod_person_id: PersonId,
53   pub post_id: PostId,
54   pub locked: Option<bool>,
55 }
56
57 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
58 #[table_name = "mod_sticky_post"]
59 pub struct ModStickyPost {
60   pub id: i32,
61   pub mod_person_id: PersonId,
62   pub post_id: PostId,
63   pub stickied: Option<bool>,
64   pub when_: chrono::NaiveDateTime,
65 }
66
67 #[derive(Insertable, AsChangeset)]
68 #[table_name = "mod_sticky_post"]
69 pub struct ModStickyPostForm {
70   pub mod_person_id: PersonId,
71   pub post_id: PostId,
72   pub stickied: Option<bool>,
73 }
74
75 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
76 #[table_name = "mod_remove_comment"]
77 pub struct ModRemoveComment {
78   pub id: i32,
79   pub mod_person_id: PersonId,
80   pub comment_id: CommentId,
81   pub reason: Option<String>,
82   pub removed: Option<bool>,
83   pub when_: chrono::NaiveDateTime,
84 }
85
86 #[derive(Insertable, AsChangeset)]
87 #[table_name = "mod_remove_comment"]
88 pub struct ModRemoveCommentForm {
89   pub mod_person_id: PersonId,
90   pub comment_id: CommentId,
91   pub reason: Option<String>,
92   pub removed: Option<bool>,
93 }
94
95 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
96 #[table_name = "mod_remove_community"]
97 pub struct ModRemoveCommunity {
98   pub id: i32,
99   pub mod_person_id: PersonId,
100   pub community_id: CommunityId,
101   pub reason: Option<String>,
102   pub removed: Option<bool>,
103   pub expires: Option<chrono::NaiveDateTime>,
104   pub when_: chrono::NaiveDateTime,
105 }
106
107 #[derive(Insertable, AsChangeset)]
108 #[table_name = "mod_remove_community"]
109 pub struct ModRemoveCommunityForm {
110   pub mod_person_id: PersonId,
111   pub community_id: CommunityId,
112   pub reason: Option<String>,
113   pub removed: Option<bool>,
114   pub expires: Option<chrono::NaiveDateTime>,
115 }
116
117 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
118 #[table_name = "mod_ban_from_community"]
119 pub struct ModBanFromCommunity {
120   pub id: i32,
121   pub mod_person_id: PersonId,
122   pub other_person_id: PersonId,
123   pub community_id: CommunityId,
124   pub reason: Option<String>,
125   pub banned: Option<bool>,
126   pub expires: Option<chrono::NaiveDateTime>,
127   pub when_: chrono::NaiveDateTime,
128 }
129
130 #[derive(Insertable, AsChangeset)]
131 #[table_name = "mod_ban_from_community"]
132 pub struct ModBanFromCommunityForm {
133   pub mod_person_id: PersonId,
134   pub other_person_id: PersonId,
135   pub community_id: CommunityId,
136   pub reason: Option<String>,
137   pub banned: Option<bool>,
138   pub expires: Option<chrono::NaiveDateTime>,
139 }
140
141 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
142 #[table_name = "mod_ban"]
143 pub struct ModBan {
144   pub id: i32,
145   pub mod_person_id: PersonId,
146   pub other_person_id: PersonId,
147   pub reason: Option<String>,
148   pub banned: Option<bool>,
149   pub expires: Option<chrono::NaiveDateTime>,
150   pub when_: chrono::NaiveDateTime,
151 }
152
153 #[derive(Insertable, AsChangeset)]
154 #[table_name = "mod_hide_community"]
155 pub struct ModHideCommunityForm {
156   pub community_id: CommunityId,
157   pub mod_person_id: PersonId,
158   pub hidden: Option<bool>,
159   pub reason: Option<String>,
160 }
161 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
162 #[table_name = "mod_hide_community"]
163 pub struct ModHideCommunity {
164   pub id: i32,
165   pub community_id: CommunityId,
166   pub mod_person_id: PersonId,
167   pub reason: Option<String>,
168   pub hidden: Option<bool>,
169   pub when_: chrono::NaiveDateTime,
170 }
171
172 #[derive(Insertable, AsChangeset)]
173 #[table_name = "mod_ban"]
174 pub struct ModBanForm {
175   pub mod_person_id: PersonId,
176   pub other_person_id: PersonId,
177   pub reason: Option<String>,
178   pub banned: Option<bool>,
179   pub expires: Option<chrono::NaiveDateTime>,
180 }
181
182 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
183 #[table_name = "mod_add_community"]
184 pub struct ModAddCommunity {
185   pub id: i32,
186   pub mod_person_id: PersonId,
187   pub other_person_id: PersonId,
188   pub community_id: CommunityId,
189   pub removed: Option<bool>,
190   pub when_: chrono::NaiveDateTime,
191 }
192
193 #[derive(Insertable, AsChangeset)]
194 #[table_name = "mod_add_community"]
195 pub struct ModAddCommunityForm {
196   pub mod_person_id: PersonId,
197   pub other_person_id: PersonId,
198   pub community_id: CommunityId,
199   pub removed: Option<bool>,
200 }
201
202 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
203 #[table_name = "mod_transfer_community"]
204 pub struct ModTransferCommunity {
205   pub id: i32,
206   pub mod_person_id: PersonId,
207   pub other_person_id: PersonId,
208   pub community_id: CommunityId,
209   pub removed: Option<bool>,
210   pub when_: chrono::NaiveDateTime,
211 }
212
213 #[derive(Insertable, AsChangeset)]
214 #[table_name = "mod_transfer_community"]
215 pub struct ModTransferCommunityForm {
216   pub mod_person_id: PersonId,
217   pub other_person_id: PersonId,
218   pub community_id: CommunityId,
219   pub removed: Option<bool>,
220 }
221
222 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
223 #[table_name = "mod_add"]
224 pub struct ModAdd {
225   pub id: i32,
226   pub mod_person_id: PersonId,
227   pub other_person_id: PersonId,
228   pub removed: Option<bool>,
229   pub when_: chrono::NaiveDateTime,
230 }
231
232 #[derive(Insertable, AsChangeset)]
233 #[table_name = "mod_add"]
234 pub struct ModAddForm {
235   pub mod_person_id: PersonId,
236   pub other_person_id: PersonId,
237   pub removed: Option<bool>,
238 }