Skip to main content

lemmy_db_schema/source/
person_block.rs

1use crate::newtypes::PersonId;
2#[cfg(feature = "full")]
3use crate::schema::person_block;
4use chrono::{DateTime, Utc};
5use serde::{Deserialize, Serialize};
6
7#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
8#[cfg_attr(
9  feature = "full",
10  derive(Queryable, Selectable, Associations, Identifiable)
11)]
12#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::person::Person)))]
13#[cfg_attr(feature = "full", diesel(table_name = person_block))]
14#[cfg_attr(feature = "full", diesel(primary_key(person_id, target_id)))]
15#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
16pub struct PersonBlock {
17  pub person_id: PersonId,
18  pub target_id: PersonId,
19  pub published: DateTime<Utc>,
20}
21
22#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
23#[cfg_attr(feature = "full", diesel(table_name = person_block))]
24pub struct PersonBlockForm {
25  pub person_id: PersonId,
26  pub target_id: PersonId,
27}