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