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