]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/post_report.rs
Group imports dess (#2526)
[lemmy.git] / crates / db_schema / src / source / post_report.rs
1 use crate::newtypes::{DbUrl, PersonId, PostId, PostReportId};
2 #[cfg(feature = "full")]
3 use crate::schema::post_report;
4 use serde::{Deserialize, Serialize};
5
6 #[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
7 #[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations))]
8 #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] // Is this the right assoc?
9 #[cfg_attr(feature = "full", diesel(table_name = post_report))]
10 pub struct PostReport {
11   pub id: PostReportId,
12   pub creator_id: PersonId,
13   pub post_id: PostId,
14   pub original_post_name: String,
15   pub original_post_url: Option<DbUrl>,
16   pub original_post_body: Option<String>,
17   pub reason: String,
18   pub resolved: bool,
19   pub resolver_id: Option<PersonId>,
20   pub published: chrono::NaiveDateTime,
21   pub updated: Option<chrono::NaiveDateTime>,
22 }
23
24 #[derive(Clone)]
25 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
26 #[cfg_attr(feature = "full", diesel(table_name = post_report))]
27 pub struct PostReportForm {
28   pub creator_id: PersonId,
29   pub post_id: PostId,
30   pub original_post_name: String,
31   pub original_post_url: Option<DbUrl>,
32   pub original_post_body: Option<String>,
33   pub reason: String,
34 }