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,
21 // TODO redo these, check table defaults
22 #[derive(Insertable, AsChangeset, Clone, Default)]
23 #[table_name = "local_user"]
24 pub struct LocalUserForm {
25 pub person_id: PersonId,
26 pub password_encrypted: String,
27 pub email: Option<Option<String>>,
28 pub show_nsfw: Option<bool>,
29 pub theme: Option<String>,
30 pub default_sort_type: Option<i16>,
31 pub default_listing_type: Option<i16>,
32 pub lang: Option<String>,
33 pub show_avatars: Option<bool>,
34 pub send_notifications_to_email: Option<bool>,
37 /// A local user view that removes password encrypted
38 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
39 #[table_name = "local_user"]
40 pub struct LocalUserSettings {
42 pub person_id: PersonId,
43 pub email: Option<String>,
46 pub default_sort_type: i16,
47 pub default_listing_type: i16,
49 pub show_avatars: bool,
50 pub send_notifications_to_email: bool,
51 pub validator_time: chrono::NaiveDateTime,