1 use crate::newtypes::{DbUrl, PersonId};
2 use serde::{Deserialize, Serialize};
4 #[cfg(feature = "full")]
5 use crate::schema::{person, person_alias_1, person_alias_2};
7 #[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
8 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
9 #[cfg_attr(feature = "full", table_name = "person")]
13 pub display_name: Option<String>,
14 pub avatar: Option<DbUrl>,
16 pub published: chrono::NaiveDateTime,
17 pub updated: Option<chrono::NaiveDateTime>,
19 pub bio: Option<String>,
21 pub private_key: Option<String>,
22 pub public_key: String,
23 pub last_refreshed_at: chrono::NaiveDateTime,
24 pub banner: Option<DbUrl>,
27 pub shared_inbox_url: Option<DbUrl>,
28 pub matrix_user_id: Option<String>,
30 pub bot_account: bool,
31 pub ban_expires: Option<chrono::NaiveDateTime>,
34 /// A safe representation of person, without the sensitive info
35 #[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
36 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
37 #[cfg_attr(feature = "full", table_name = "person")]
38 pub struct PersonSafe {
41 pub display_name: Option<String>,
42 pub avatar: Option<DbUrl>,
44 pub published: chrono::NaiveDateTime,
45 pub updated: Option<chrono::NaiveDateTime>,
47 pub bio: Option<String>,
49 pub banner: Option<DbUrl>,
52 pub shared_inbox_url: Option<DbUrl>,
53 pub matrix_user_id: Option<String>,
55 pub bot_account: bool,
56 pub ban_expires: Option<chrono::NaiveDateTime>,
59 #[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
60 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
61 #[cfg_attr(feature = "full", table_name = "person_alias_1")]
62 pub struct PersonAlias1 {
65 pub display_name: Option<String>,
66 pub avatar: Option<DbUrl>,
68 pub published: chrono::NaiveDateTime,
69 pub updated: Option<chrono::NaiveDateTime>,
71 pub bio: Option<String>,
73 pub private_key: Option<String>,
74 pub public_key: String,
75 pub last_refreshed_at: chrono::NaiveDateTime,
76 pub banner: Option<DbUrl>,
79 pub shared_inbox_url: Option<DbUrl>,
80 pub matrix_user_id: Option<String>,
82 pub bot_account: bool,
83 pub ban_expires: Option<chrono::NaiveDateTime>,
86 #[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
87 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
88 #[cfg_attr(feature = "full", table_name = "person_alias_1")]
89 pub struct PersonSafeAlias1 {
92 pub display_name: Option<String>,
93 pub avatar: Option<DbUrl>,
95 pub published: chrono::NaiveDateTime,
96 pub updated: Option<chrono::NaiveDateTime>,
98 pub bio: Option<String>,
100 pub banner: Option<DbUrl>,
102 pub inbox_url: DbUrl,
103 pub shared_inbox_url: Option<DbUrl>,
104 pub matrix_user_id: Option<String>,
106 pub bot_account: bool,
107 pub ban_expires: Option<chrono::NaiveDateTime>,
110 #[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
111 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
112 #[cfg_attr(feature = "full", table_name = "person_alias_2")]
113 pub struct PersonAlias2 {
116 pub display_name: Option<String>,
117 pub avatar: Option<DbUrl>,
119 pub published: chrono::NaiveDateTime,
120 pub updated: Option<chrono::NaiveDateTime>,
122 pub bio: Option<String>,
124 pub private_key: Option<String>,
125 pub public_key: String,
126 pub last_refreshed_at: chrono::NaiveDateTime,
127 pub banner: Option<DbUrl>,
129 pub inbox_url: DbUrl,
130 pub shared_inbox_url: Option<DbUrl>,
131 pub matrix_user_id: Option<String>,
133 pub bot_account: bool,
134 pub ban_expires: Option<chrono::NaiveDateTime>,
137 #[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
138 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
139 #[cfg_attr(feature = "full", table_name = "person_alias_1")]
140 pub struct PersonSafeAlias2 {
143 pub display_name: Option<String>,
144 pub avatar: Option<DbUrl>,
146 pub published: chrono::NaiveDateTime,
147 pub updated: Option<chrono::NaiveDateTime>,
149 pub bio: Option<String>,
151 pub banner: Option<DbUrl>,
153 pub inbox_url: DbUrl,
154 pub shared_inbox_url: Option<DbUrl>,
155 pub matrix_user_id: Option<String>,
157 pub bot_account: bool,
158 pub ban_expires: Option<chrono::NaiveDateTime>,
161 #[derive(Clone, Default)]
162 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
163 #[cfg_attr(feature = "full", table_name = "person")]
164 pub struct PersonForm {
166 pub display_name: Option<Option<String>>,
167 pub avatar: Option<Option<DbUrl>>,
168 pub banned: Option<bool>,
169 pub published: Option<chrono::NaiveDateTime>,
170 pub updated: Option<chrono::NaiveDateTime>,
171 pub actor_id: Option<DbUrl>,
172 pub bio: Option<Option<String>>,
173 pub local: Option<bool>,
174 pub private_key: Option<Option<String>>,
175 pub public_key: Option<String>,
176 pub last_refreshed_at: Option<chrono::NaiveDateTime>,
177 pub banner: Option<Option<DbUrl>>,
178 pub deleted: Option<bool>,
179 pub inbox_url: Option<DbUrl>,
180 pub shared_inbox_url: Option<Option<DbUrl>>,
181 pub matrix_user_id: Option<Option<String>>,
182 pub admin: Option<bool>,
183 pub bot_account: Option<bool>,
184 pub ban_expires: Option<Option<chrono::NaiveDateTime>>,