]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/comment_report.rs
Strictly typing DB id fields. Fixes #1498
[lemmy.git] / crates / db_schema / src / source / comment_report.rs
1 use crate::{schema::comment_report, source::comment::Comment, CommentId, PersonId};
2 use serde::{Deserialize, Serialize};
3
4 #[derive(
5   Identifiable, Queryable, Associations, PartialEq, Serialize, Deserialize, Debug, Clone,
6 )]
7 #[belongs_to(Comment)]
8 #[table_name = "comment_report"]
9 pub struct CommentReport {
10   pub id: i32,
11   pub creator_id: PersonId,
12   pub comment_id: CommentId,
13   pub original_comment_text: String,
14   pub reason: String,
15   pub resolved: bool,
16   pub resolver_id: Option<PersonId>,
17   pub published: chrono::NaiveDateTime,
18   pub updated: Option<chrono::NaiveDateTime>,
19 }
20
21 #[derive(Insertable, AsChangeset, Clone)]
22 #[table_name = "comment_report"]
23 pub struct CommentReportForm {
24   pub creator_id: PersonId,
25   pub comment_id: CommentId,
26   pub original_comment_text: String,
27   pub reason: String,
28 }