2 newtypes::{LocalUserId, PersonId},
5 use serde::{Deserialize, Serialize};
7 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
8 #[table_name = "local_user"]
11 pub person_id: PersonId,
12 pub password_encrypted: String,
13 pub email: Option<String>,
16 pub default_sort_type: i16,
17 pub default_listing_type: i16,
19 pub show_avatars: bool,
20 pub send_notifications_to_email: bool,
21 pub validator_time: chrono::NaiveDateTime,
22 pub show_bot_accounts: bool,
23 pub show_scores: bool,
24 pub show_read_posts: bool,
25 pub show_new_post_notifs: bool,
28 // TODO redo these, check table defaults
29 #[derive(Insertable, AsChangeset, Clone, Default)]
30 #[table_name = "local_user"]
31 pub struct LocalUserForm {
32 pub person_id: PersonId,
33 pub password_encrypted: String,
34 pub email: Option<Option<String>>,
35 pub show_nsfw: Option<bool>,
36 pub theme: Option<String>,
37 pub default_sort_type: Option<i16>,
38 pub default_listing_type: Option<i16>,
39 pub lang: Option<String>,
40 pub show_avatars: Option<bool>,
41 pub send_notifications_to_email: Option<bool>,
42 pub show_bot_accounts: Option<bool>,
43 pub show_scores: Option<bool>,
44 pub show_read_posts: Option<bool>,
45 pub show_new_post_notifs: Option<bool>,
48 /// A local user view that removes password encrypted
49 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
50 #[table_name = "local_user"]
51 pub struct LocalUserSettings {
53 pub person_id: PersonId,
54 pub email: Option<String>,
57 pub default_sort_type: i16,
58 pub default_listing_type: i16,
60 pub show_avatars: bool,
61 pub send_notifications_to_email: bool,
62 pub validator_time: chrono::NaiveDateTime,
63 pub show_bot_accounts: bool,
64 pub show_scores: bool,
65 pub show_read_posts: bool,
66 pub show_new_post_notifs: bool,