2 schema::{community, community_follower, community_moderator, community_user_ban},
7 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
8 #[table_name = "community"]
13 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<String>,
27 pub banner: Option<String>,
30 /// A safe representation of community, without the sensitive info
31 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
32 #[table_name = "community"]
33 pub struct CommunitySafe {
37 pub description: Option<String>,
41 pub published: chrono::NaiveDateTime,
42 pub updated: Option<chrono::NaiveDateTime>,
47 pub icon: Option<String>,
48 pub banner: Option<String>,
51 #[derive(Insertable, AsChangeset, Debug)]
52 #[table_name = "community"]
53 pub struct CommunityForm {
56 pub description: Option<String>,
59 pub removed: Option<bool>,
60 pub published: Option<chrono::NaiveDateTime>,
61 pub updated: Option<chrono::NaiveDateTime>,
62 pub deleted: Option<bool>,
64 pub actor_id: Option<Url>,
66 pub private_key: Option<String>,
67 pub public_key: Option<String>,
68 pub last_refreshed_at: Option<chrono::NaiveDateTime>,
69 pub icon: Option<Option<String>>,
70 pub banner: Option<Option<String>>,
73 #[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
74 #[belongs_to(Community)]
75 #[table_name = "community_moderator"]
76 pub struct CommunityModerator {
78 pub community_id: i32,
80 pub published: chrono::NaiveDateTime,
83 #[derive(Insertable, AsChangeset, Clone)]
84 #[table_name = "community_moderator"]
85 pub struct CommunityModeratorForm {
86 pub community_id: i32,
90 #[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
91 #[belongs_to(Community)]
92 #[table_name = "community_user_ban"]
93 pub struct CommunityUserBan {
95 pub community_id: i32,
97 pub published: chrono::NaiveDateTime,
100 #[derive(Insertable, AsChangeset, Clone)]
101 #[table_name = "community_user_ban"]
102 pub struct CommunityUserBanForm {
103 pub community_id: i32,
107 #[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
108 #[belongs_to(Community)]
109 #[table_name = "community_follower"]
110 pub struct CommunityFollower {
112 pub community_id: i32,
114 pub published: chrono::NaiveDateTime,
115 pub pending: Option<bool>,
118 #[derive(Insertable, AsChangeset, Clone)]
119 #[table_name = "community_follower"]
120 pub struct CommunityFollowerForm {
121 pub community_id: i32,