mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-15 17:03:59 +00:00
30 lines
990 B
Rust
30 lines
990 B
Rust
use crate::newtypes::{CommunityId, PersonId};
|
|
#[cfg(feature = "full")]
|
|
use crate::schema::community_block;
|
|
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
|
#[cfg_attr(
|
|
feature = "full",
|
|
derive(Queryable, Selectable, Associations, Identifiable)
|
|
)]
|
|
#[cfg_attr(
|
|
feature = "full",
|
|
diesel(belongs_to(crate::source::community::Community))
|
|
)]
|
|
#[cfg_attr(feature = "full", diesel(table_name = community_block))]
|
|
#[cfg_attr(feature = "full", diesel(primary_key(person_id, community_id)))]
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
|
pub struct CommunityBlock {
|
|
pub person_id: PersonId,
|
|
pub community_id: CommunityId,
|
|
pub published: DateTime<Utc>,
|
|
}
|
|
|
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
|
#[cfg_attr(feature = "full", diesel(table_name = community_block))]
|
|
pub struct CommunityBlockForm {
|
|
pub person_id: PersonId,
|
|
pub community_id: CommunityId,
|
|
}
|