]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/moderator.rs
Merge branch 'split_user_table' into strictly_type_db_ids
[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   },
13   CommentId,
14   CommunityId,
15   PersonId,
16   PostId,
17 };
18 use serde::Serialize;
19
20 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
21 #[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 #[derive(Insertable, AsChangeset)]
32 #[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, Queryable, Identifiable, PartialEq, Debug, Serialize)]
41 #[table_name = "mod_lock_post"]
42 pub struct ModLockPost {
43   pub id: i32,
44   pub mod_person_id: PersonId,
45   pub post_id: PostId,
46   pub locked: Option<bool>,
47   pub when_: chrono::NaiveDateTime,
48 }
49
50 #[derive(Insertable, AsChangeset)]
51 #[table_name = "mod_lock_post"]
52 pub struct ModLockPostForm {
53   pub mod_person_id: PersonId,
54   pub post_id: PostId,
55   pub locked: Option<bool>,
56 }
57
58 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
59 #[table_name = "mod_sticky_post"]
60 pub struct ModStickyPost {
61   pub id: i32,
62   pub mod_person_id: PersonId,
63   pub post_id: PostId,
64   pub stickied: Option<bool>,
65   pub when_: chrono::NaiveDateTime,
66 }
67
68 #[derive(Insertable, AsChangeset)]
69 #[table_name = "mod_sticky_post"]
70 pub struct ModStickyPostForm {
71   pub mod_person_id: PersonId,
72   pub post_id: PostId,
73   pub stickied: Option<bool>,
74 }
75
76 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
77 #[table_name = "mod_remove_comment"]
78 pub struct ModRemoveComment {
79   pub id: i32,
80   pub mod_person_id: PersonId,
81   pub comment_id: CommentId,
82   pub reason: Option<String>,
83   pub removed: Option<bool>,
84   pub when_: chrono::NaiveDateTime,
85 }
86
87 #[derive(Insertable, AsChangeset)]
88 #[table_name = "mod_remove_comment"]
89 pub struct ModRemoveCommentForm {
90   pub mod_person_id: PersonId,
91   pub comment_id: CommentId,
92   pub reason: Option<String>,
93   pub removed: Option<bool>,
94 }
95
96 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
97 #[table_name = "mod_remove_community"]
98 pub struct ModRemoveCommunity {
99   pub id: i32,
100   pub mod_person_id: PersonId,
101   pub community_id: CommunityId,
102   pub reason: Option<String>,
103   pub removed: Option<bool>,
104   pub expires: Option<chrono::NaiveDateTime>,
105   pub when_: chrono::NaiveDateTime,
106 }
107
108 #[derive(Insertable, AsChangeset)]
109 #[table_name = "mod_remove_community"]
110 pub struct ModRemoveCommunityForm {
111   pub mod_person_id: PersonId,
112   pub community_id: CommunityId,
113   pub reason: Option<String>,
114   pub removed: Option<bool>,
115   pub expires: Option<chrono::NaiveDateTime>,
116 }
117
118 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
119 #[table_name = "mod_ban_from_community"]
120 pub struct ModBanFromCommunity {
121   pub id: i32,
122   pub mod_person_id: PersonId,
123   pub other_person_id: PersonId,
124   pub community_id: CommunityId,
125   pub reason: Option<String>,
126   pub banned: Option<bool>,
127   pub expires: Option<chrono::NaiveDateTime>,
128   pub when_: chrono::NaiveDateTime,
129 }
130
131 #[derive(Insertable, AsChangeset)]
132 #[table_name = "mod_ban_from_community"]
133 pub struct ModBanFromCommunityForm {
134   pub mod_person_id: PersonId,
135   pub other_person_id: PersonId,
136   pub community_id: CommunityId,
137   pub reason: Option<String>,
138   pub banned: Option<bool>,
139   pub expires: Option<chrono::NaiveDateTime>,
140 }
141
142 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
143 #[table_name = "mod_ban"]
144 pub struct ModBan {
145   pub id: i32,
146   pub mod_person_id: PersonId,
147   pub other_person_id: PersonId,
148   pub reason: Option<String>,
149   pub banned: Option<bool>,
150   pub expires: Option<chrono::NaiveDateTime>,
151   pub when_: chrono::NaiveDateTime,
152 }
153
154 #[derive(Insertable, AsChangeset)]
155 #[table_name = "mod_ban"]
156 pub struct ModBanForm {
157   pub mod_person_id: PersonId,
158   pub other_person_id: PersonId,
159   pub reason: Option<String>,
160   pub banned: Option<bool>,
161   pub expires: Option<chrono::NaiveDateTime>,
162 }
163
164 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
165 #[table_name = "mod_add_community"]
166 pub struct ModAddCommunity {
167   pub id: i32,
168   pub mod_person_id: PersonId,
169   pub other_person_id: PersonId,
170   pub community_id: CommunityId,
171   pub removed: Option<bool>,
172   pub when_: chrono::NaiveDateTime,
173 }
174
175 #[derive(Insertable, AsChangeset)]
176 #[table_name = "mod_add_community"]
177 pub struct ModAddCommunityForm {
178   pub mod_person_id: PersonId,
179   pub other_person_id: PersonId,
180   pub community_id: CommunityId,
181   pub removed: Option<bool>,
182 }
183
184 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
185 #[table_name = "mod_add"]
186 pub struct ModAdd {
187   pub id: i32,
188   pub mod_person_id: PersonId,
189   pub other_person_id: PersonId,
190   pub removed: Option<bool>,
191   pub when_: chrono::NaiveDateTime,
192 }
193
194 #[derive(Insertable, AsChangeset)]
195 #[table_name = "mod_add"]
196 pub struct ModAddForm {
197   pub mod_person_id: PersonId,
198   pub other_person_id: PersonId,
199   pub removed: Option<bool>,
200 }