1 use lemmy_db_schema::newtypes::{CommentId, CommentReportId, CommunityId, LocalUserId, PostId};
2 use lemmy_db_views::{comment_report_view::CommentReportView, comment_view::CommentView};
3 use serde::{Deserialize, Serialize};
5 #[derive(Serialize, Deserialize)]
6 pub struct CreateComment {
9 pub parent_id: Option<CommentId>,
10 pub form_id: Option<String>,
14 #[derive(Serialize, Deserialize)]
15 pub struct GetComment {
17 pub auth: Option<String>,
20 #[derive(Serialize, Deserialize)]
21 pub struct EditComment {
23 pub comment_id: CommentId,
24 pub form_id: Option<String>,
28 #[derive(Serialize, Deserialize)]
29 pub struct DeleteComment {
30 pub comment_id: CommentId,
35 #[derive(Serialize, Deserialize)]
36 pub struct RemoveComment {
37 pub comment_id: CommentId,
39 pub reason: Option<String>,
43 #[derive(Serialize, Deserialize)]
44 pub struct MarkCommentAsRead {
45 pub comment_id: CommentId,
50 #[derive(Serialize, Deserialize)]
51 pub struct SaveComment {
52 pub comment_id: CommentId,
57 #[derive(Serialize, Deserialize, Clone)]
58 pub struct CommentResponse {
59 pub comment_view: CommentView,
60 pub recipient_ids: Vec<LocalUserId>,
61 pub form_id: Option<String>, // An optional front end ID, to tell which is coming back
64 #[derive(Serialize, Deserialize)]
65 pub struct CreateCommentLike {
66 pub comment_id: CommentId,
71 #[derive(Serialize, Deserialize)]
72 pub struct GetComments {
73 pub type_: Option<String>,
74 pub sort: Option<String>,
75 pub page: Option<i64>,
76 pub limit: Option<i64>,
77 pub community_id: Option<CommunityId>,
78 pub community_name: Option<String>,
79 pub saved_only: Option<bool>,
80 pub auth: Option<String>,
83 #[derive(Serialize, Deserialize)]
84 pub struct GetCommentsResponse {
85 pub comments: Vec<CommentView>,
88 #[derive(Serialize, Deserialize)]
89 pub struct CreateCommentReport {
90 pub comment_id: CommentId,
95 #[derive(Serialize, Deserialize, Clone)]
96 pub struct CommentReportResponse {
97 pub comment_report_view: CommentReportView,
100 #[derive(Serialize, Deserialize)]
101 pub struct ResolveCommentReport {
102 pub report_id: CommentReportId,
107 #[derive(Serialize, Deserialize)]
108 pub struct ListCommentReports {
109 pub page: Option<i64>,
110 pub limit: Option<i64>,
111 /// Only shows the unresolved reports
112 pub unresolved_only: Option<bool>,
113 /// if no community is given, it returns reports for all communities moderated by the auth user
114 pub community_id: Option<CommunityId>,
118 #[derive(Serialize, Deserialize)]
119 pub struct ListCommentReportsResponse {
120 pub comment_reports: Vec<CommentReportView>,