webcomment/src/queries.rs

94 lines
1.8 KiB
Rust
Raw Normal View History

2022-10-22 15:56:24 +00:00
use serde::Deserialize;
2022-10-15 13:32:57 +00:00
#[derive(Clone, Debug, Deserialize)]
pub struct AdminLoginQuery {
pub psw: String,
}
#[derive(Clone, Debug, Deserialize)]
pub struct AdminEditCommentQuery {
pub author: String,
2022-10-22 15:56:24 +00:00
pub id: String,
2022-10-15 13:32:57 +00:00
pub email: String,
pub text: String,
}
#[derive(Clone, Debug, Deserialize)]
pub struct AdminRmCommentQuery {
2022-10-22 15:56:24 +00:00
pub id: String,
2022-10-15 13:32:57 +00:00
}
2022-10-22 15:56:24 +00:00
#[derive(Clone, Debug, Deserialize)]
2022-10-15 13:32:57 +00:00
pub struct NewCommentQuery {
2022-10-22 15:56:24 +00:00
#[serde(flatten)]
pub comment: CommentForm,
2022-10-15 13:32:57 +00:00
}
#[derive(Clone, Debug, Deserialize)]
pub struct EditCommentQuery {
2022-10-22 15:56:24 +00:00
#[serde(flatten)]
pub comment: CommentForm,
pub id: String,
//pub token: String,
2022-10-15 13:32:57 +00:00
}
2022-10-22 15:56:24 +00:00
/*#[derive(Clone, Debug, Deserialize)]
2022-10-15 13:32:57 +00:00
pub struct RmCommentQuery {
2022-10-22 15:56:24 +00:00
pub id: String,
//pub token: String,
}*/
2022-10-15 13:32:57 +00:00
#[derive(Clone, Debug, Deserialize)]
#[serde(tag = "a")]
pub enum CommentQuery {
#[serde(rename = "new_comment")]
NewComment(NewCommentQuery),
#[serde(rename = "edit_comment")]
EditComment(EditCommentQuery),
2022-10-22 15:56:24 +00:00
/*#[serde(rename = "rm_comment")]
RmComment(RmCommentQuery),*/
2022-10-15 13:32:57 +00:00
}
#[derive(Clone, Debug, Deserialize)]
#[serde(tag = "a")]
pub enum AdminQuery {
#[serde(rename = "login")]
Login(AdminLoginQuery),
#[serde(rename = "edit_comment")]
EditComment(AdminEditCommentQuery),
#[serde(rename = "rm_comment")]
RmComment(AdminRmCommentQuery),
}
#[derive(Clone, Debug, Deserialize)]
pub struct ApproveQuery {
pub approve: String,
}
2022-12-29 21:46:21 +00:00
#[derive(Clone, Debug, Deserialize)]
pub struct ApproveEditQuery {
pub approve_edit: String,
}
2022-10-15 13:32:57 +00:00
#[derive(Clone, Debug, Deserialize)]
pub struct RemoveQuery {
pub remove: String,
}
2022-10-22 15:56:24 +00:00
2022-12-29 21:46:21 +00:00
#[derive(Clone, Debug, Deserialize)]
pub struct RemoveEditQuery {
pub remove_edit: String,
}
2022-10-22 15:56:24 +00:00
#[derive(Clone, Debug, Deserialize)]
pub struct EditQuery {
pub edit: String,
}
#[derive(Clone, Debug, Deserialize)]
pub struct CommentForm {
pub author: String,
pub email: String,
pub text: String,
}