1 use crate::schema::{user_, user_alias_1, user_alias_2};
4 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
5 #[table_name = "user_"]
9 pub preferred_username: Option<String>,
10 pub password_encrypted: String,
11 pub email: Option<String>,
12 pub avatar: Option<String>,
15 pub published: chrono::NaiveDateTime,
16 pub updated: Option<chrono::NaiveDateTime>,
19 pub default_sort_type: i16,
20 pub default_listing_type: i16,
22 pub show_avatars: bool,
23 pub send_notifications_to_email: bool,
24 pub matrix_user_id: Option<String>,
26 pub bio: Option<String>,
28 pub private_key: Option<String>,
29 pub public_key: Option<String>,
30 pub last_refreshed_at: chrono::NaiveDateTime,
31 pub banner: Option<String>,
35 /// A safe representation of user, without the sensitive info
36 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
37 #[table_name = "user_"]
41 pub preferred_username: Option<String>,
42 pub avatar: Option<String>,
45 pub published: chrono::NaiveDateTime,
46 pub updated: Option<chrono::NaiveDateTime>,
47 pub matrix_user_id: Option<String>,
49 pub bio: Option<String>,
51 pub banner: Option<String>,
55 /// A safe user view with only settings
56 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
57 #[table_name = "user_"]
58 pub struct UserSafeSettings {
61 pub preferred_username: Option<String>,
62 pub email: Option<String>,
63 pub avatar: Option<String>,
66 pub published: chrono::NaiveDateTime,
67 pub updated: Option<chrono::NaiveDateTime>,
70 pub default_sort_type: i16,
71 pub default_listing_type: i16,
73 pub show_avatars: bool,
74 pub send_notifications_to_email: bool,
75 pub matrix_user_id: Option<String>,
77 pub bio: Option<String>,
79 pub last_refreshed_at: chrono::NaiveDateTime,
80 pub banner: Option<String>,
84 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
85 #[table_name = "user_alias_1"]
86 pub struct UserAlias1 {
89 pub preferred_username: Option<String>,
90 pub password_encrypted: String,
91 pub email: Option<String>,
92 pub avatar: Option<String>,
95 pub published: chrono::NaiveDateTime,
96 pub updated: Option<chrono::NaiveDateTime>,
99 pub default_sort_type: i16,
100 pub default_listing_type: i16,
102 pub show_avatars: bool,
103 pub send_notifications_to_email: bool,
104 pub matrix_user_id: Option<String>,
105 pub actor_id: String,
106 pub bio: Option<String>,
108 pub private_key: Option<String>,
109 pub public_key: Option<String>,
110 pub last_refreshed_at: chrono::NaiveDateTime,
111 pub banner: Option<String>,
115 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
116 #[table_name = "user_alias_1"]
117 pub struct UserSafeAlias1 {
120 pub preferred_username: Option<String>,
121 pub avatar: Option<String>,
124 pub published: chrono::NaiveDateTime,
125 pub updated: Option<chrono::NaiveDateTime>,
126 pub matrix_user_id: Option<String>,
127 pub actor_id: String,
128 pub bio: Option<String>,
130 pub banner: Option<String>,
134 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
135 #[table_name = "user_alias_2"]
136 pub struct UserAlias2 {
139 pub preferred_username: Option<String>,
140 pub password_encrypted: String,
141 pub email: Option<String>,
142 pub avatar: Option<String>,
145 pub published: chrono::NaiveDateTime,
146 pub updated: Option<chrono::NaiveDateTime>,
149 pub default_sort_type: i16,
150 pub default_listing_type: i16,
152 pub show_avatars: bool,
153 pub send_notifications_to_email: bool,
154 pub matrix_user_id: Option<String>,
155 pub actor_id: String,
156 pub bio: Option<String>,
158 pub private_key: Option<String>,
159 pub public_key: Option<String>,
160 pub last_refreshed_at: chrono::NaiveDateTime,
161 pub banner: Option<String>,
165 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
166 #[table_name = "user_alias_2"]
167 pub struct UserSafeAlias2 {
170 pub preferred_username: Option<String>,
171 pub avatar: Option<String>,
174 pub published: chrono::NaiveDateTime,
175 pub updated: Option<chrono::NaiveDateTime>,
176 pub matrix_user_id: Option<String>,
177 pub actor_id: String,
178 pub bio: Option<String>,
180 pub banner: Option<String>,
184 #[derive(Insertable, AsChangeset, Clone)]
185 #[table_name = "user_"]
186 pub struct UserForm {
188 pub preferred_username: Option<Option<String>>,
189 pub password_encrypted: String,
191 pub banned: Option<bool>,
192 pub email: Option<Option<String>>,
193 pub avatar: Option<Option<String>>,
194 pub published: Option<chrono::NaiveDateTime>,
195 pub updated: Option<chrono::NaiveDateTime>,
198 pub default_sort_type: i16,
199 pub default_listing_type: i16,
201 pub show_avatars: bool,
202 pub send_notifications_to_email: bool,
203 pub matrix_user_id: Option<Option<String>>,
204 pub actor_id: Option<String>,
205 pub bio: Option<Option<String>>,
207 pub private_key: Option<String>,
208 pub public_key: Option<String>,
209 pub last_refreshed_at: Option<chrono::NaiveDateTime>,
210 pub banner: Option<Option<String>>,