2 newtypes::{DbUrl, PersonId},
3 schema::{person, person_alias_1, person_alias_2},
5 use serde::{Deserialize, Serialize};
7 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
8 #[table_name = "person"]
12 pub display_name: Option<String>,
13 pub avatar: Option<DbUrl>,
15 pub published: chrono::NaiveDateTime,
16 pub updated: Option<chrono::NaiveDateTime>,
18 pub bio: Option<String>,
20 pub private_key: Option<String>,
21 pub public_key: String,
22 pub last_refreshed_at: chrono::NaiveDateTime,
23 pub banner: Option<DbUrl>,
26 pub shared_inbox_url: Option<DbUrl>,
27 pub matrix_user_id: Option<String>,
29 pub bot_account: bool,
30 pub ban_expires: Option<chrono::NaiveDateTime>,
33 /// A safe representation of person, without the sensitive info
34 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
35 #[table_name = "person"]
36 pub struct PersonSafe {
39 pub display_name: Option<String>,
40 pub avatar: Option<DbUrl>,
42 pub published: chrono::NaiveDateTime,
43 pub updated: Option<chrono::NaiveDateTime>,
45 pub bio: Option<String>,
47 pub banner: Option<DbUrl>,
50 pub shared_inbox_url: Option<DbUrl>,
51 pub matrix_user_id: Option<String>,
53 pub bot_account: bool,
54 pub ban_expires: Option<chrono::NaiveDateTime>,
57 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
58 #[table_name = "person_alias_1"]
59 pub struct PersonAlias1 {
62 pub display_name: Option<String>,
63 pub avatar: Option<DbUrl>,
65 pub published: chrono::NaiveDateTime,
66 pub updated: Option<chrono::NaiveDateTime>,
68 pub bio: Option<String>,
70 pub private_key: Option<String>,
71 pub public_key: String,
72 pub last_refreshed_at: chrono::NaiveDateTime,
73 pub banner: Option<DbUrl>,
76 pub shared_inbox_url: Option<DbUrl>,
77 pub matrix_user_id: Option<String>,
79 pub bot_account: bool,
80 pub ban_expires: Option<chrono::NaiveDateTime>,
83 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
84 #[table_name = "person_alias_1"]
85 pub struct PersonSafeAlias1 {
88 pub display_name: Option<String>,
89 pub avatar: Option<DbUrl>,
91 pub published: chrono::NaiveDateTime,
92 pub updated: Option<chrono::NaiveDateTime>,
94 pub bio: Option<String>,
96 pub banner: Option<DbUrl>,
99 pub shared_inbox_url: Option<DbUrl>,
100 pub matrix_user_id: Option<String>,
102 pub bot_account: bool,
103 pub ban_expires: Option<chrono::NaiveDateTime>,
106 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
107 #[table_name = "person_alias_2"]
108 pub struct PersonAlias2 {
111 pub display_name: Option<String>,
112 pub avatar: Option<DbUrl>,
114 pub published: chrono::NaiveDateTime,
115 pub updated: Option<chrono::NaiveDateTime>,
117 pub bio: Option<String>,
119 pub private_key: Option<String>,
120 pub public_key: String,
121 pub last_refreshed_at: chrono::NaiveDateTime,
122 pub banner: Option<DbUrl>,
124 pub inbox_url: DbUrl,
125 pub shared_inbox_url: Option<DbUrl>,
126 pub matrix_user_id: Option<String>,
128 pub bot_account: bool,
129 pub ban_expires: Option<chrono::NaiveDateTime>,
132 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
133 #[table_name = "person_alias_1"]
134 pub struct PersonSafeAlias2 {
137 pub display_name: Option<String>,
138 pub avatar: Option<DbUrl>,
140 pub published: chrono::NaiveDateTime,
141 pub updated: Option<chrono::NaiveDateTime>,
143 pub bio: Option<String>,
145 pub banner: Option<DbUrl>,
147 pub inbox_url: DbUrl,
148 pub shared_inbox_url: Option<DbUrl>,
149 pub matrix_user_id: Option<String>,
151 pub bot_account: bool,
152 pub ban_expires: Option<chrono::NaiveDateTime>,
155 #[derive(Insertable, AsChangeset, Clone, Default)]
156 #[table_name = "person"]
157 pub struct PersonForm {
159 pub display_name: Option<Option<String>>,
160 pub avatar: Option<Option<DbUrl>>,
161 pub banned: Option<bool>,
162 pub published: Option<chrono::NaiveDateTime>,
163 pub updated: Option<chrono::NaiveDateTime>,
164 pub actor_id: Option<DbUrl>,
165 pub bio: Option<Option<String>>,
166 pub local: Option<bool>,
167 pub private_key: Option<Option<String>>,
168 pub public_key: String,
169 pub last_refreshed_at: Option<chrono::NaiveDateTime>,
170 pub banner: Option<Option<DbUrl>>,
171 pub deleted: Option<bool>,
172 pub inbox_url: Option<DbUrl>,
173 pub shared_inbox_url: Option<Option<DbUrl>>,
174 pub matrix_user_id: Option<Option<String>>,
175 pub admin: Option<bool>,
176 pub bot_account: Option<bool>,
177 pub ban_expires: Option<Option<chrono::NaiveDateTime>>,