Ingredients can now be remove from shopping list when a recipe is unscheduled.
This commit is contained in:
parent
a3f2b4a86a
commit
da5ea57787
7 changed files with 92 additions and 36 deletions
|
|
@ -681,12 +681,17 @@ pub async fn schedule_recipe(
|
|||
pub async fn rm_scheduled_recipe(
|
||||
State(connection): State<db::Connection>,
|
||||
Extension(user): Extension<Option<model::User>>,
|
||||
ExtractRon(ron): ExtractRon<common::ron_api::ScheduledRecipe>,
|
||||
ExtractRon(ron): ExtractRon<common::ron_api::RemoveScheduledRecipe>,
|
||||
) -> Result<impl IntoResponse> {
|
||||
check_user_rights_recipe(&connection, &user, ron.recipe_id).await?;
|
||||
if let Some(user) = user {
|
||||
connection
|
||||
.rm_scheduled_recipe(user.id, ron.recipe_id, ron.date)
|
||||
.rm_scheduled_recipe(
|
||||
user.id,
|
||||
ron.recipe_id,
|
||||
ron.date,
|
||||
ron.remove_ingredients_from_shopping_list,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
Ok(StatusCode::OK)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue