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