]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/moderator.rs
000e34868de12d0a089e5a08eb8af9c6d92d6e51
[lemmy.git] / crates / db_schema / src / source / moderator.rs
1 use crate::newtypes::{CommentId, CommunityId, PersonId, PostId};
2 #[cfg(feature = "full")]
3 use crate::schema::{
4   admin_purge_comment,
5   admin_purge_community,
6   admin_purge_person,
7   admin_purge_post,
8   mod_add,
9   mod_add_community,
10   mod_ban,
11   mod_ban_from_community,
12   mod_hide_community,
13   mod_lock_post,
14   mod_remove_comment,
15   mod_remove_community,
16   mod_remove_post,
17   mod_sticky_post,
18   mod_transfer_community,
19 };
20 use serde::{Deserialize, Serialize};
21
22 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
23 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
24 #[cfg_attr(feature = "full", diesel(table_name = mod_remove_post))]
25 pub struct ModRemovePost {
26   pub id: i32,
27   pub mod_person_id: PersonId,
28   pub post_id: PostId,
29   pub reason: Option<String>,
30   pub removed: Option<bool>,
31   pub when_: chrono::NaiveDateTime,
32 }
33
34 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
35 #[cfg_attr(feature = "full", diesel(table_name = mod_remove_post))]
36 pub struct ModRemovePostForm {
37   pub mod_person_id: PersonId,
38   pub post_id: PostId,
39   pub reason: Option<String>,
40   pub removed: Option<bool>,
41 }
42
43 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
44 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
45 #[cfg_attr(feature = "full", diesel(table_name = mod_lock_post))]
46 pub struct ModLockPost {
47   pub id: i32,
48   pub mod_person_id: PersonId,
49   pub post_id: PostId,
50   pub locked: Option<bool>,
51   pub when_: chrono::NaiveDateTime,
52 }
53
54 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
55 #[cfg_attr(feature = "full", diesel(table_name = mod_lock_post))]
56 pub struct ModLockPostForm {
57   pub mod_person_id: PersonId,
58   pub post_id: PostId,
59   pub locked: Option<bool>,
60 }
61
62 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
63 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
64 #[cfg_attr(feature = "full", diesel(table_name = mod_sticky_post))]
65 pub struct ModStickyPost {
66   pub id: i32,
67   pub mod_person_id: PersonId,
68   pub post_id: PostId,
69   pub stickied: Option<bool>,
70   pub when_: chrono::NaiveDateTime,
71 }
72
73 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
74 #[cfg_attr(feature = "full", diesel(table_name = mod_sticky_post))]
75 pub struct ModStickyPostForm {
76   pub mod_person_id: PersonId,
77   pub post_id: PostId,
78   pub stickied: Option<bool>,
79 }
80
81 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
82 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
83 #[cfg_attr(feature = "full", diesel(table_name = mod_remove_comment))]
84 pub struct ModRemoveComment {
85   pub id: i32,
86   pub mod_person_id: PersonId,
87   pub comment_id: CommentId,
88   pub reason: Option<String>,
89   pub removed: Option<bool>,
90   pub when_: chrono::NaiveDateTime,
91 }
92
93 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
94 #[cfg_attr(feature = "full", diesel(table_name = mod_remove_comment))]
95 pub struct ModRemoveCommentForm {
96   pub mod_person_id: PersonId,
97   pub comment_id: CommentId,
98   pub reason: Option<String>,
99   pub removed: Option<bool>,
100 }
101
102 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
103 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
104 #[cfg_attr(feature = "full", diesel(table_name = mod_remove_community))]
105 pub struct ModRemoveCommunity {
106   pub id: i32,
107   pub mod_person_id: PersonId,
108   pub community_id: CommunityId,
109   pub reason: Option<String>,
110   pub removed: Option<bool>,
111   pub expires: Option<chrono::NaiveDateTime>,
112   pub when_: chrono::NaiveDateTime,
113 }
114
115 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
116 #[cfg_attr(feature = "full", diesel(table_name = mod_remove_community))]
117 pub struct ModRemoveCommunityForm {
118   pub mod_person_id: PersonId,
119   pub community_id: CommunityId,
120   pub reason: Option<String>,
121   pub removed: Option<bool>,
122   pub expires: Option<chrono::NaiveDateTime>,
123 }
124
125 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
126 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
127 #[cfg_attr(feature = "full", diesel(table_name = mod_ban_from_community))]
128 pub struct ModBanFromCommunity {
129   pub id: i32,
130   pub mod_person_id: PersonId,
131   pub other_person_id: PersonId,
132   pub community_id: CommunityId,
133   pub reason: Option<String>,
134   pub banned: Option<bool>,
135   pub expires: Option<chrono::NaiveDateTime>,
136   pub when_: chrono::NaiveDateTime,
137 }
138
139 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
140 #[cfg_attr(feature = "full", diesel(table_name = mod_ban_from_community))]
141 pub struct ModBanFromCommunityForm {
142   pub mod_person_id: PersonId,
143   pub other_person_id: PersonId,
144   pub community_id: CommunityId,
145   pub reason: Option<String>,
146   pub banned: Option<bool>,
147   pub expires: Option<chrono::NaiveDateTime>,
148 }
149
150 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
151 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
152 #[cfg_attr(feature = "full", diesel(table_name = mod_ban))]
153 pub struct ModBan {
154   pub id: i32,
155   pub mod_person_id: PersonId,
156   pub other_person_id: PersonId,
157   pub reason: Option<String>,
158   pub banned: Option<bool>,
159   pub expires: Option<chrono::NaiveDateTime>,
160   pub when_: chrono::NaiveDateTime,
161 }
162
163 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
164 #[cfg_attr(feature = "full", diesel(table_name = mod_hide_community))]
165 pub struct ModHideCommunityForm {
166   pub community_id: CommunityId,
167   pub mod_person_id: PersonId,
168   pub hidden: Option<bool>,
169   pub reason: Option<String>,
170 }
171 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
172 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
173 #[cfg_attr(feature = "full", diesel(table_name = mod_hide_community))]
174 pub struct ModHideCommunity {
175   pub id: i32,
176   pub community_id: CommunityId,
177   pub mod_person_id: PersonId,
178   pub reason: Option<String>,
179   pub hidden: Option<bool>,
180   pub when_: chrono::NaiveDateTime,
181 }
182
183 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
184 #[cfg_attr(feature = "full", diesel(table_name = mod_ban))]
185 pub struct ModBanForm {
186   pub mod_person_id: PersonId,
187   pub other_person_id: PersonId,
188   pub reason: Option<String>,
189   pub banned: Option<bool>,
190   pub expires: Option<chrono::NaiveDateTime>,
191 }
192
193 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
194 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
195 #[cfg_attr(feature = "full", diesel(table_name = mod_add_community))]
196 pub struct ModAddCommunity {
197   pub id: i32,
198   pub mod_person_id: PersonId,
199   pub other_person_id: PersonId,
200   pub community_id: CommunityId,
201   pub removed: Option<bool>,
202   pub when_: chrono::NaiveDateTime,
203 }
204
205 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
206 #[cfg_attr(feature = "full", diesel(table_name = mod_add_community))]
207 pub struct ModAddCommunityForm {
208   pub mod_person_id: PersonId,
209   pub other_person_id: PersonId,
210   pub community_id: CommunityId,
211   pub removed: Option<bool>,
212 }
213
214 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
215 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
216 #[cfg_attr(feature = "full", diesel(table_name = mod_transfer_community))]
217 pub struct ModTransferCommunity {
218   pub id: i32,
219   pub mod_person_id: PersonId,
220   pub other_person_id: PersonId,
221   pub community_id: CommunityId,
222   pub removed: Option<bool>,
223   pub when_: chrono::NaiveDateTime,
224 }
225
226 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
227 #[cfg_attr(feature = "full", diesel(table_name = mod_transfer_community))]
228 pub struct ModTransferCommunityForm {
229   pub mod_person_id: PersonId,
230   pub other_person_id: PersonId,
231   pub community_id: CommunityId,
232   pub removed: Option<bool>,
233 }
234
235 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
236 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
237 #[cfg_attr(feature = "full", diesel(table_name = mod_add))]
238 pub struct ModAdd {
239   pub id: i32,
240   pub mod_person_id: PersonId,
241   pub other_person_id: PersonId,
242   pub removed: Option<bool>,
243   pub when_: chrono::NaiveDateTime,
244 }
245
246 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
247 #[cfg_attr(feature = "full", diesel(table_name = mod_add))]
248 pub struct ModAddForm {
249   pub mod_person_id: PersonId,
250   pub other_person_id: PersonId,
251   pub removed: Option<bool>,
252 }
253
254 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
255 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
256 #[cfg_attr(feature = "full", diesel(table_name = admin_purge_person))]
257 pub struct AdminPurgePerson {
258   pub id: i32,
259   pub admin_person_id: PersonId,
260   pub reason: Option<String>,
261   pub when_: chrono::NaiveDateTime,
262 }
263
264 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
265 #[cfg_attr(feature = "full", diesel(table_name = admin_purge_person))]
266 pub struct AdminPurgePersonForm {
267   pub admin_person_id: PersonId,
268   pub reason: Option<String>,
269 }
270
271 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
272 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
273 #[cfg_attr(feature = "full", diesel(table_name = admin_purge_community))]
274 pub struct AdminPurgeCommunity {
275   pub id: i32,
276   pub admin_person_id: PersonId,
277   pub reason: Option<String>,
278   pub when_: chrono::NaiveDateTime,
279 }
280
281 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
282 #[cfg_attr(feature = "full", diesel(table_name = admin_purge_community))]
283 pub struct AdminPurgeCommunityForm {
284   pub admin_person_id: PersonId,
285   pub reason: Option<String>,
286 }
287
288 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
289 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
290 #[cfg_attr(feature = "full", diesel(table_name = admin_purge_post))]
291 pub struct AdminPurgePost {
292   pub id: i32,
293   pub admin_person_id: PersonId,
294   pub community_id: CommunityId,
295   pub reason: Option<String>,
296   pub when_: chrono::NaiveDateTime,
297 }
298
299 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
300 #[cfg_attr(feature = "full", diesel(table_name = admin_purge_post))]
301 pub struct AdminPurgePostForm {
302   pub admin_person_id: PersonId,
303   pub community_id: CommunityId,
304   pub reason: Option<String>,
305 }
306
307 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
308 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
309 #[cfg_attr(feature = "full", diesel(table_name = admin_purge_comment))]
310 pub struct AdminPurgeComment {
311   pub id: i32,
312   pub admin_person_id: PersonId,
313   pub post_id: PostId,
314   pub reason: Option<String>,
315   pub when_: chrono::NaiveDateTime,
316 }
317
318 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
319 #[cfg_attr(feature = "full", diesel(table_name = admin_purge_comment))]
320 pub struct AdminPurgeCommentForm {
321   pub admin_person_id: PersonId,
322   pub post_id: PostId,
323   pub reason: Option<String>,
324 }