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: Option<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,
32 /// A safe representation of person, without the sensitive info
33 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
34 #[table_name = "person"]
35 pub struct PersonSafe {
38 pub display_name: Option<String>,
39 pub avatar: Option<DbUrl>,
41 pub published: chrono::NaiveDateTime,
42 pub updated: Option<chrono::NaiveDateTime>,
44 pub bio: Option<String>,
46 pub banner: Option<DbUrl>,
49 pub shared_inbox_url: Option<DbUrl>,
50 pub matrix_user_id: Option<String>,
52 pub bot_account: bool,
55 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
56 #[table_name = "person_alias_1"]
57 pub struct PersonAlias1 {
60 pub display_name: Option<String>,
61 pub avatar: Option<DbUrl>,
63 pub published: chrono::NaiveDateTime,
64 pub updated: Option<chrono::NaiveDateTime>,
66 pub bio: Option<String>,
68 pub private_key: Option<String>,
69 pub public_key: Option<String>,
70 pub last_refreshed_at: chrono::NaiveDateTime,
71 pub banner: Option<DbUrl>,
74 pub shared_inbox_url: Option<DbUrl>,
75 pub matrix_user_id: Option<String>,
77 pub bot_account: bool,
80 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
81 #[table_name = "person_alias_1"]
82 pub struct PersonSafeAlias1 {
85 pub display_name: Option<String>,
86 pub avatar: Option<DbUrl>,
88 pub published: chrono::NaiveDateTime,
89 pub updated: Option<chrono::NaiveDateTime>,
91 pub bio: Option<String>,
93 pub banner: Option<DbUrl>,
96 pub shared_inbox_url: Option<DbUrl>,
97 pub matrix_user_id: Option<String>,
99 pub bot_account: bool,
102 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
103 #[table_name = "person_alias_2"]
104 pub struct PersonAlias2 {
107 pub display_name: Option<String>,
108 pub avatar: Option<DbUrl>,
110 pub published: chrono::NaiveDateTime,
111 pub updated: Option<chrono::NaiveDateTime>,
113 pub bio: Option<String>,
115 pub private_key: Option<String>,
116 pub public_key: Option<String>,
117 pub last_refreshed_at: chrono::NaiveDateTime,
118 pub banner: Option<DbUrl>,
120 pub inbox_url: DbUrl,
121 pub shared_inbox_url: Option<DbUrl>,
122 pub matrix_user_id: Option<String>,
124 pub bot_account: bool,
127 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
128 #[table_name = "person_alias_1"]
129 pub struct PersonSafeAlias2 {
132 pub display_name: Option<String>,
133 pub avatar: Option<DbUrl>,
135 pub published: chrono::NaiveDateTime,
136 pub updated: Option<chrono::NaiveDateTime>,
138 pub bio: Option<String>,
140 pub banner: Option<DbUrl>,
142 pub inbox_url: DbUrl,
143 pub shared_inbox_url: Option<DbUrl>,
144 pub matrix_user_id: Option<String>,
146 pub bot_account: bool,
149 #[derive(Insertable, AsChangeset, Clone, Default)]
150 #[table_name = "person"]
151 pub struct PersonForm {
153 pub display_name: Option<Option<String>>,
154 pub avatar: Option<Option<DbUrl>>,
155 pub banned: Option<bool>,
156 pub published: Option<chrono::NaiveDateTime>,
157 pub updated: Option<chrono::NaiveDateTime>,
158 pub actor_id: Option<DbUrl>,
159 pub bio: Option<Option<String>>,
160 pub local: Option<bool>,
161 pub private_key: Option<Option<String>>,
162 pub public_key: Option<Option<String>>,
163 pub last_refreshed_at: Option<chrono::NaiveDateTime>,
164 pub banner: Option<Option<DbUrl>>,
165 pub deleted: Option<bool>,
166 pub inbox_url: Option<DbUrl>,
167 pub shared_inbox_url: Option<Option<DbUrl>>,
168 pub matrix_user_id: Option<Option<String>>,
169 pub admin: Option<bool>,
170 pub bot_account: Option<bool>,