]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/comment_report.rs
Split activity table into sent and received parts (fixes #3103) (#3583)
[lemmy.git] / crates / db_schema / src / source / comment_report.rs
1 use crate::newtypes::{CommentId, CommentReportId, PersonId};
2 #[cfg(feature = "full")]
3 use crate::schema::comment_report;
4 use serde::{Deserialize, Serialize};
5 use serde_with::skip_serializing_none;
6 #[cfg(feature = "full")]
7 use ts_rs::TS;
8
9 #[skip_serializing_none]
10 #[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
11 #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable, TS))]
12 #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
13 #[cfg_attr(feature = "full", diesel(table_name = comment_report))]
14 #[cfg_attr(feature = "full", ts(export))]
15 /// A comment report.
16 pub struct CommentReport {
17   pub id: CommentReportId,
18   pub creator_id: PersonId,
19   pub comment_id: CommentId,
20   pub original_comment_text: String,
21   pub reason: String,
22   pub resolved: bool,
23   pub resolver_id: Option<PersonId>,
24   pub published: chrono::NaiveDateTime,
25   pub updated: Option<chrono::NaiveDateTime>,
26 }
27
28 #[derive(Clone)]
29 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
30 #[cfg_attr(feature = "full", diesel(table_name = comment_report))]
31 pub struct CommentReportForm {
32   pub creator_id: PersonId,
33   pub comment_id: CommentId,
34   pub original_comment_text: String,
35   pub reason: String,
36 }