2022-09-19 22:58:42 +00:00
|
|
|
use crate::newtypes::{PersonId, PrivateMessageId, PrivateMessageReportId};
|
|
|
|
#[cfg(feature = "full")]
|
|
|
|
use crate::schema::private_message_report;
|
2023-08-24 15:27:00 +00:00
|
|
|
use chrono::{DateTime, Utc};
|
2022-11-02 19:18:22 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
2023-04-26 04:26:10 +00:00
|
|
|
use serde_with::skip_serializing_none;
|
|
|
|
#[cfg(feature = "full")]
|
|
|
|
use ts_rs::TS;
|
2022-09-19 22:58:42 +00:00
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-09-26 14:09:32 +00:00
|
|
|
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
|
2023-11-21 13:42:28 +00:00
|
|
|
#[cfg_attr(
|
|
|
|
feature = "full",
|
|
|
|
derive(Queryable, Selectable, Associations, Identifiable, TS)
|
|
|
|
)]
|
2022-09-19 22:58:42 +00:00
|
|
|
#[cfg_attr(
|
|
|
|
feature = "full",
|
2022-09-26 14:09:32 +00:00
|
|
|
diesel(belongs_to(crate::source::private_message::PrivateMessage))
|
2022-09-19 22:58:42 +00:00
|
|
|
)]
|
2022-09-26 14:09:32 +00:00
|
|
|
#[cfg_attr(feature = "full", diesel(table_name = private_message_report))]
|
2023-11-21 13:42:28 +00:00
|
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The private message report.
|
2022-09-19 22:58:42 +00:00
|
|
|
pub struct PrivateMessageReport {
|
|
|
|
pub id: PrivateMessageReportId,
|
|
|
|
pub creator_id: PersonId,
|
|
|
|
pub private_message_id: PrivateMessageId,
|
2023-05-10 19:20:39 +00:00
|
|
|
/// The original text.
|
2022-09-19 22:58:42 +00:00
|
|
|
pub original_pm_text: String,
|
|
|
|
pub reason: String,
|
|
|
|
pub resolved: bool,
|
|
|
|
pub resolver_id: Option<PersonId>,
|
2023-08-24 15:27:00 +00:00
|
|
|
pub published: DateTime<Utc>,
|
|
|
|
pub updated: Option<DateTime<Utc>>,
|
2022-09-19 22:58:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
2022-09-26 14:09:32 +00:00
|
|
|
#[cfg_attr(feature = "full", diesel(table_name = private_message_report))]
|
2022-09-19 22:58:42 +00:00
|
|
|
pub struct PrivateMessageReportForm {
|
|
|
|
pub creator_id: PersonId,
|
|
|
|
pub private_message_id: PrivateMessageId,
|
|
|
|
pub original_pm_text: String,
|
|
|
|
pub reason: String,
|
|
|
|
}
|