Initial commit

This commit is contained in:
Pascal Engélibert 2022-10-15 15:32:57 +02:00
commit 980a85d41b
Signed by: tuxmain
GPG key ID: 3504BC6D362F7DCA
15 changed files with 3969 additions and 0 deletions

73
src/queries.rs Normal file
View file

@ -0,0 +1,73 @@
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,
}