]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/person.rs
Still continuing on....
[lemmy.git] / crates / db_schema / src / source / person.rs
1 use crate::{
2   schema::{person, person_alias_1, person_alias_2},
3   Url,
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<String>,                   
14   pub banned: bool,                             
15   pub published: chrono::NaiveDateTime,         
16   pub updated: Option<chrono::NaiveDateTime>,   
17   pub actor_id: Url,                            
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<String>,                   
24   pub deleted: bool,                            
25   pub inbox_url: Url,                           
26   pub shared_inbox_url: Option<Url>,            
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<String>,                   
37   pub banned: bool,                             
38   pub published: chrono::NaiveDateTime,         
39   pub updated: Option<chrono::NaiveDateTime>,   
40   pub actor_id: Url,                            
41   pub bio: Option<String>,                      
42   pub local: bool,                              
43   pub last_refreshed_at: chrono::NaiveDateTime, 
44   pub banner: Option<String>,                   
45   pub deleted: bool,                            
46   pub inbox_url: Url,                           
47   pub shared_inbox_url: Option<Url>,            
48 }
49
50
51 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
52 #[table_name = "person_alias_1"]
53 pub struct PersonAlias1 {
54   pub id: i32,                                  
55   pub name: String,                             
56   pub preferred_username: Option<String>,       
57   pub avatar: Option<String>,                   
58   pub banned: bool,                             
59   pub published: chrono::NaiveDateTime,         
60   pub updated: Option<chrono::NaiveDateTime>,   
61   pub actor_id: Url,                            
62   pub bio: Option<String>,                      
63   pub local: bool,                              
64   pub private_key: Option<String>,              
65   pub public_key: Option<String>,               
66   pub last_refreshed_at: chrono::NaiveDateTime, 
67   pub banner: Option<String>,                   
68   pub deleted: bool,                            
69   pub inbox_url: Url,                           
70   pub shared_inbox_url: Option<Url>,            
71 }
72
73 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
74 #[table_name = "person_alias_1"]
75 pub struct PersonSafeAlias1 {
76   pub id: i32,                                  
77   pub name: String,                             
78   pub preferred_username: Option<String>,       
79   pub avatar: Option<String>,                   
80   pub banned: bool,                             
81   pub published: chrono::NaiveDateTime,         
82   pub updated: Option<chrono::NaiveDateTime>,   
83   pub actor_id: Url,                            
84   pub bio: Option<String>,                      
85   pub local: bool,                              
86   pub last_refreshed_at: chrono::NaiveDateTime, 
87   pub banner: Option<String>,                   
88   pub deleted: bool,                            
89   pub inbox_url: Url,                           
90   pub shared_inbox_url: Option<Url>,            
91 }
92
93 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
94 #[table_name = "person_alias_2"]
95 pub struct PersonAlias2 {
96   pub id: i32,                                  
97   pub name: String,                             
98   pub preferred_username: Option<String>,       
99   pub avatar: Option<String>,                   
100   pub banned: bool,                             
101   pub published: chrono::NaiveDateTime,         
102   pub updated: Option<chrono::NaiveDateTime>,   
103   pub actor_id: Url,                            
104   pub bio: Option<String>,                      
105   pub local: bool,                              
106   pub private_key: Option<String>,              
107   pub public_key: Option<String>,               
108   pub last_refreshed_at: chrono::NaiveDateTime, 
109   pub banner: Option<String>,                   
110   pub deleted: bool,                            
111   pub inbox_url: Url,                           
112   pub shared_inbox_url: Option<Url>,            
113 }
114
115 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
116 #[table_name = "person_alias_1"]
117 pub struct PersonSafeAlias2 {
118   pub id: i32,                                  
119   pub name: String,                             
120   pub preferred_username: Option<String>,       
121   pub avatar: Option<String>,                   
122   pub banned: bool,                             
123   pub published: chrono::NaiveDateTime,         
124   pub updated: Option<chrono::NaiveDateTime>,   
125   pub actor_id: Url,                            
126   pub bio: Option<String>,                      
127   pub local: bool,                              
128   pub last_refreshed_at: chrono::NaiveDateTime, 
129   pub banner: Option<String>,                   
130   pub deleted: bool,                            
131   pub inbox_url: Url,                           
132   pub shared_inbox_url: Option<Url>,            
133 }
134
135 #[derive(Insertable, AsChangeset, Clone)]
136 #[table_name = "person"]
137 pub struct PersonForm {
138   pub name: String,                             
139   pub preferred_username: Option<Option<String>>,
140   pub avatar: Option<Option<String>>,
141   pub banned: Option<bool>,                             
142   pub published: Option<chrono::NaiveDateTime>,
143   pub updated: Option<chrono::NaiveDateTime>,
144   pub actor_id: Option<Url>,                            
145   pub bio: Option<Option<String>>,                      
146   pub local: Option<bool>,                              
147   pub private_key: Option<Option<String>>,              
148   pub public_key: Option<Option<String>>,               
149   pub last_refreshed_at: Option<chrono::NaiveDateTime>,
150   pub banner: Option<Option<String>>,
151   pub deleted: Option<bool>,                            
152   pub inbox_url: Option<Url>,                           
153   pub shared_inbox_url: Option<Option<Url>>,
154 }