]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/person.rs
Mark accounts as bot nutomic (#1565)
[lemmy.git] / crates / db_schema / src / source / person.rs
1 use crate::{
2   schema::{person, person_alias_1, person_alias_2},
3   DbUrl,
4   PersonId,
5 };
6 use serde::Serialize;
7
8 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
9 #[table_name = "person"]
10 pub struct Person {
11   pub id: PersonId,
12   pub name: String,
13   pub display_name: Option<String>,
14   pub avatar: Option<DbUrl>,
15   pub banned: bool,
16   pub published: chrono::NaiveDateTime,
17   pub updated: Option<chrono::NaiveDateTime>,
18   pub actor_id: DbUrl,
19   pub bio: Option<String>,
20   pub local: bool,
21   pub private_key: Option<String>,
22   pub public_key: Option<String>,
23   pub last_refreshed_at: chrono::NaiveDateTime,
24   pub banner: Option<DbUrl>,
25   pub deleted: bool,
26   pub inbox_url: DbUrl,
27   pub shared_inbox_url: Option<DbUrl>,
28   pub matrix_user_id: Option<String>,
29   pub admin: bool,
30   pub bot_account: bool,
31 }
32
33 /// A safe representation of person, without the sensitive info
34 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
35 #[table_name = "person"]
36 pub struct PersonSafe {
37   pub id: PersonId,
38   pub name: String,
39   pub display_name: Option<String>,
40   pub avatar: Option<DbUrl>,
41   pub banned: bool,
42   pub published: chrono::NaiveDateTime,
43   pub updated: Option<chrono::NaiveDateTime>,
44   pub actor_id: DbUrl,
45   pub bio: Option<String>,
46   pub local: bool,
47   pub banner: Option<DbUrl>,
48   pub deleted: bool,
49   pub inbox_url: DbUrl,
50   pub shared_inbox_url: Option<DbUrl>,
51   pub matrix_user_id: Option<String>,
52   pub admin: bool,
53   pub bot_account: bool,
54 }
55
56 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
57 #[table_name = "person_alias_1"]
58 pub struct PersonAlias1 {
59   pub id: PersonId,
60   pub name: String,
61   pub display_name: Option<String>,
62   pub avatar: Option<DbUrl>,
63   pub banned: bool,
64   pub published: chrono::NaiveDateTime,
65   pub updated: Option<chrono::NaiveDateTime>,
66   pub actor_id: DbUrl,
67   pub bio: Option<String>,
68   pub local: bool,
69   pub private_key: Option<String>,
70   pub public_key: Option<String>,
71   pub last_refreshed_at: chrono::NaiveDateTime,
72   pub banner: Option<DbUrl>,
73   pub deleted: bool,
74   pub inbox_url: DbUrl,
75   pub shared_inbox_url: Option<DbUrl>,
76   pub matrix_user_id: Option<String>,
77   pub admin: bool,
78   pub bot_account: bool,
79 }
80
81 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
82 #[table_name = "person_alias_1"]
83 pub struct PersonSafeAlias1 {
84   pub id: PersonId,
85   pub name: String,
86   pub display_name: Option<String>,
87   pub avatar: Option<DbUrl>,
88   pub banned: bool,
89   pub published: chrono::NaiveDateTime,
90   pub updated: Option<chrono::NaiveDateTime>,
91   pub actor_id: DbUrl,
92   pub bio: Option<String>,
93   pub local: bool,
94   pub banner: Option<DbUrl>,
95   pub deleted: bool,
96   pub inbox_url: DbUrl,
97   pub shared_inbox_url: Option<DbUrl>,
98   pub matrix_user_id: Option<String>,
99   pub admin: bool,
100   pub bot_account: bool,
101 }
102
103 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
104 #[table_name = "person_alias_2"]
105 pub struct PersonAlias2 {
106   pub id: PersonId,
107   pub name: String,
108   pub display_name: Option<String>,
109   pub avatar: Option<DbUrl>,
110   pub banned: bool,
111   pub published: chrono::NaiveDateTime,
112   pub updated: Option<chrono::NaiveDateTime>,
113   pub actor_id: DbUrl,
114   pub bio: Option<String>,
115   pub local: bool,
116   pub private_key: Option<String>,
117   pub public_key: Option<String>,
118   pub last_refreshed_at: chrono::NaiveDateTime,
119   pub banner: Option<DbUrl>,
120   pub deleted: bool,
121   pub inbox_url: DbUrl,
122   pub shared_inbox_url: Option<DbUrl>,
123   pub matrix_user_id: Option<String>,
124   pub admin: bool,
125   pub bot_account: bool,
126 }
127
128 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
129 #[table_name = "person_alias_1"]
130 pub struct PersonSafeAlias2 {
131   pub id: PersonId,
132   pub name: String,
133   pub display_name: Option<String>,
134   pub avatar: Option<DbUrl>,
135   pub banned: bool,
136   pub published: chrono::NaiveDateTime,
137   pub updated: Option<chrono::NaiveDateTime>,
138   pub actor_id: DbUrl,
139   pub bio: Option<String>,
140   pub local: bool,
141   pub banner: Option<DbUrl>,
142   pub deleted: bool,
143   pub inbox_url: DbUrl,
144   pub shared_inbox_url: Option<DbUrl>,
145   pub matrix_user_id: Option<String>,
146   pub admin: bool,
147   pub bot_account: bool,
148 }
149
150 #[derive(Insertable, AsChangeset, Clone, Default)]
151 #[table_name = "person"]
152 pub struct PersonForm {
153   pub name: String,
154   pub display_name: Option<Option<String>>,
155   pub avatar: Option<Option<DbUrl>>,
156   pub banned: Option<bool>,
157   pub published: Option<chrono::NaiveDateTime>,
158   pub updated: Option<chrono::NaiveDateTime>,
159   pub actor_id: Option<DbUrl>,
160   pub bio: Option<Option<String>>,
161   pub local: Option<bool>,
162   pub private_key: Option<Option<String>>,
163   pub public_key: Option<Option<String>>,
164   pub last_refreshed_at: Option<chrono::NaiveDateTime>,
165   pub banner: Option<Option<DbUrl>>,
166   pub deleted: Option<bool>,
167   pub inbox_url: Option<DbUrl>,
168   pub shared_inbox_url: Option<Option<DbUrl>>,
169   pub matrix_user_id: Option<Option<String>>,
170   pub admin: Option<bool>,
171   pub bot_account: Option<bool>,
172 }