2 schema::{community, community_follower, community_moderator, community_person_ban},
9 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
10 #[table_name = "community"]
11 pub struct Community {
15 pub description: Option<String>,
17 pub published: chrono::NaiveDateTime,
18 pub updated: Option<chrono::NaiveDateTime>,
23 pub private_key: Option<String>,
24 pub public_key: Option<String>,
25 pub last_refreshed_at: chrono::NaiveDateTime,
26 pub icon: Option<DbUrl>,
27 pub banner: Option<DbUrl>,
28 pub followers_url: DbUrl,
30 pub shared_inbox_url: Option<DbUrl>,
33 /// A safe representation of community, without the sensitive info
34 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
35 #[table_name = "community"]
36 pub struct CommunitySafe {
40 pub description: Option<String>,
42 pub published: chrono::NaiveDateTime,
43 pub updated: Option<chrono::NaiveDateTime>,
48 pub icon: Option<DbUrl>,
49 pub banner: Option<DbUrl>,
52 #[derive(Insertable, AsChangeset, Debug, Default)]
53 #[table_name = "community"]
54 pub struct CommunityForm {
57 pub description: Option<String>,
58 pub removed: Option<bool>,
59 pub published: Option<chrono::NaiveDateTime>,
60 pub updated: Option<chrono::NaiveDateTime>,
61 pub deleted: Option<bool>,
62 pub nsfw: Option<bool>,
63 pub actor_id: Option<DbUrl>,
64 pub local: Option<bool>,
65 pub private_key: Option<String>,
66 pub public_key: Option<String>,
67 pub last_refreshed_at: Option<chrono::NaiveDateTime>,
68 pub icon: Option<Option<DbUrl>>,
69 pub banner: Option<Option<DbUrl>>,
70 pub followers_url: Option<DbUrl>,
71 pub inbox_url: Option<DbUrl>,
72 pub shared_inbox_url: Option<Option<DbUrl>>,
75 #[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
76 #[belongs_to(Community)]
77 #[table_name = "community_moderator"]
78 pub struct CommunityModerator {
80 pub community_id: CommunityId,
81 pub person_id: PersonId,
82 pub published: chrono::NaiveDateTime,
85 #[derive(Insertable, AsChangeset, Clone)]
86 #[table_name = "community_moderator"]
87 pub struct CommunityModeratorForm {
88 pub community_id: CommunityId,
89 pub person_id: PersonId,
92 #[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
93 #[belongs_to(Community)]
94 #[table_name = "community_person_ban"]
95 pub struct CommunityPersonBan {
97 pub community_id: CommunityId,
98 pub person_id: PersonId,
99 pub published: chrono::NaiveDateTime,
102 #[derive(Insertable, AsChangeset, Clone)]
103 #[table_name = "community_person_ban"]
104 pub struct CommunityPersonBanForm {
105 pub community_id: CommunityId,
106 pub person_id: PersonId,
109 #[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
110 #[belongs_to(Community)]
111 #[table_name = "community_follower"]
112 pub struct CommunityFollower {
114 pub community_id: CommunityId,
115 pub person_id: PersonId,
116 pub published: chrono::NaiveDateTime,
117 pub pending: Option<bool>,
120 #[derive(Insertable, AsChangeset, Clone)]
121 #[table_name = "community_follower"]
122 pub struct CommunityFollowerForm {
123 pub community_id: CommunityId,
124 pub person_id: PersonId,