]> Untitled Git - lemmy.git/blobdiff - crates/api_common/src/comment.rs
Clean up reporting (#1776)
[lemmy.git] / crates / api_common / src / comment.rs
index ce5182cf3d04c819ab6ead9571fd81194f0acd17..555640580ebd95aa9d4cadbd1667359467ed2580 100644 (file)
@@ -1,4 +1,4 @@
-use lemmy_db_schema::{CommentId, CommunityId, LocalUserId, PostId};
+use lemmy_db_schema::{CommentId, CommentReportId, CommunityId, LocalUserId, PostId};
 use lemmy_db_views::{comment_report_view::CommentReportView, comment_view::CommentView};
 use serde::{Deserialize, Serialize};
 
@@ -79,42 +79,37 @@ pub struct GetCommentsResponse {
   pub comments: Vec<CommentView>,
 }
 
-#[derive(Serialize, Deserialize)]
+#[derive(Deserialize)]
 pub struct CreateCommentReport {
   pub comment_id: CommentId,
   pub reason: String,
   pub auth: String,
 }
 
-#[derive(Serialize, Deserialize, Clone)]
-pub struct CreateCommentReportResponse {
-  pub success: bool,
+#[derive(Serialize, Clone)]
+pub struct CommentReportResponse {
+  pub comment_report_view: CommentReportView,
 }
 
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Deserialize)]
 pub struct ResolveCommentReport {
-  pub report_id: i32,
+  pub report_id: CommentReportId,
   pub resolved: bool,
   pub auth: String,
 }
 
-#[derive(Serialize, Deserialize, Clone, Debug)]
-pub struct ResolveCommentReportResponse {
-  // TODO this should probably return the view
-  pub report_id: i32,
-  pub resolved: bool,
-}
-
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Deserialize)]
 pub struct ListCommentReports {
   pub page: Option<i64>,
   pub limit: Option<i64>,
+  /// Only shows the unresolved reports
+  pub unresolved_only: Option<bool>,
   /// if no community is given, it returns reports for all communities moderated by the auth user
-  pub community: Option<CommunityId>,
+  pub community_id: Option<CommunityId>,
   pub auth: String,
 }
 
-#[derive(Serialize, Clone, Debug)]
+#[derive(Serialize)]
 pub struct ListCommentReportsResponse {
-  pub comments: Vec<CommentReportView>,
+  pub comment_reports: Vec<CommentReportView>,
 }