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