1 use crate::newtypes::{DbUrl, PersonId};
2 use serde::{Deserialize, Serialize};
4 #[cfg(feature = "full")]
5 use crate::schema::person;
7 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
8 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
9 #[cfg_attr(feature = "full", diesel(table_name = person))]
13 pub display_name: Option<String>,
14 pub avatar: Option<DbUrl>,
16 pub published: chrono::NaiveDateTime,
17 pub updated: Option<chrono::NaiveDateTime>,
19 pub bio: Option<String>,
21 pub private_key: Option<String>,
22 pub public_key: String,
23 pub last_refreshed_at: chrono::NaiveDateTime,
24 pub banner: Option<DbUrl>,
27 pub shared_inbox_url: Option<DbUrl>,
28 pub matrix_user_id: Option<String>,
30 pub bot_account: bool,
31 pub ban_expires: Option<chrono::NaiveDateTime>,
34 /// A safe representation of person, without the sensitive info
35 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
36 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
37 #[cfg_attr(feature = "full", diesel(table_name = person))]
38 pub struct PersonSafe {
41 pub display_name: Option<String>,
42 pub avatar: Option<DbUrl>,
44 pub published: chrono::NaiveDateTime,
45 pub updated: Option<chrono::NaiveDateTime>,
47 pub bio: Option<String>,
49 pub banner: Option<DbUrl>,
52 pub shared_inbox_url: Option<DbUrl>,
53 pub matrix_user_id: Option<String>,
55 pub bot_account: bool,
56 pub ban_expires: Option<chrono::NaiveDateTime>,
59 #[derive(Clone, Default)]
60 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
61 #[cfg_attr(feature = "full", diesel(table_name = person))]
62 pub struct PersonForm {
64 pub display_name: Option<Option<String>>,
65 pub avatar: Option<Option<DbUrl>>,
66 pub banned: Option<bool>,
67 pub published: Option<chrono::NaiveDateTime>,
68 pub updated: Option<chrono::NaiveDateTime>,
69 pub actor_id: Option<DbUrl>,
70 pub bio: Option<Option<String>>,
71 pub local: Option<bool>,
72 pub private_key: Option<Option<String>>,
73 pub public_key: Option<String>,
74 pub last_refreshed_at: Option<chrono::NaiveDateTime>,
75 pub banner: Option<Option<DbUrl>>,
76 pub deleted: Option<bool>,
77 pub inbox_url: Option<DbUrl>,
78 pub shared_inbox_url: Option<Option<DbUrl>>,
79 pub matrix_user_id: Option<Option<String>>,
80 pub admin: Option<bool>,
81 pub bot_account: Option<bool>,
82 pub ban_expires: Option<Option<chrono::NaiveDateTime>>,