webcomment/src/queries.rs

74 lines
1.5 KiB
Rust

use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize)]
pub struct AdminLoginQuery {
pub psw: String,
}
#[derive(Clone, Debug, Deserialize)]
pub struct AdminEditCommentQuery {
pub author: String,
pub comment_id: String,
pub email: String,
pub text: String,
}
#[derive(Clone, Debug, Deserialize)]
pub struct AdminRmCommentQuery {
pub comment_id: String,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct NewCommentQuery {
pub author: String,
pub email: String,
pub text: String,
}
#[derive(Clone, Debug, Deserialize)]
pub struct EditCommentQuery {
pub author: String,
pub comment_id: String,
pub email: String,
pub text: String,
pub token: String,
}
#[derive(Clone, Debug, Deserialize)]
pub struct RmCommentQuery {
pub comment_id: String,
pub token: String,
}
#[derive(Clone, Debug, Deserialize)]
#[serde(tag = "a")]
pub enum CommentQuery {
#[serde(rename = "new_comment")]
NewComment(NewCommentQuery),
#[serde(rename = "edit_comment")]
EditComment(EditCommentQuery),
#[serde(rename = "rm_comment")]
RmComment(RmCommentQuery),
}
#[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,
}
#[derive(Clone, Debug, Deserialize)]
pub struct RemoveQuery {
pub remove: String,
}