]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/community_block.rs
Add both (De)Serialize to all models (#1851)
[lemmy.git] / crates / db_schema / src / source / community_block.rs
1 use crate::{
2   schema::community_block,
3   source::community::Community,
4   CommunityBlockId,
5   CommunityId,
6   PersonId,
7 };
8 use serde::{Deserialize, Serialize};
9
10 #[derive(
11   Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Deserialize,
12 )]
13 #[table_name = "community_block"]
14 #[belongs_to(Community)]
15 pub struct CommunityBlock {
16   pub id: CommunityBlockId,
17   pub person_id: PersonId,
18   pub community_id: CommunityId,
19   pub published: chrono::NaiveDateTime,
20 }
21
22 #[derive(Insertable, AsChangeset)]
23 #[table_name = "community_block"]
24 pub struct CommunityBlockForm {
25   pub person_id: PersonId,
26   pub community_id: CommunityId,
27 }