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))]
15 pub struct PostReport {
17 pub creator_id: PersonId,
19 pub original_post_name: String,
20 pub original_post_url: Option<DbUrl>,
21 pub original_post_body: Option<String>,
24 pub resolver_id: Option<PersonId>,
25 pub published: chrono::NaiveDateTime,
26 pub updated: Option<chrono::NaiveDateTime>,
30 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
31 #[cfg_attr(feature = "full", diesel(table_name = post_report))]
32 pub struct PostReportForm {
33 pub creator_id: PersonId,
35 pub original_post_name: String,
36 pub original_post_url: Option<DbUrl>,
37 pub original_post_body: Option<String>,