1 use crate::newtypes::{CommentId, CommunityId, PersonId, PostId};
2 #[cfg(feature = "full")]
11 mod_ban_from_community,
18 mod_transfer_community,
20 use serde::{Deserialize, Serialize};
21 use serde_with::skip_serializing_none;
22 #[cfg(feature = "full")]
25 #[skip_serializing_none]
26 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
27 #[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
28 #[cfg_attr(feature = "full", diesel(table_name = mod_remove_post))]
29 #[cfg_attr(feature = "full", ts(export))]
30 /// When a moderator removes a post.
31 pub struct ModRemovePost {
33 pub mod_person_id: PersonId,
35 pub reason: Option<String>,
37 pub when_: chrono::NaiveDateTime,
40 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
41 #[cfg_attr(feature = "full", diesel(table_name = mod_remove_post))]
42 pub struct ModRemovePostForm {
43 pub mod_person_id: PersonId,
45 pub reason: Option<String>,
46 pub removed: Option<bool>,
49 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
50 #[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
51 #[cfg_attr(feature = "full", diesel(table_name = mod_lock_post))]
52 #[cfg_attr(feature = "full", ts(export))]
53 /// When a moderator locks a post (prevents new comments being made).
54 pub struct ModLockPost {
56 pub mod_person_id: PersonId,
59 pub when_: chrono::NaiveDateTime,
62 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
63 #[cfg_attr(feature = "full", diesel(table_name = mod_lock_post))]
64 pub struct ModLockPostForm {
65 pub mod_person_id: PersonId,
67 pub locked: Option<bool>,
70 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
71 #[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
72 #[cfg_attr(feature = "full", diesel(table_name = mod_feature_post))]
73 #[cfg_attr(feature = "full", ts(export))]
74 /// When a moderator features a post on a community (pins it to the top).
75 pub struct ModFeaturePost {
77 pub mod_person_id: PersonId,
80 pub when_: chrono::NaiveDateTime,
81 pub is_featured_community: bool,
84 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
85 #[cfg_attr(feature = "full", diesel(table_name = mod_feature_post))]
86 pub struct ModFeaturePostForm {
87 pub mod_person_id: PersonId,
90 pub is_featured_community: bool,
93 #[skip_serializing_none]
94 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
95 #[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
96 #[cfg_attr(feature = "full", diesel(table_name = mod_remove_comment))]
97 #[cfg_attr(feature = "full", ts(export))]
98 /// When a moderator removes a comment.
99 pub struct ModRemoveComment {
101 pub mod_person_id: PersonId,
102 pub comment_id: CommentId,
103 pub reason: Option<String>,
105 pub when_: chrono::NaiveDateTime,
108 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
109 #[cfg_attr(feature = "full", diesel(table_name = mod_remove_comment))]
110 pub struct ModRemoveCommentForm {
111 pub mod_person_id: PersonId,
112 pub comment_id: CommentId,
113 pub reason: Option<String>,
114 pub removed: Option<bool>,
117 #[skip_serializing_none]
118 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
119 #[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
120 #[cfg_attr(feature = "full", diesel(table_name = mod_remove_community))]
121 #[cfg_attr(feature = "full", ts(export))]
122 /// When a moderator removes a community.
123 pub struct ModRemoveCommunity {
125 pub mod_person_id: PersonId,
126 pub community_id: CommunityId,
127 pub reason: Option<String>,
129 pub expires: Option<chrono::NaiveDateTime>,
130 pub when_: chrono::NaiveDateTime,
133 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
134 #[cfg_attr(feature = "full", diesel(table_name = mod_remove_community))]
135 pub struct ModRemoveCommunityForm {
136 pub mod_person_id: PersonId,
137 pub community_id: CommunityId,
138 pub reason: Option<String>,
139 pub removed: Option<bool>,
140 pub expires: Option<chrono::NaiveDateTime>,
143 #[skip_serializing_none]
144 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
145 #[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
146 #[cfg_attr(feature = "full", diesel(table_name = mod_ban_from_community))]
147 #[cfg_attr(feature = "full", ts(export))]
148 /// When someone is banned from a community.
149 pub struct ModBanFromCommunity {
151 pub mod_person_id: PersonId,
152 pub other_person_id: PersonId,
153 pub community_id: CommunityId,
154 pub reason: Option<String>,
156 pub expires: Option<chrono::NaiveDateTime>,
157 pub when_: chrono::NaiveDateTime,
160 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
161 #[cfg_attr(feature = "full", diesel(table_name = mod_ban_from_community))]
162 pub struct ModBanFromCommunityForm {
163 pub mod_person_id: PersonId,
164 pub other_person_id: PersonId,
165 pub community_id: CommunityId,
166 pub reason: Option<String>,
167 pub banned: Option<bool>,
168 pub expires: Option<chrono::NaiveDateTime>,
171 #[skip_serializing_none]
172 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
173 #[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
174 #[cfg_attr(feature = "full", diesel(table_name = mod_ban))]
175 #[cfg_attr(feature = "full", ts(export))]
176 /// When someone is banned from the site.
179 pub mod_person_id: PersonId,
180 pub other_person_id: PersonId,
181 pub reason: Option<String>,
183 pub expires: Option<chrono::NaiveDateTime>,
184 pub when_: chrono::NaiveDateTime,
187 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
188 #[cfg_attr(feature = "full", diesel(table_name = mod_hide_community))]
189 pub struct ModHideCommunityForm {
190 pub community_id: CommunityId,
191 pub mod_person_id: PersonId,
192 pub hidden: Option<bool>,
193 pub reason: Option<String>,
196 #[skip_serializing_none]
197 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
198 #[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
199 #[cfg_attr(feature = "full", diesel(table_name = mod_hide_community))]
200 #[cfg_attr(feature = "full", ts(export))]
201 /// When a community is hidden from public view.
202 pub struct ModHideCommunity {
204 pub community_id: CommunityId,
205 pub mod_person_id: PersonId,
206 pub when_: chrono::NaiveDateTime,
207 pub reason: Option<String>,
211 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
212 #[cfg_attr(feature = "full", diesel(table_name = mod_ban))]
213 pub struct ModBanForm {
214 pub mod_person_id: PersonId,
215 pub other_person_id: PersonId,
216 pub reason: Option<String>,
217 pub banned: Option<bool>,
218 pub expires: Option<chrono::NaiveDateTime>,
221 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
222 #[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
223 #[cfg_attr(feature = "full", diesel(table_name = mod_add_community))]
224 #[cfg_attr(feature = "full", ts(export))]
225 /// When someone is added as a community moderator.
226 pub struct ModAddCommunity {
228 pub mod_person_id: PersonId,
229 pub other_person_id: PersonId,
230 pub community_id: CommunityId,
232 pub when_: chrono::NaiveDateTime,
235 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
236 #[cfg_attr(feature = "full", diesel(table_name = mod_add_community))]
237 pub struct ModAddCommunityForm {
238 pub mod_person_id: PersonId,
239 pub other_person_id: PersonId,
240 pub community_id: CommunityId,
241 pub removed: Option<bool>,
244 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
245 #[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
246 #[cfg_attr(feature = "full", diesel(table_name = mod_transfer_community))]
247 #[cfg_attr(feature = "full", ts(export))]
248 /// When a moderator transfers a community to a new owner.
249 pub struct ModTransferCommunity {
251 pub mod_person_id: PersonId,
252 pub other_person_id: PersonId,
253 pub community_id: CommunityId,
254 pub when_: chrono::NaiveDateTime,
257 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
258 #[cfg_attr(feature = "full", diesel(table_name = mod_transfer_community))]
259 pub struct ModTransferCommunityForm {
260 pub mod_person_id: PersonId,
261 pub other_person_id: PersonId,
262 pub community_id: CommunityId,
265 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
266 #[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
267 #[cfg_attr(feature = "full", diesel(table_name = mod_add))]
268 #[cfg_attr(feature = "full", ts(export))]
269 /// When someone is added as a site moderator.
272 pub mod_person_id: PersonId,
273 pub other_person_id: PersonId,
275 pub when_: chrono::NaiveDateTime,
278 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
279 #[cfg_attr(feature = "full", diesel(table_name = mod_add))]
280 pub struct ModAddForm {
281 pub mod_person_id: PersonId,
282 pub other_person_id: PersonId,
283 pub removed: Option<bool>,
286 #[skip_serializing_none]
287 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
288 #[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
289 #[cfg_attr(feature = "full", diesel(table_name = admin_purge_person))]
290 #[cfg_attr(feature = "full", ts(export))]
291 /// When an admin purges a person.
292 pub struct AdminPurgePerson {
294 pub admin_person_id: PersonId,
295 pub reason: Option<String>,
296 pub when_: chrono::NaiveDateTime,
299 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
300 #[cfg_attr(feature = "full", diesel(table_name = admin_purge_person))]
301 pub struct AdminPurgePersonForm {
302 pub admin_person_id: PersonId,
303 pub reason: Option<String>,
306 #[skip_serializing_none]
307 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
308 #[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
309 #[cfg_attr(feature = "full", diesel(table_name = admin_purge_community))]
310 #[cfg_attr(feature = "full", ts(export))]
311 /// When an admin purges a community.
312 pub struct AdminPurgeCommunity {
314 pub admin_person_id: PersonId,
315 pub reason: Option<String>,
316 pub when_: chrono::NaiveDateTime,
319 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
320 #[cfg_attr(feature = "full", diesel(table_name = admin_purge_community))]
321 pub struct AdminPurgeCommunityForm {
322 pub admin_person_id: PersonId,
323 pub reason: Option<String>,
326 #[skip_serializing_none]
327 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
328 #[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
329 #[cfg_attr(feature = "full", diesel(table_name = admin_purge_post))]
330 #[cfg_attr(feature = "full", ts(export))]
331 /// When an admin purges a post.
332 pub struct AdminPurgePost {
334 pub admin_person_id: PersonId,
335 pub community_id: CommunityId,
336 pub reason: Option<String>,
337 pub when_: chrono::NaiveDateTime,
340 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
341 #[cfg_attr(feature = "full", diesel(table_name = admin_purge_post))]
342 pub struct AdminPurgePostForm {
343 pub admin_person_id: PersonId,
344 pub community_id: CommunityId,
345 pub reason: Option<String>,
348 #[skip_serializing_none]
349 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
350 #[cfg_attr(feature = "full", derive(Queryable, Identifiable, TS))]
351 #[cfg_attr(feature = "full", diesel(table_name = admin_purge_comment))]
352 #[cfg_attr(feature = "full", ts(export))]
353 /// When an admin purges a comment.
354 pub struct AdminPurgeComment {
356 pub admin_person_id: PersonId,
358 pub reason: Option<String>,
359 pub when_: chrono::NaiveDateTime,
362 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
363 #[cfg_attr(feature = "full", diesel(table_name = admin_purge_comment))]
364 pub struct AdminPurgeCommentForm {
365 pub admin_person_id: PersonId,
367 pub reason: Option<String>,