1 use crate::newtypes::{DbUrl, PersonId, PrivateMessageId};
2 use serde::{Deserialize, Serialize};
4 #[cfg(feature = "full")]
5 use crate::schema::private_message;
7 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
8 #[cfg_attr(feature = "full", derive(Queryable, Associations, Identifiable))]
11 diesel(belongs_to(crate::source::person::Person, foreign_key = creator_id)
12 ))] // Is this the right assoc?
13 #[cfg_attr(feature = "full", diesel(table_name = private_message))]
14 pub struct PrivateMessage {
15 pub id: PrivateMessageId,
16 pub creator_id: PersonId,
17 pub recipient_id: PersonId,
21 pub published: chrono::NaiveDateTime,
22 pub updated: Option<chrono::NaiveDateTime>,
28 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
29 #[cfg_attr(feature = "full", diesel(table_name = private_message))]
30 pub struct PrivateMessageForm {
31 pub creator_id: PersonId,
32 pub recipient_id: PersonId,
34 pub deleted: Option<bool>,
35 pub read: Option<bool>,
36 pub published: Option<chrono::NaiveDateTime>,
37 pub updated: Option<chrono::NaiveDateTime>,
38 pub ap_id: Option<DbUrl>,
39 pub local: Option<bool>,