2024-11-26 21:53:01 +00:00
|
|
|
use lemmy_db_schema::newtypes::{PersonId, PrivateMessageId};
|
2024-12-11 20:06:08 +00:00
|
|
|
use lemmy_db_views_actor::structs::PrivateMessageView;
|
2022-09-19 22:58:42 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg(feature = "full")]
|
|
|
|
use ts_rs::TS;
|
2022-09-19 22:58:42 +00:00
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Create a private message.
|
2022-09-19 22:58:42 +00:00
|
|
|
pub struct CreatePrivateMessage {
|
|
|
|
pub content: String,
|
|
|
|
pub recipient_id: PersonId,
|
|
|
|
}
|
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Edit a private message.
|
2022-09-19 22:58:42 +00:00
|
|
|
pub struct EditPrivateMessage {
|
|
|
|
pub private_message_id: PrivateMessageId,
|
|
|
|
pub content: String,
|
|
|
|
}
|
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Delete a private message.
|
2022-09-19 22:58:42 +00:00
|
|
|
pub struct DeletePrivateMessage {
|
|
|
|
pub private_message_id: PrivateMessageId,
|
|
|
|
pub deleted: bool,
|
|
|
|
}
|
|
|
|
|
2024-02-11 05:32:14 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Mark a private message as read.
|
2022-09-19 22:58:42 +00:00
|
|
|
pub struct MarkPrivateMessageAsRead {
|
|
|
|
pub private_message_id: PrivateMessageId,
|
|
|
|
pub read: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// A single private message response.
|
2022-09-19 22:58:42 +00:00
|
|
|
pub struct PrivateMessageResponse {
|
|
|
|
pub private_message_view: PrivateMessageView,
|
|
|
|
}
|