]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/comment_reply.rs
Automatically resolve report when post/comment is removed (#3850)
[lemmy.git] / crates / db_schema / src / source / comment_reply.rs
1 use crate::newtypes::{CommentId, CommentReplyId, PersonId};
2 #[cfg(feature = "full")]
3 use crate::schema::comment_reply;
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 = comment_reply))]
12 #[cfg_attr(feature = "full", ts(export))]
13 /// A comment reply.
14 pub struct CommentReply {
15   pub id: CommentReplyId,
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 = comment_reply))]
24 pub struct CommentReplyInsertForm {
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 = comment_reply))]
32 pub struct CommentReplyUpdateForm {
33   pub read: Option<bool>,
34 }