1 use crate::newtypes::{DbUrl, PersonId, PostId, PostReportId};
2 #[cfg(feature = "full")]
3 use crate::schema::post_report;
4 use serde::{Deserialize, Serialize};
5 use serde_with::skip_serializing_none;
6 #[cfg(feature = "full")]
9 #[skip_serializing_none]
10 #[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
11 #[cfg_attr(feature = "full", derive(Identifiable, Queryable, Associations, TS))]
12 #[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] // Is this the right assoc?
13 #[cfg_attr(feature = "full", diesel(table_name = post_report))]
14 #[cfg_attr(feature = "full", ts(export))]
16 pub struct PostReport {
18 pub creator_id: PersonId,
20 /// The original post title.
21 pub original_post_name: String,
22 /// The original post url.
23 pub original_post_url: Option<DbUrl>,
24 /// The original post body.
25 pub original_post_body: Option<String>,
28 pub resolver_id: Option<PersonId>,
29 pub published: chrono::NaiveDateTime,
30 pub updated: Option<chrono::NaiveDateTime>,
33 #[derive(Clone, Default)]
34 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
35 #[cfg_attr(feature = "full", diesel(table_name = post_report))]
36 pub struct PostReportForm {
37 pub creator_id: PersonId,
39 pub original_post_name: String,
40 pub original_post_url: Option<DbUrl>,
41 pub original_post_body: Option<String>,