2 schema::{comment, comment_alias_1, comment_like, comment_saved},
11 // WITH RECURSIVE MyTree AS (
12 // SELECT * FROM comment WHERE parent_id IS NULL
14 // SELECT m.* FROM comment AS m JOIN MyTree AS t ON m.parent_id = t.id
16 // SELECT * FROM MyTree;
18 #[derive(Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize)]
20 #[table_name = "comment"]
23 pub creator_id: PersonId,
25 pub parent_id: Option<CommentId>,
28 pub read: bool, // Whether the recipient has read the comment or not
29 pub published: chrono::NaiveDateTime,
30 pub updated: Option<chrono::NaiveDateTime>,
36 #[derive(Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize)]
38 #[table_name = "comment_alias_1"]
39 pub struct CommentAlias1 {
41 pub creator_id: PersonId,
43 pub parent_id: Option<CommentId>,
46 pub read: bool, // Whether the recipient has read the comment or not
47 pub published: chrono::NaiveDateTime,
48 pub updated: Option<chrono::NaiveDateTime>,
54 #[derive(Insertable, AsChangeset, Clone)]
55 #[table_name = "comment"]
56 pub struct CommentForm {
57 pub creator_id: PersonId,
59 pub parent_id: Option<CommentId>,
61 pub removed: Option<bool>,
62 pub read: Option<bool>,
63 pub published: Option<chrono::NaiveDateTime>,
64 pub updated: Option<chrono::NaiveDateTime>,
65 pub deleted: Option<bool>,
66 pub ap_id: Option<DbUrl>,
70 #[derive(Identifiable, Queryable, Associations, PartialEq, Debug, Clone)]
71 #[belongs_to(Comment)]
72 #[table_name = "comment_like"]
73 pub struct CommentLike {
75 pub person_id: PersonId,
76 pub comment_id: CommentId,
77 pub post_id: PostId, // TODO this is redundant
79 pub published: chrono::NaiveDateTime,
82 #[derive(Insertable, AsChangeset, Clone)]
83 #[table_name = "comment_like"]
84 pub struct CommentLikeForm {
85 pub person_id: PersonId,
86 pub comment_id: CommentId,
87 pub post_id: PostId, // TODO this is redundant
91 #[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
92 #[belongs_to(Comment)]
93 #[table_name = "comment_saved"]
94 pub struct CommentSaved {
96 pub comment_id: CommentId,
97 pub person_id: PersonId,
98 pub published: chrono::NaiveDateTime,
101 #[derive(Insertable, AsChangeset)]
102 #[table_name = "comment_saved"]
103 pub struct CommentSavedForm {
104 pub comment_id: CommentId,
105 pub person_id: PersonId,