server: Add routes to manage ingredients

This commit is contained in:
traxys 2023-05-29 22:01:49 +02:00
parent 14fbde812f
commit c23da789a1
3 changed files with 146 additions and 1 deletions

View file

@ -48,3 +48,33 @@ pub struct UserInfo {
pub name: String,
pub id: Uuid,
}
#[derive(Serialize, Deserialize)]
pub struct CreateIngredientRequest {
pub name: String,
pub unit: Option<String>,
}
#[derive(Serialize, Deserialize)]
pub struct CreateIngredientResponse {
pub id: i64,
}
#[derive(Serialize, Deserialize)]
pub struct IngredientInfo {
pub name: String,
pub unit: Option<String>,
}
#[derive(Serialize, Deserialize)]
pub struct IngredientList {
pub ingredients: HashMap<i64, IngredientInfo>,
}
#[derive(Serialize, Deserialize)]
pub struct EditIngredientRequest {
pub name: Option<String>,
pub unit: Option<String>,
#[serde(default)]
pub has_unit: bool,
}