65 lines
1.3 KiB
Rust
65 lines
1.3 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, Deserialize)]
|
|
pub struct AdminLoginQuery {
|
|
pub psw: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Deserialize)]
|
|
pub struct AdminRmAdQuery {
|
|
pub ad: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct NewAdQuery {
|
|
pub author: String,
|
|
pub price: String,
|
|
pub psw: String,
|
|
pub pubkey: String,
|
|
pub quantity: String,
|
|
pub title: String,
|
|
pub group: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct AdminNewGroupQuery {
|
|
pub parent: String,
|
|
pub name: String,
|
|
pub title: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct AdminEditGroupQuery {
|
|
pub group: String,
|
|
pub name: String,
|
|
pub title: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Deserialize)]
|
|
pub struct RmAdQuery {
|
|
pub ad: String,
|
|
pub psw: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Deserialize)]
|
|
#[serde(tag = "a")]
|
|
pub enum IndexQuery {
|
|
#[serde(rename = "new_ad")]
|
|
NewAd(NewAdQuery),
|
|
#[serde(rename = "rm_ad")]
|
|
RmAd(RmAdQuery),
|
|
}
|
|
|
|
#[derive(Clone, Debug, Deserialize)]
|
|
#[serde(tag = "a")]
|
|
pub enum AdminQuery {
|
|
#[serde(rename = "login")]
|
|
Login(AdminLoginQuery),
|
|
#[serde(rename = "new_group")]
|
|
NewGroup(AdminNewGroupQuery),
|
|
#[serde(rename = "edit_group")]
|
|
EditGroup(AdminEditGroupQuery),
|
|
#[serde(rename = "rm_ad")]
|
|
RmAd(AdminRmAdQuery),
|
|
}
|