59 lines
1.2 KiB
Rust
59 lines
1.2 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
use uuid::Uuid;
|
|
|
|
#[derive(Clone, Debug, FromForm)]
|
|
pub struct Authenticate {
|
|
pub password: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, FromForm)]
|
|
pub struct ProductRequest {
|
|
pub full_name: String,
|
|
pub short_name: String,
|
|
pub price_usd: f64,
|
|
pub stock: u32,
|
|
pub password: String,
|
|
}
|
|
|
|
#[derive(Clone, Serialize, Deserialize, Debug, FromForm)]
|
|
pub struct Product {
|
|
pub full_name: String,
|
|
pub short_name: String,
|
|
pub price_usd: f64,
|
|
pub stock: u32,
|
|
}
|
|
|
|
#[derive(FromForm)]
|
|
pub struct OrderRequest<'r> {
|
|
pub r#name: &'r str,
|
|
pub r#email: &'r str,
|
|
pub r#user_message: &'r str,
|
|
pub r#encryption_key: &'r str,
|
|
pub r#payment_type: PaymentOption,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
|
pub struct Order {
|
|
pub name: String,
|
|
pub email: String,
|
|
pub message: String,
|
|
pub encryption_key: String,
|
|
pub payment_type: PaymentOption,
|
|
pub uuid: Uuid,
|
|
}
|
|
|
|
#[derive(FromForm)]
|
|
pub struct Update<'r> {
|
|
pub r#product: &'r str,
|
|
pub r#field: &'r str,
|
|
pub value: f64,
|
|
pub r#password: &'r str,
|
|
}
|
|
|
|
#[derive(Debug, PartialEq, FromFormField, Serialize, Clone, Deserialize)]
|
|
pub enum PaymentOption {
|
|
XMR,
|
|
ETH,
|
|
BTC,
|
|
}
|