1 use crate::schema::{community, community_follower, community_moderator, community_user_ban};
4 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
5 #[table_name = "community"]
10 pub description: Option<String>,
14 pub published: chrono::NaiveDateTime,
15 pub updated: Option<chrono::NaiveDateTime>,
20 pub private_key: Option<String>,
21 pub public_key: Option<String>,
22 pub last_refreshed_at: chrono::NaiveDateTime,
23 pub icon: Option<String>,
24 pub banner: Option<String>,
27 /// A safe representation of community, without the sensitive info
28 #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
29 #[table_name = "community"]
30 pub struct CommunitySafe {
34 pub description: Option<String>,
38 pub published: chrono::NaiveDateTime,
39 pub updated: Option<chrono::NaiveDateTime>,
44 pub icon: Option<String>,
45 pub banner: Option<String>,
48 #[derive(Insertable, AsChangeset, Debug)]
49 #[table_name = "community"]
50 pub struct CommunityForm {
53 pub description: Option<String>,
56 pub removed: Option<bool>,
57 pub published: Option<chrono::NaiveDateTime>,
58 pub updated: Option<chrono::NaiveDateTime>,
59 pub deleted: Option<bool>,
61 pub actor_id: Option<String>,
63 pub private_key: Option<String>,
64 pub public_key: Option<String>,
65 pub last_refreshed_at: Option<chrono::NaiveDateTime>,
66 pub icon: Option<Option<String>>,
67 pub banner: Option<Option<String>>,
70 #[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
71 #[belongs_to(Community)]
72 #[table_name = "community_moderator"]
73 pub struct CommunityModerator {
75 pub community_id: i32,
77 pub published: chrono::NaiveDateTime,
80 #[derive(Insertable, AsChangeset, Clone)]
81 #[table_name = "community_moderator"]
82 pub struct CommunityModeratorForm {
83 pub community_id: i32,
87 #[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
88 #[belongs_to(Community)]
89 #[table_name = "community_user_ban"]
90 pub struct CommunityUserBan {
92 pub community_id: i32,
94 pub published: chrono::NaiveDateTime,
97 #[derive(Insertable, AsChangeset, Clone)]
98 #[table_name = "community_user_ban"]
99 pub struct CommunityUserBanForm {
100 pub community_id: i32,
104 #[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
105 #[belongs_to(Community)]
106 #[table_name = "community_follower"]
107 pub struct CommunityFollower {
109 pub community_id: i32,
111 pub published: chrono::NaiveDateTime,
112 pub pending: Option<bool>,
115 #[derive(Insertable, AsChangeset, Clone)]
116 #[table_name = "community_follower"]
117 pub struct CommunityFollowerForm {
118 pub community_id: i32,