1 use crate::sensitive::Sensitive;
3 newtypes::{CommentId, CommentReportId, CommunityId, LocalUserId, PostId},
7 use lemmy_db_views::structs::{CommentReportView, CommentView};
8 use serde::{Deserialize, Serialize};
10 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
11 pub struct CreateComment {
14 pub parent_id: Option<CommentId>,
15 pub form_id: Option<String>,
16 pub auth: Sensitive<String>,
19 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
20 pub struct GetComment {
22 pub auth: Option<Sensitive<String>>,
25 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
26 pub struct EditComment {
28 pub comment_id: CommentId,
29 pub form_id: Option<String>,
30 pub auth: Sensitive<String>,
33 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
34 pub struct DeleteComment {
35 pub comment_id: CommentId,
37 pub auth: Sensitive<String>,
40 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
41 pub struct RemoveComment {
42 pub comment_id: CommentId,
44 pub reason: Option<String>,
45 pub auth: Sensitive<String>,
48 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
49 pub struct MarkCommentAsRead {
50 pub comment_id: CommentId,
52 pub auth: Sensitive<String>,
55 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
56 pub struct SaveComment {
57 pub comment_id: CommentId,
59 pub auth: Sensitive<String>,
62 #[derive(Debug, Serialize, Deserialize, Clone)]
63 pub struct CommentResponse {
64 pub comment_view: CommentView,
65 pub recipient_ids: Vec<LocalUserId>,
66 pub form_id: Option<String>, // An optional front end ID, to tell which is coming back
69 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
70 pub struct CreateCommentLike {
71 pub comment_id: CommentId,
73 pub auth: Sensitive<String>,
76 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
77 pub struct GetComments {
78 pub type_: Option<ListingType>,
79 pub sort: Option<SortType>,
80 pub page: Option<i64>,
81 pub limit: Option<i64>,
82 pub community_id: Option<CommunityId>,
83 pub community_name: Option<String>,
84 pub saved_only: Option<bool>,
85 pub auth: Option<Sensitive<String>>,
88 #[derive(Debug, Serialize, Deserialize, Clone)]
89 pub struct GetCommentsResponse {
90 pub comments: Vec<CommentView>,
93 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
94 pub struct CreateCommentReport {
95 pub comment_id: CommentId,
97 pub auth: Sensitive<String>,
100 #[derive(Debug, Serialize, Deserialize, Clone)]
101 pub struct CommentReportResponse {
102 pub comment_report_view: CommentReportView,
105 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
106 pub struct ResolveCommentReport {
107 pub report_id: CommentReportId,
109 pub auth: Sensitive<String>,
112 #[derive(Debug, Serialize, Deserialize, Clone, Default)]
113 pub struct ListCommentReports {
114 pub page: Option<i64>,
115 pub limit: Option<i64>,
116 /// Only shows the unresolved reports
117 pub unresolved_only: Option<bool>,
118 /// if no community is given, it returns reports for all communities moderated by the auth user
119 pub community_id: Option<CommunityId>,
120 pub auth: Sensitive<String>,
123 #[derive(Debug, Serialize, Deserialize, Clone)]
124 pub struct ListCommentReportsResponse {
125 pub comment_reports: Vec<CommentReportView>,