2022-05-03 19:44:13 +02:00
|
|
|
use crate::sensitive::Sensitive;
|
2022-05-06 20:55:07 +00:00
|
|
|
use lemmy_db_schema::{
|
2022-08-23 23:40:56 +02:00
|
|
|
newtypes::{CommentId, CommentReportId, CommunityId, LanguageId, LocalUserId, PostId},
|
2022-07-29 23:55:59 -04:00
|
|
|
CommentSortType,
|
2022-05-06 20:55:07 +00:00
|
|
|
ListingType,
|
|
|
|
};
|
2022-05-03 19:44:13 +02:00
|
|
|
use lemmy_db_views::structs::{CommentReportView, CommentView};
|
2020-09-01 16:25:34 +02:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2020-09-01 16:25:34 +02:00
|
|
|
pub struct CreateComment {
|
|
|
|
pub content: String,
|
2021-03-18 16:25:21 -04:00
|
|
|
pub post_id: PostId,
|
2021-04-14 23:37:51 -04:00
|
|
|
pub parent_id: Option<CommentId>,
|
2022-08-23 23:40:56 +02:00
|
|
|
pub language_id: Option<LanguageId>,
|
2020-09-01 16:25:34 +02:00
|
|
|
pub form_id: Option<String>,
|
2021-12-06 08:54:47 -06:00
|
|
|
pub auth: Sensitive<String>,
|
2020-09-01 16:25:34 +02:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2021-11-23 10:53:48 -05:00
|
|
|
pub struct GetComment {
|
|
|
|
pub id: CommentId,
|
2021-12-06 08:54:47 -06:00
|
|
|
pub auth: Option<Sensitive<String>>,
|
2021-11-23 10:53:48 -05:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2020-09-01 16:25:34 +02:00
|
|
|
pub struct EditComment {
|
2021-03-18 16:25:21 -04:00
|
|
|
pub comment_id: CommentId,
|
2022-08-17 07:38:52 -04:00
|
|
|
pub content: Option<String>,
|
|
|
|
pub distinguished: Option<bool>,
|
2022-08-23 23:40:56 +02:00
|
|
|
pub language_id: Option<LanguageId>,
|
2020-09-01 16:25:34 +02:00
|
|
|
pub form_id: Option<String>,
|
2021-12-06 08:54:47 -06:00
|
|
|
pub auth: Sensitive<String>,
|
2020-09-01 16:25:34 +02:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2020-09-01 16:25:34 +02:00
|
|
|
pub struct DeleteComment {
|
2021-03-18 16:25:21 -04:00
|
|
|
pub comment_id: CommentId,
|
2020-09-01 16:25:34 +02:00
|
|
|
pub deleted: bool,
|
2021-12-06 08:54:47 -06:00
|
|
|
pub auth: Sensitive<String>,
|
2020-09-01 16:25:34 +02:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2020-09-01 16:25:34 +02:00
|
|
|
pub struct RemoveComment {
|
2021-03-18 16:25:21 -04:00
|
|
|
pub comment_id: CommentId,
|
2020-09-01 16:25:34 +02:00
|
|
|
pub removed: bool,
|
|
|
|
pub reason: Option<String>,
|
2021-12-06 08:54:47 -06:00
|
|
|
pub auth: Sensitive<String>,
|
2020-09-01 16:25:34 +02:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2020-09-01 16:25:34 +02:00
|
|
|
pub struct SaveComment {
|
2021-03-18 16:25:21 -04:00
|
|
|
pub comment_id: CommentId,
|
2020-09-01 16:25:34 +02:00
|
|
|
pub save: bool,
|
2021-12-06 08:54:47 -06:00
|
|
|
pub auth: Sensitive<String>,
|
2020-09-01 16:25:34 +02:00
|
|
|
}
|
|
|
|
|
2021-12-06 08:54:47 -06:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2020-09-01 16:25:34 +02:00
|
|
|
pub struct CommentResponse {
|
2020-12-15 14:39:18 -05:00
|
|
|
pub comment_view: CommentView,
|
2021-03-18 16:25:21 -04:00
|
|
|
pub recipient_ids: Vec<LocalUserId>,
|
2020-12-19 20:10:47 -05:00
|
|
|
pub form_id: Option<String>, // An optional front end ID, to tell which is coming back
|
2020-09-01 16:25:34 +02:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2020-09-01 16:25:34 +02:00
|
|
|
pub struct CreateCommentLike {
|
2021-03-18 16:25:21 -04:00
|
|
|
pub comment_id: CommentId,
|
2020-09-01 16:25:34 +02:00
|
|
|
pub score: i16,
|
2021-12-06 08:54:47 -06:00
|
|
|
pub auth: Sensitive<String>,
|
2020-09-01 16:25:34 +02:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2020-09-01 16:25:34 +02:00
|
|
|
pub struct GetComments {
|
2022-05-06 20:55:07 +00:00
|
|
|
pub type_: Option<ListingType>,
|
2022-07-29 23:55:59 -04:00
|
|
|
pub sort: Option<CommentSortType>,
|
|
|
|
pub max_depth: Option<i32>,
|
2020-09-01 16:25:34 +02:00
|
|
|
pub page: Option<i64>,
|
|
|
|
pub limit: Option<i64>,
|
2021-03-18 16:25:21 -04:00
|
|
|
pub community_id: Option<CommunityId>,
|
2020-09-15 15:26:47 -04:00
|
|
|
pub community_name: Option<String>,
|
2022-07-29 23:55:59 -04:00
|
|
|
pub post_id: Option<PostId>,
|
|
|
|
pub parent_id: Option<CommentId>,
|
2021-04-14 23:37:51 -04:00
|
|
|
pub saved_only: Option<bool>,
|
2021-12-06 08:54:47 -06:00
|
|
|
pub auth: Option<Sensitive<String>>,
|
2020-09-01 16:25:34 +02:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2020-09-01 16:25:34 +02:00
|
|
|
pub struct GetCommentsResponse {
|
|
|
|
pub comments: Vec<CommentView>,
|
|
|
|
}
|
2020-10-24 22:59:13 -04:00
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2020-10-24 22:59:13 -04:00
|
|
|
pub struct CreateCommentReport {
|
2021-03-18 16:25:21 -04:00
|
|
|
pub comment_id: CommentId,
|
2020-10-24 22:59:13 -04:00
|
|
|
pub reason: String,
|
2021-12-06 08:54:47 -06:00
|
|
|
pub auth: Sensitive<String>,
|
2020-10-24 22:59:13 -04:00
|
|
|
}
|
|
|
|
|
2021-12-06 08:54:47 -06:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2021-09-28 06:36:17 -04:00
|
|
|
pub struct CommentReportResponse {
|
|
|
|
pub comment_report_view: CommentReportView,
|
2020-10-24 22:59:13 -04:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2020-10-24 22:59:13 -04:00
|
|
|
pub struct ResolveCommentReport {
|
2021-09-28 06:36:17 -04:00
|
|
|
pub report_id: CommentReportId,
|
2020-10-24 22:59:13 -04:00
|
|
|
pub resolved: bool,
|
2021-12-06 08:54:47 -06:00
|
|
|
pub auth: Sensitive<String>,
|
2020-10-24 22:59:13 -04:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
2020-10-24 22:59:13 -04:00
|
|
|
pub struct ListCommentReports {
|
|
|
|
pub page: Option<i64>,
|
|
|
|
pub limit: Option<i64>,
|
2021-09-28 06:36:17 -04:00
|
|
|
/// Only shows the unresolved reports
|
|
|
|
pub unresolved_only: Option<bool>,
|
2020-11-26 13:28:58 +01:00
|
|
|
/// if no community is given, it returns reports for all communities moderated by the auth user
|
2021-09-28 06:36:17 -04:00
|
|
|
pub community_id: Option<CommunityId>,
|
2021-12-06 08:54:47 -06:00
|
|
|
pub auth: Sensitive<String>,
|
2020-10-24 22:59:13 -04:00
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2020-10-24 22:59:13 -04:00
|
|
|
pub struct ListCommentReportsResponse {
|
2021-09-28 06:36:17 -04:00
|
|
|
pub comment_reports: Vec<CommentReportView>,
|
2020-10-24 22:59:13 -04:00
|
|
|
}
|