]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/person_mention.rs
Add both (De)Serialize to all models (#1851)
[lemmy.git] / crates / db_schema / src / source / person_mention.rs
1 use crate::{
2   schema::person_mention,
3   source::comment::Comment,
4   CommentId,
5   PersonId,
6   PersonMentionId,
7 };
8 use serde::{Deserialize, Serialize};
9
10 #[derive(
11   Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Deserialize,
12 )]
13 #[belongs_to(Comment)]
14 #[table_name = "person_mention"]
15 pub struct PersonMention {
16   pub id: PersonMentionId,
17   pub recipient_id: PersonId,
18   pub comment_id: CommentId,
19   pub read: bool,
20   pub published: chrono::NaiveDateTime,
21 }
22
23 #[derive(Insertable, AsChangeset)]
24 #[table_name = "person_mention"]
25 pub struct PersonMentionForm {
26   pub recipient_id: PersonId,
27   pub comment_id: CommentId,
28   pub read: Option<bool>,
29 }