2020-09-01 14:25:34 +00:00
|
|
|
use lemmy_db::comment_view::CommentView;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct CreateComment {
|
|
|
|
pub content: String,
|
|
|
|
pub parent_id: Option<i32>,
|
|
|
|
pub post_id: i32,
|
|
|
|
pub form_id: Option<String>,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct EditComment {
|
|
|
|
pub content: String,
|
|
|
|
pub edit_id: i32,
|
|
|
|
pub form_id: Option<String>,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct DeleteComment {
|
|
|
|
pub edit_id: i32,
|
|
|
|
pub deleted: bool,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct RemoveComment {
|
|
|
|
pub edit_id: i32,
|
|
|
|
pub removed: bool,
|
|
|
|
pub reason: Option<String>,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct MarkCommentAsRead {
|
|
|
|
pub edit_id: i32,
|
|
|
|
pub read: bool,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct SaveComment {
|
|
|
|
pub comment_id: i32,
|
|
|
|
pub save: bool,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Serialize, Clone)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct CommentResponse {
|
|
|
|
pub comment: CommentView,
|
|
|
|
pub recipient_ids: Vec<i32>,
|
|
|
|
pub form_id: Option<String>,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct CreateCommentLike {
|
|
|
|
pub comment_id: i32,
|
|
|
|
pub score: i16,
|
|
|
|
pub auth: String,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Deserialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct GetComments {
|
|
|
|
pub type_: String,
|
|
|
|
pub sort: String,
|
|
|
|
pub page: Option<i64>,
|
|
|
|
pub limit: Option<i64>,
|
|
|
|
pub community_id: Option<i32>,
|
2020-09-15 19:26:47 +00:00
|
|
|
pub community_name: Option<String>,
|
2020-09-01 14:25:34 +00:00
|
|
|
pub auth: Option<String>,
|
|
|
|
}
|
|
|
|
|
2020-09-03 19:45:12 +00:00
|
|
|
#[derive(Serialize)]
|
2020-09-01 14:25:34 +00:00
|
|
|
pub struct GetCommentsResponse {
|
|
|
|
pub comments: Vec<CommentView>,
|
|
|
|
}
|