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