]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/local_user.rs
~80% done
[lemmy.git] / crates / db_schema / src / source / local_user.rs
1 use crate::schema::local_user;
2 use serde::Serialize;
3
4 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
5 #[table_name = "local_user"]
6 pub struct LocalUser {
7   pub id: i32,                                  
8   pub person_id: i32,                          
9   pub password_encrypted: String,               
10   pub email: Option<String>,                    
11   pub admin: bool,                              
12   pub show_nsfw: bool,                          
13   pub theme: String,                            
14   pub default_sort_type: i16,                   
15   pub default_listing_type: i16,                
16   pub lang: String,                             
17   pub show_avatars: bool,                       
18   pub send_notifications_to_email: bool,        
19   pub matrix_user_id: Option<String>,           
20 }
21
22 // TODO redo these, check table defaults
23 #[derive(Insertable, AsChangeset, Clone)]
24 #[table_name = "local_user"]
25 pub struct LocalUserForm {
26   pub person_id: i32,                          
27   pub password_encrypted: String,               
28   pub email: Option<Option<String>>,
29   pub admin: Option<bool>,                              
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 matrix_user_id: Option<Option<String>>,
38 }
39
40 /// A local user view that removes password encrypted
41 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
42 #[table_name = "local_user"]
43 pub struct LocalUserSettings{
44   pub id: i32,                                  
45   pub person_id: i32,                          
46   pub email: Option<String>,                    
47   pub admin: bool,                              
48   pub show_nsfw: bool,                          
49   pub theme: String,                            
50   pub default_sort_type: i16,                   
51   pub default_listing_type: i16,                
52   pub lang: String,                             
53   pub show_avatars: bool,                       
54   pub send_notifications_to_email: bool,        
55   pub matrix_user_id: Option<String>,           
56 }