2022-05-03 17:44:13 +00:00
|
|
|
use crate::newtypes::{DbUrl, PersonId, PrivateMessageId};
|
2021-10-19 16:37:01 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
2020-12-21 13:38:34 +00:00
|
|
|
|
2022-05-03 17:44:13 +00:00
|
|
|
#[cfg(feature = "full")]
|
|
|
|
use crate::schema::private_message;
|
|
|
|
|
|
|
|
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
|
|
|
|
#[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
|
|
|
|
#[cfg_attr(feature = "full", table_name = "private_message")]
|
2020-12-21 13:38:34 +00:00
|
|
|
pub struct PrivateMessage {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub id: PrivateMessageId,
|
|
|
|
pub creator_id: PersonId,
|
|
|
|
pub recipient_id: PersonId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub content: String,
|
|
|
|
pub deleted: bool,
|
|
|
|
pub read: bool,
|
|
|
|
pub published: chrono::NaiveDateTime,
|
|
|
|
pub updated: Option<chrono::NaiveDateTime>,
|
2021-03-02 12:41:48 +00:00
|
|
|
pub ap_id: DbUrl,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub local: bool,
|
|
|
|
}
|
|
|
|
|
2022-05-03 17:44:13 +00:00
|
|
|
#[derive(Default)]
|
|
|
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
|
|
|
#[cfg_attr(feature = "full", table_name = "private_message")]
|
2020-12-21 13:38:34 +00:00
|
|
|
pub struct PrivateMessageForm {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub creator_id: PersonId,
|
|
|
|
pub recipient_id: PersonId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub content: String,
|
|
|
|
pub deleted: Option<bool>,
|
|
|
|
pub read: Option<bool>,
|
|
|
|
pub published: Option<chrono::NaiveDateTime>,
|
|
|
|
pub updated: Option<chrono::NaiveDateTime>,
|
2021-03-02 12:41:48 +00:00
|
|
|
pub ap_id: Option<DbUrl>,
|
2021-03-20 20:59:07 +00:00
|
|
|
pub local: Option<bool>,
|
2020-12-21 13:38:34 +00:00
|
|
|
}
|