2021-03-18 16:25:21 -04:00
|
|
|
use crate::{
|
2021-10-16 15:33:38 +02:00
|
|
|
newtypes::{CommentId, PersonId, PersonMentionId},
|
2021-03-18 16:25:21 -04:00
|
|
|
schema::person_mention,
|
|
|
|
source::comment::Comment,
|
|
|
|
};
|
2021-10-19 17:37:01 +01:00
|
|
|
use serde::{Deserialize, Serialize};
|
2020-12-21 14:38:34 +01:00
|
|
|
|
2021-10-19 17:37:01 +01:00
|
|
|
#[derive(
|
|
|
|
Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Deserialize,
|
|
|
|
)]
|
2020-12-21 14:38:34 +01:00
|
|
|
#[belongs_to(Comment)]
|
2021-02-26 08:49:58 -05:00
|
|
|
#[table_name = "person_mention"]
|
|
|
|
pub struct PersonMention {
|
2021-03-18 16:25:21 -04:00
|
|
|
pub id: PersonMentionId,
|
|
|
|
pub recipient_id: PersonId,
|
|
|
|
pub comment_id: CommentId,
|
2020-12-21 14:38:34 +01:00
|
|
|
pub read: bool,
|
|
|
|
pub published: chrono::NaiveDateTime,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Insertable, AsChangeset)]
|
2021-02-26 08:49:58 -05:00
|
|
|
#[table_name = "person_mention"]
|
|
|
|
pub struct PersonMentionForm {
|
2021-03-18 16:25:21 -04:00
|
|
|
pub recipient_id: PersonId,
|
|
|
|
pub comment_id: CommentId,
|
2020-12-21 14:38:34 +01:00
|
|
|
pub read: Option<bool>,
|
|
|
|
}
|