]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/comment_reply.rs
737d8df6a5aca9f7b34252eb9e47010f69fe1760
[lemmy.git] / crates / db_schema / src / source / comment_reply.rs
1 use crate::newtypes::{CommentId, CommentReplyId, PersonId};
2 use serde::{Deserialize, Serialize};
3
4 #[cfg(feature = "full")]
5 use crate::schema::comment_reply;
6
7 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
8 #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
9 #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
10 #[cfg_attr(feature = "full", diesel(table_name = comment_reply))]
11 /// This table keeps a list of replies to comments and posts.
12 pub struct CommentReply {
13   pub id: CommentReplyId,
14   pub recipient_id: PersonId,
15   pub comment_id: CommentId,
16   pub read: bool,
17   pub published: chrono::NaiveDateTime,
18 }
19
20 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
21 #[cfg_attr(feature = "full", diesel(table_name = comment_reply))]
22 pub struct CommentReplyForm {
23   pub recipient_id: PersonId,
24   pub comment_id: CommentId,
25   pub read: Option<bool>,
26 }