]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/person.rs
~80% done
[lemmy.git] / crates / db_schema / src / source / person.rs
1 use crate::{
2   schema::{person, person_alias_1, person_alias_2},
3   DbUrl,
4 };
5 use serde::Serialize;
6
7 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
8 #[table_name = "person"]
9 pub struct Person {
10   pub id: i32,                                  
11   pub name: String,                             
12   pub preferred_username: Option<String>,       
13   pub avatar: Option<DbUrl>,                   
14   pub banned: bool,                             
15   pub published: chrono::NaiveDateTime,         
16   pub updated: Option<chrono::NaiveDateTime>,   
17   pub actor_id: DbUrl,                            
18   pub bio: Option<String>,                      
19   pub local: bool,                              
20   pub private_key: Option<String>,              
21   pub public_key: Option<String>,               
22   pub last_refreshed_at: chrono::NaiveDateTime, 
23   pub banner: Option<DbUrl>,                   
24   pub deleted: bool,                            
25   pub inbox_url: DbUrl,                           
26   pub shared_inbox_url: Option<DbUrl>,            
27 }
28
29 /// A safe representation of user, without the sensitive info
30 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
31 #[table_name = "person"]
32 pub struct PersonSafe {
33   pub id: i32,                                  
34   pub name: String,                             
35   pub preferred_username: Option<String>,       
36   pub avatar: Option<DbUrl>,                   
37   pub banned: bool,                             
38   pub published: chrono::NaiveDateTime,         
39   pub updated: Option<chrono::NaiveDateTime>,   
40   pub actor_id: DbUrl,                            
41   pub bio: Option<String>,                      
42   pub local: bool,                              
43   pub banner: Option<DbUrl>,                   
44   pub deleted: bool,                            
45   pub inbox_url: DbUrl,                           
46   pub shared_inbox_url: Option<DbUrl>,            
47 }
48
49
50 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
51 #[table_name = "person_alias_1"]
52 pub struct PersonAlias1 {
53   pub id: i32,                                  
54   pub name: String,                             
55   pub preferred_username: Option<String>,       
56   pub avatar: Option<DbUrl>,                   
57   pub banned: bool,                             
58   pub published: chrono::NaiveDateTime,         
59   pub updated: Option<chrono::NaiveDateTime>,   
60   pub actor_id: DbUrl,                            
61   pub bio: Option<String>,                      
62   pub local: bool,                              
63   pub private_key: Option<String>,              
64   pub public_key: Option<String>,               
65   pub last_refreshed_at: chrono::NaiveDateTime, 
66   pub banner: Option<DbUrl>,                   
67   pub deleted: bool,                            
68   pub inbox_url: DbUrl,                           
69   pub shared_inbox_url: Option<DbUrl>,            
70 }
71
72 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
73 #[table_name = "person_alias_1"]
74 pub struct PersonSafeAlias1 {
75   pub id: i32,                                  
76   pub name: String,                             
77   pub preferred_username: Option<String>,       
78   pub avatar: Option<DbUrl>,                   
79   pub banned: bool,                             
80   pub published: chrono::NaiveDateTime,         
81   pub updated: Option<chrono::NaiveDateTime>,   
82   pub actor_id: DbUrl,                            
83   pub bio: Option<String>,                      
84   pub local: bool,                              
85   pub banner: Option<DbUrl>,                   
86   pub deleted: bool,                            
87   pub inbox_url: DbUrl,                           
88   pub shared_inbox_url: Option<DbUrl>,            
89 }
90
91 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
92 #[table_name = "person_alias_2"]
93 pub struct PersonAlias2 {
94   pub id: i32,                                  
95   pub name: String,                             
96   pub preferred_username: Option<String>,       
97   pub avatar: Option<DbUrl>,                   
98   pub banned: bool,                             
99   pub published: chrono::NaiveDateTime,         
100   pub updated: Option<chrono::NaiveDateTime>,   
101   pub actor_id: DbUrl,                            
102   pub bio: Option<String>,                      
103   pub local: bool,                              
104   pub private_key: Option<String>,              
105   pub public_key: Option<String>,               
106   pub last_refreshed_at: chrono::NaiveDateTime, 
107   pub banner: Option<DbUrl>,                   
108   pub deleted: bool,                            
109   pub inbox_url: DbUrl,                           
110   pub shared_inbox_url: Option<DbUrl>,            
111 }
112
113 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
114 #[table_name = "person_alias_1"]
115 pub struct PersonSafeAlias2 {
116   pub id: i32,                                  
117   pub name: String,                             
118   pub preferred_username: Option<String>,       
119   pub avatar: Option<DbUrl>,                   
120   pub banned: bool,                             
121   pub published: chrono::NaiveDateTime,         
122   pub updated: Option<chrono::NaiveDateTime>,   
123   pub actor_id: DbUrl,                            
124   pub bio: Option<String>,                      
125   pub local: bool,                              
126   pub banner: Option<DbUrl>,                   
127   pub deleted: bool,                            
128   pub inbox_url: DbUrl,                           
129   pub shared_inbox_url: Option<DbUrl>,            
130 }
131
132 #[derive(Insertable, AsChangeset, Clone)]
133 #[table_name = "person"]
134 pub struct PersonForm {
135   pub name: String,                             
136   pub preferred_username: Option<Option<String>>,
137   pub avatar: Option<Option<DbUrl>>,
138   pub banned: Option<bool>,                             
139   pub published: Option<chrono::NaiveDateTime>,
140   pub updated: Option<chrono::NaiveDateTime>,
141   pub actor_id: Option<DbUrl>,                            
142   pub bio: Option<Option<String>>,                      
143   pub local: Option<bool>,                              
144   pub private_key: Option<Option<String>>,              
145   pub public_key: Option<Option<String>>,               
146   pub last_refreshed_at: Option<chrono::NaiveDateTime>,
147   pub banner: Option<Option<DbUrl>>,
148   pub deleted: Option<bool>,                            
149   pub inbox_url: Option<DbUrl>,                           
150   pub shared_inbox_url: Option<Option<DbUrl>>,
151 }