]> Untitled Git - lemmy.git/blobdiff - crates/api_common/src/post.rs
Clean up reporting (#1776)
[lemmy.git] / crates / api_common / src / post.rs
index 5a83a0c50ad7041a3fd86fc31896633ad15a55b1..3926ed8c7adf9e5ff56172893aab677140534206 100644 (file)
@@ -1,4 +1,4 @@
-use lemmy_db_schema::{CommunityId, PostId};
+use lemmy_db_schema::{CommunityId, PostId, PostReportId};
 use lemmy_db_views::{
   comment_view::CommentView,
   post_report_view::PostReportView,
@@ -112,42 +112,39 @@ pub struct SavePost {
   pub auth: String,
 }
 
-#[derive(Serialize, Deserialize)]
+#[derive(Deserialize)]
 pub struct CreatePostReport {
   pub post_id: PostId,
   pub reason: String,
   pub auth: String,
 }
 
-#[derive(Serialize, Deserialize, Clone)]
-pub struct CreatePostReportResponse {
-  pub success: bool,
+#[derive(Serialize, Clone)]
+pub struct PostReportResponse {
+  pub post_report_view: PostReportView,
 }
 
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Deserialize)]
 pub struct ResolvePostReport {
-  pub report_id: i32,
+  pub report_id: PostReportId,
   pub resolved: bool,
   pub auth: String,
 }
 
-#[derive(Serialize, Deserialize, Clone, Debug)]
-pub struct ResolvePostReportResponse {
-  pub report_id: i32,
-  pub resolved: bool,
-}
-
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Deserialize)]
 pub struct ListPostReports {
   pub page: Option<i64>,
   pub limit: Option<i64>,
-  pub community: Option<CommunityId>,
+  /// 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_id: Option<CommunityId>,
   pub auth: String,
 }
 
-#[derive(Serialize, Clone, Debug)]
+#[derive(Serialize)]
 pub struct ListPostReportsResponse {
-  pub posts: Vec<PostReportView>,
+  pub post_reports: Vec<PostReportView>,
 }
 
 #[derive(Deserialize, Debug)]