1 use crate::{schema::local_user, LocalUserId, PersonId};
4 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
5 #[table_name = "local_user"]
8 pub person_id: PersonId,
9 pub password_encrypted: String,
10 pub email: Option<String>,
13 pub default_sort_type: i16,
14 pub default_listing_type: i16,
16 pub show_avatars: bool,
17 pub send_notifications_to_email: bool,
18 pub validator_time: chrono::NaiveDateTime,
19 pub show_bot_accounts: bool,
20 pub show_scores: bool,
23 // TODO redo these, check table defaults
24 #[derive(Insertable, AsChangeset, Clone, Default)]
25 #[table_name = "local_user"]
26 pub struct LocalUserForm {
27 pub person_id: PersonId,
28 pub password_encrypted: String,
29 pub email: Option<Option<String>>,
30 pub show_nsfw: Option<bool>,
31 pub theme: Option<String>,
32 pub default_sort_type: Option<i16>,
33 pub default_listing_type: Option<i16>,
34 pub lang: Option<String>,
35 pub show_avatars: Option<bool>,
36 pub send_notifications_to_email: Option<bool>,
37 pub show_bot_accounts: Option<bool>,
38 pub show_scores: Option<bool>,
41 /// A local user view that removes password encrypted
42 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
43 #[table_name = "local_user"]
44 pub struct LocalUserSettings {
46 pub person_id: PersonId,
47 pub email: Option<String>,
50 pub default_sort_type: i16,
51 pub default_listing_type: i16,
53 pub show_avatars: bool,
54 pub send_notifications_to_email: bool,
55 pub validator_time: chrono::NaiveDateTime,
56 pub show_bot_accounts: bool,
57 pub show_scores: bool,