mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-23 21:01:23 +00:00
Nutomic
004efd5d94
* Implement reports for private messages * finish private message report view + test * implement api for pm reports * merge list report api calls into one, move report count to site * fix compile error * Revert "merge list report api calls into one, move report count to site" This reverts commit 3bf3b06a705c6bcf2bf20d07e2819b81298790f3. * add websocket messages for pm report created/resolved * remove private_message_report_view * add joinable private_message_report -> person_alias_1 * Address review comments
83 lines
2.4 KiB
Rust
83 lines
2.4 KiB
Rust
use crate::sensitive::Sensitive;
|
|
use lemmy_db_schema::newtypes::{PersonId, PrivateMessageId, PrivateMessageReportId};
|
|
use lemmy_db_views::structs::{PrivateMessageReportView, PrivateMessageView};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
|
pub struct CreatePrivateMessage {
|
|
pub content: String,
|
|
pub recipient_id: PersonId,
|
|
pub auth: Sensitive<String>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
|
pub struct EditPrivateMessage {
|
|
pub private_message_id: PrivateMessageId,
|
|
pub content: String,
|
|
pub auth: Sensitive<String>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
|
pub struct DeletePrivateMessage {
|
|
pub private_message_id: PrivateMessageId,
|
|
pub deleted: bool,
|
|
pub auth: Sensitive<String>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
|
pub struct MarkPrivateMessageAsRead {
|
|
pub private_message_id: PrivateMessageId,
|
|
pub read: bool,
|
|
pub auth: Sensitive<String>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
|
pub struct GetPrivateMessages {
|
|
pub unread_only: Option<bool>,
|
|
pub page: Option<i64>,
|
|
pub limit: Option<i64>,
|
|
pub auth: Sensitive<String>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
pub struct PrivateMessagesResponse {
|
|
pub private_messages: Vec<PrivateMessageView>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
pub struct PrivateMessageResponse {
|
|
pub private_message_view: PrivateMessageView,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
|
pub struct CreatePrivateMessageReport {
|
|
pub private_message_id: PrivateMessageId,
|
|
pub reason: String,
|
|
pub auth: Sensitive<String>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
pub struct PrivateMessageReportResponse {
|
|
pub private_message_report_view: PrivateMessageReportView,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
|
pub struct ResolvePrivateMessageReport {
|
|
pub report_id: PrivateMessageReportId,
|
|
pub resolved: bool,
|
|
pub auth: Sensitive<String>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
|
pub struct ListPrivateMessageReports {
|
|
pub page: Option<i64>,
|
|
pub limit: Option<i64>,
|
|
/// Only shows the unresolved reports
|
|
pub unresolved_only: Option<bool>,
|
|
pub auth: Sensitive<String>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
pub struct ListPrivateMessageReportsResponse {
|
|
pub private_message_reports: Vec<PrivateMessageReportView>,
|
|
}
|