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 lemmy_utils::Sensitive;
4 use serde::{Deserialize, Serialize};
6 #[derive(Debug, Serialize, Deserialize)]
7 pub struct CreateComment {
10 pub parent_id: Option<CommentId>,
11 pub form_id: Option<String>,
12 pub auth: Sensitive<String>,
15 #[derive(Debug, Serialize, Deserialize)]
16 pub struct GetComment {
18 pub auth: Option<Sensitive<String>>,
21 #[derive(Debug, Serialize, Deserialize)]
22 pub struct EditComment {
24 pub comment_id: CommentId,
25 pub form_id: Option<String>,
26 pub auth: Sensitive<String>,
29 #[derive(Debug, Serialize, Deserialize)]
30 pub struct DeleteComment {
31 pub comment_id: CommentId,
33 pub auth: Sensitive<String>,
36 #[derive(Debug, Serialize, Deserialize)]
37 pub struct RemoveComment {
38 pub comment_id: CommentId,
40 pub reason: Option<String>,
41 pub auth: Sensitive<String>,
44 #[derive(Debug, Serialize, Deserialize)]
45 pub struct MarkCommentAsRead {
46 pub comment_id: CommentId,
48 pub auth: Sensitive<String>,
51 #[derive(Debug, Serialize, Deserialize)]
52 pub struct SaveComment {
53 pub comment_id: CommentId,
55 pub auth: Sensitive<String>,
58 #[derive(Debug, Serialize, Deserialize, Clone)]
59 pub struct CommentResponse {
60 pub comment_view: CommentView,
61 pub recipient_ids: Vec<LocalUserId>,
62 pub form_id: Option<String>, // An optional front end ID, to tell which is coming back
65 #[derive(Debug, Serialize, Deserialize)]
66 pub struct CreateCommentLike {
67 pub comment_id: CommentId,
69 pub auth: Sensitive<String>,
72 #[derive(Debug, Serialize, Deserialize)]
73 pub struct GetComments {
74 pub type_: Option<String>,
75 pub sort: Option<String>,
76 pub page: Option<i64>,
77 pub limit: Option<i64>,
78 pub community_id: Option<CommunityId>,
79 pub community_name: Option<String>,
80 pub saved_only: Option<bool>,
81 pub auth: Option<Sensitive<String>>,
84 #[derive(Debug, Serialize, Deserialize)]
85 pub struct GetCommentsResponse {
86 pub comments: Vec<CommentView>,
89 #[derive(Debug, Serialize, Deserialize)]
90 pub struct CreateCommentReport {
91 pub comment_id: CommentId,
93 pub auth: Sensitive<String>,
96 #[derive(Debug, Serialize, Deserialize, Clone)]
97 pub struct CommentReportResponse {
98 pub comment_report_view: CommentReportView,
101 #[derive(Debug, Serialize, Deserialize)]
102 pub struct ResolveCommentReport {
103 pub report_id: CommentReportId,
105 pub auth: Sensitive<String>,
108 #[derive(Debug, Serialize, Deserialize)]
109 pub struct ListCommentReports {
110 pub page: Option<i64>,
111 pub limit: Option<i64>,
112 /// Only shows the unresolved reports
113 pub unresolved_only: Option<bool>,
114 /// if no community is given, it returns reports for all communities moderated by the auth user
115 pub community_id: Option<CommunityId>,
116 pub auth: Sensitive<String>,
119 #[derive(Debug, Serialize, Deserialize)]
120 pub struct ListCommentReportsResponse {
121 pub comment_reports: Vec<CommentReportView>,