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