api: Make all types Clone + Debug
This commit is contained in:
parent
7660146175
commit
2a0bddd418
1 changed files with 15 additions and 15 deletions
|
|
@ -3,80 +3,80 @@ use std::collections::HashMap;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct LoginRequest {
|
pub struct LoginRequest {
|
||||||
pub username: String,
|
pub username: String,
|
||||||
pub password: String,
|
pub password: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct LoginResponse {
|
pub struct LoginResponse {
|
||||||
pub token: String,
|
pub token: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct EmptyResponse {}
|
pub struct EmptyResponse {}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct Household {
|
pub struct Household {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub members: Vec<Uuid>,
|
pub members: Vec<Uuid>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct Households {
|
pub struct Households {
|
||||||
pub households: HashMap<Uuid, Household>,
|
pub households: HashMap<Uuid, Household>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct CreateHouseholdRequest {
|
pub struct CreateHouseholdRequest {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct CreateHouseholdResponse {
|
pub struct CreateHouseholdResponse {
|
||||||
pub id: Uuid,
|
pub id: Uuid,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct RenameHouseholdRequest {
|
pub struct RenameHouseholdRequest {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct AddToHouseholdRequest {
|
pub struct AddToHouseholdRequest {
|
||||||
pub user: Uuid,
|
pub user: Uuid,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct UserInfo {
|
pub struct UserInfo {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub id: Uuid,
|
pub id: Uuid,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct CreateIngredientRequest {
|
pub struct CreateIngredientRequest {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub unit: Option<String>,
|
pub unit: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct CreateIngredientResponse {
|
pub struct CreateIngredientResponse {
|
||||||
pub id: i64,
|
pub id: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct IngredientInfo {
|
pub struct IngredientInfo {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub unit: Option<String>,
|
pub unit: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct IngredientList {
|
pub struct IngredientList {
|
||||||
pub ingredients: HashMap<i64, IngredientInfo>,
|
pub ingredients: HashMap<i64, IngredientInfo>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct EditIngredientRequest {
|
pub struct EditIngredientRequest {
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
pub unit: Option<String>,
|
pub unit: Option<String>,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue