]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/person_mention.rs
Split activity table into sent and received parts (fixes #3103) (#3583)
[lemmy.git] / crates / db_schema / src / source / person_mention.rs
1 use crate::newtypes::{CommentId, PersonId, PersonMentionId};
2 #[cfg(feature = "full")]
3 use crate::schema::person_mention;
4 use serde::{Deserialize, Serialize};
5 #[cfg(feature = "full")]
6 use ts_rs::TS;
7
8 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
9 #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))]
10 #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
11 #[cfg_attr(feature = "full", diesel(table_name = person_mention))]
12 #[cfg_attr(feature = "full", ts(export))]
13 /// A person mention.
14 pub struct PersonMention {
15   pub id: PersonMentionId,
16   pub recipient_id: PersonId,
17   pub comment_id: CommentId,
18   pub read: bool,
19   pub published: chrono::NaiveDateTime,
20 }
21
22 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
23 #[cfg_attr(feature = "full", diesel(table_name = person_mention))]
24 pub struct PersonMentionInsertForm {
25   pub recipient_id: PersonId,
26   pub comment_id: CommentId,
27   pub read: Option<bool>,
28 }
29
30 #[cfg_attr(feature = "full", derive(AsChangeset))]
31 #[cfg_attr(feature = "full", diesel(table_name = person_mention))]
32 pub struct PersonMentionUpdateForm {
33   pub read: Option<bool>,
34 }