2 schema::{comment, comment_alias_1, comment_like, comment_saved},
8 // WITH RECURSIVE MyTree AS (
9 // SELECT * FROM comment WHERE parent_id IS NULL
11 // SELECT m.* FROM comment AS m JOIN MyTree AS t ON m.parent_id = t.id
13 // SELECT * FROM MyTree;
15 #[derive(Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize)]
17 #[table_name = "comment"]
22 pub parent_id: Option<i32>,
25 pub read: bool, // Whether the recipient has read the comment or not
26 pub published: chrono::NaiveDateTime,
27 pub updated: Option<chrono::NaiveDateTime>,
33 #[derive(Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize)]
35 #[table_name = "comment_alias_1"]
36 pub struct CommentAlias1 {
40 pub parent_id: Option<i32>,
43 pub read: bool, // Whether the recipient has read the comment or not
44 pub published: chrono::NaiveDateTime,
45 pub updated: Option<chrono::NaiveDateTime>,
51 #[derive(Insertable, AsChangeset, Clone)]
52 #[table_name = "comment"]
53 pub struct CommentForm {
56 pub parent_id: Option<i32>,
58 pub removed: Option<bool>,
59 pub read: Option<bool>,
60 pub published: Option<chrono::NaiveDateTime>,
61 pub updated: Option<chrono::NaiveDateTime>,
62 pub deleted: Option<bool>,
63 pub ap_id: Option<Url>,
67 #[derive(Identifiable, Queryable, Associations, PartialEq, Debug, Clone)]
68 #[belongs_to(Comment)]
69 #[table_name = "comment_like"]
70 pub struct CommentLike {
74 pub post_id: i32, // TODO this is redundant
76 pub published: chrono::NaiveDateTime,
79 #[derive(Insertable, AsChangeset, Clone)]
80 #[table_name = "comment_like"]
81 pub struct CommentLikeForm {
84 pub post_id: i32, // TODO this is redundant
88 #[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
89 #[belongs_to(Comment)]
90 #[table_name = "comment_saved"]
91 pub struct CommentSaved {
95 pub published: chrono::NaiveDateTime,
98 #[derive(Insertable, AsChangeset)]
99 #[table_name = "comment_saved"]
100 pub struct CommentSavedForm {