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,
26 pub email_verified: bool,
27 pub accepted_application: bool,
30 // TODO redo these, check table defaults
31 #[derive(Insertable, AsChangeset, Clone, Default)]
32 #[table_name = "local_user"]
33 pub struct LocalUserForm {
34 pub person_id: Option<PersonId>,
35 pub password_encrypted: Option<String>,
36 pub email: Option<Option<String>>,
37 pub show_nsfw: Option<bool>,
38 pub theme: Option<String>,
39 pub default_sort_type: Option<i16>,
40 pub default_listing_type: Option<i16>,
41 pub lang: Option<String>,
42 pub show_avatars: Option<bool>,
43 pub send_notifications_to_email: Option<bool>,
44 pub show_bot_accounts: Option<bool>,
45 pub show_scores: Option<bool>,
46 pub show_read_posts: Option<bool>,
47 pub show_new_post_notifs: Option<bool>,
48 pub email_verified: Option<bool>,
49 pub accepted_application: Option<bool>,
52 /// A local user view that removes password encrypted
53 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
54 #[table_name = "local_user"]
55 pub struct LocalUserSettings {
57 pub person_id: PersonId,
58 pub email: Option<String>,
61 pub default_sort_type: i16,
62 pub default_listing_type: i16,
64 pub show_avatars: bool,
65 pub send_notifications_to_email: bool,
66 pub validator_time: chrono::NaiveDateTime,
67 pub show_bot_accounts: bool,
68 pub show_scores: bool,
69 pub show_read_posts: bool,
70 pub show_new_post_notifs: bool,
71 pub email_verified: bool,
72 pub accepted_application: bool,