]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/comment_report.rs
Diesel 2.0.0 upgrade (#2452)
[lemmy.git] / crates / db_schema / src / source / comment_report.rs
1 use crate::newtypes::{CommentId, CommentReportId, PersonId};
2 use serde::{Deserialize, Serialize};
3
4 #[cfg(feature = "full")]
5 use crate::schema::comment_report;
6
7 #[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
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_report))]
11 pub struct CommentReport {
12   pub id: CommentReportId,
13   pub creator_id: PersonId,
14   pub comment_id: CommentId,
15   pub original_comment_text: String,
16   pub reason: String,
17   pub resolved: bool,
18   pub resolver_id: Option<PersonId>,
19   pub published: chrono::NaiveDateTime,
20   pub updated: Option<chrono::NaiveDateTime>,
21 }
22
23 #[derive(Clone)]
24 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
25 #[cfg_attr(feature = "full", diesel(table_name = comment_report))]
26 pub struct CommentReportForm {
27   pub creator_id: PersonId,
28   pub comment_id: CommentId,
29   pub original_comment_text: String,
30   pub reason: String,
31 }