1 use crate::{schema::local_user, LocalUserId, PersonId};
2 use serde::{Deserialize, Serialize};
4 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
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,
21 pub show_read_posts: bool,
22 pub show_new_post_notifs: bool,
25 // TODO redo these, check table defaults
26 #[derive(Insertable, AsChangeset, Clone, Default)]
27 #[table_name = "local_user"]
28 pub struct LocalUserForm {
29 pub person_id: PersonId,
30 pub password_encrypted: String,
31 pub email: Option<Option<String>>,
32 pub show_nsfw: Option<bool>,
33 pub theme: Option<String>,
34 pub default_sort_type: Option<i16>,
35 pub default_listing_type: Option<i16>,
36 pub lang: Option<String>,
37 pub show_avatars: Option<bool>,
38 pub send_notifications_to_email: Option<bool>,
39 pub show_bot_accounts: Option<bool>,
40 pub show_scores: Option<bool>,
41 pub show_read_posts: Option<bool>,
42 pub show_new_post_notifs: Option<bool>,
45 /// A local user view that removes password encrypted
46 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
47 #[table_name = "local_user"]
48 pub struct LocalUserSettings {
50 pub person_id: PersonId,
51 pub email: Option<String>,
54 pub default_sort_type: i16,
55 pub default_listing_type: i16,
57 pub show_avatars: bool,
58 pub send_notifications_to_email: bool,
59 pub validator_time: chrono::NaiveDateTime,
60 pub show_bot_accounts: bool,
61 pub show_scores: bool,
62 pub show_read_posts: bool,
63 pub show_new_post_notifs: bool,