1 use lemmy_db_schema::{CommentId, CommentReportId, CommunityId, LocalUserId, PostId};
2 use lemmy_db_views::{comment_report_view::CommentReportView, comment_view::CommentView};
3 use serde::{Deserialize, Serialize};
6 pub struct CreateComment {
9 pub parent_id: Option<CommentId>,
10 pub form_id: Option<String>,
14 #[derive(Deserialize)]
15 pub struct EditComment {
17 pub comment_id: CommentId,
18 pub form_id: Option<String>,
22 #[derive(Deserialize)]
23 pub struct DeleteComment {
24 pub comment_id: CommentId,
29 #[derive(Deserialize)]
30 pub struct RemoveComment {
31 pub comment_id: CommentId,
33 pub reason: Option<String>,
37 #[derive(Deserialize)]
38 pub struct MarkCommentAsRead {
39 pub comment_id: CommentId,
44 #[derive(Deserialize)]
45 pub struct SaveComment {
46 pub comment_id: CommentId,
51 #[derive(Serialize, Clone)]
52 pub struct CommentResponse {
53 pub comment_view: CommentView,
54 pub recipient_ids: Vec<LocalUserId>,
55 pub form_id: Option<String>, // An optional front end ID, to tell which is coming back
58 #[derive(Deserialize)]
59 pub struct CreateCommentLike {
60 pub comment_id: CommentId,
65 #[derive(Deserialize)]
66 pub struct GetComments {
67 pub type_: Option<String>,
68 pub sort: Option<String>,
69 pub page: Option<i64>,
70 pub limit: Option<i64>,
71 pub community_id: Option<CommunityId>,
72 pub community_name: Option<String>,
73 pub saved_only: Option<bool>,
74 pub auth: Option<String>,
78 pub struct GetCommentsResponse {
79 pub comments: Vec<CommentView>,
82 #[derive(Deserialize)]
83 pub struct CreateCommentReport {
84 pub comment_id: CommentId,
89 #[derive(Serialize, Clone)]
90 pub struct CommentReportResponse {
91 pub comment_report_view: CommentReportView,
94 #[derive(Deserialize)]
95 pub struct ResolveCommentReport {
96 pub report_id: CommentReportId,
101 #[derive(Deserialize)]
102 pub struct ListCommentReports {
103 pub page: Option<i64>,
104 pub limit: Option<i64>,
105 /// Only shows the unresolved reports
106 pub unresolved_only: Option<bool>,
107 /// if no community is given, it returns reports for all communities moderated by the auth user
108 pub community_id: Option<CommunityId>,
113 pub struct ListCommentReportsResponse {
114 pub comment_reports: Vec<CommentReportView>,