]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/comment_reply.rs
015a150b2d6a4298156c10fbbd51ed8fe95349c8
[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, Debug, Serialize, Deserialize)]
8 #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
9 #[cfg_attr(feature = "full", belongs_to(crate::source::comment::Comment))]
10 #[cfg_attr(feature = "full", 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", table_name = "comment_reply")]
22 pub struct CommentReplyForm {
23   pub recipient_id: PersonId,
24   pub comment_id: CommentId,
25   pub read: Option<bool>,
26 }