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