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>,
16 pub creator_id: PersonId,
18 pub published: chrono::NaiveDateTime,
19 pub updated: Option<chrono::NaiveDateTime>,
24 pub private_key: Option<String>,
25 pub public_key: Option<String>,
26 pub last_refreshed_at: chrono::NaiveDateTime,
27 pub icon: Option<DbUrl>,
28 pub banner: Option<DbUrl>,
29 pub followers_url: DbUrl,
31 pub shared_inbox_url: Option<DbUrl>,
34 /// A safe representation of community, without the sensitive info
35 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
36 #[table_name = "community"]
37 pub struct CommunitySafe {
41 pub description: Option<String>,
42 pub creator_id: PersonId,
44 pub published: chrono::NaiveDateTime,
45 pub updated: Option<chrono::NaiveDateTime>,
50 pub icon: Option<DbUrl>,
51 pub banner: Option<DbUrl>,
54 #[derive(Insertable, AsChangeset, Debug, Default)]
55 #[table_name = "community"]
56 pub struct CommunityForm {
59 pub description: Option<String>,
60 pub creator_id: PersonId,
61 pub removed: Option<bool>,
62 pub published: Option<chrono::NaiveDateTime>,
63 pub updated: Option<chrono::NaiveDateTime>,
64 pub deleted: Option<bool>,
65 pub nsfw: Option<bool>,
66 pub actor_id: Option<DbUrl>,
67 pub local: Option<bool>,
68 pub private_key: Option<String>,
69 pub public_key: Option<String>,
70 pub last_refreshed_at: Option<chrono::NaiveDateTime>,
71 pub icon: Option<Option<DbUrl>>,
72 pub banner: Option<Option<DbUrl>>,
73 pub followers_url: Option<DbUrl>,
74 pub inbox_url: Option<DbUrl>,
75 pub shared_inbox_url: Option<Option<DbUrl>>,
78 #[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
79 #[belongs_to(Community)]
80 #[table_name = "community_moderator"]
81 pub struct CommunityModerator {
83 pub community_id: CommunityId,
84 pub person_id: PersonId,
85 pub published: chrono::NaiveDateTime,
88 #[derive(Insertable, AsChangeset, Clone)]
89 #[table_name = "community_moderator"]
90 pub struct CommunityModeratorForm {
91 pub community_id: CommunityId,
92 pub person_id: PersonId,
95 #[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
96 #[belongs_to(Community)]
97 #[table_name = "community_person_ban"]
98 pub struct CommunityPersonBan {
100 pub community_id: CommunityId,
101 pub person_id: PersonId,
102 pub published: chrono::NaiveDateTime,
105 #[derive(Insertable, AsChangeset, Clone)]
106 #[table_name = "community_person_ban"]
107 pub struct CommunityPersonBanForm {
108 pub community_id: CommunityId,
109 pub person_id: PersonId,
112 #[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
113 #[belongs_to(Community)]
114 #[table_name = "community_follower"]
115 pub struct CommunityFollower {
117 pub community_id: CommunityId,
118 pub person_id: PersonId,
119 pub published: chrono::NaiveDateTime,
120 pub pending: Option<bool>,
123 #[derive(Insertable, AsChangeset, Clone)]
124 #[table_name = "community_follower"]
125 pub struct CommunityFollowerForm {
126 pub community_id: CommunityId,
127 pub person_id: PersonId,