]> Untitled Git - lemmy.git/blob - crates/db_schema/src/source/post_report.rs
Move most code into crates/ subfolder
[lemmy.git] / crates / db_schema / src / source / post_report.rs
1 use crate::{schema::post_report, source::post::Post};
2 use serde::{Deserialize, Serialize};
3
4 #[derive(
5   Identifiable, Queryable, Associations, PartialEq, Serialize, Deserialize, Debug, Clone,
6 )]
7 #[belongs_to(Post)]
8 #[table_name = "post_report"]
9 pub struct PostReport {
10   pub id: i32,
11   pub creator_id: i32,
12   pub post_id: i32,
13   pub original_post_name: String,
14   pub original_post_url: Option<String>,
15   pub original_post_body: Option<String>,
16   pub reason: String,
17   pub resolved: bool,
18   pub resolver_id: Option<i32>,
19   pub published: chrono::NaiveDateTime,
20   pub updated: Option<chrono::NaiveDateTime>,
21 }
22
23 #[derive(Insertable, AsChangeset, Clone)]
24 #[table_name = "post_report"]
25 pub struct PostReportForm {
26   pub creator_id: i32,
27   pub post_id: i32,
28   pub original_post_name: String,
29   pub original_post_url: Option<String>,
30   pub original_post_body: Option<String>,
31   pub reason: String,
32 }