server: Add routes to manage ingredients
This commit is contained in:
parent
14fbde812f
commit
c23da789a1
3 changed files with 146 additions and 1 deletions
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue