Signed-off-by: Litchi Pi <litchi.pi@proton.me>
This commit is contained in:
Litchi Pi 2025-07-23 12:03:39 +02:00
commit c32c9d4502
2 changed files with 5 additions and 5 deletions

View file

@ -374,7 +374,7 @@ class RecipeController(BaseRecipeController):
If you wish to update parts of the recipe only, use a PATCH request to this route If you wish to update parts of the recipe only, use a PATCH request to this route
""" """
try: try:
recipe = self.service.update_one(slug, data, strict=True) recipe = self.service.update_one(slug, data)
except Exception as e: except Exception as e:
self.handle_exceptions(e) self.handle_exceptions(e)
@ -399,7 +399,7 @@ class RecipeController(BaseRecipeController):
lambda: defaultdict(list) lambda: defaultdict(list)
) )
for recipe in data: for recipe in data:
r = self.service.update_one(recipe.id, recipe, strict=True) # type: ignore r = self.service.update_one(recipe.id, recipe) # type: ignore
updated_by_group_and_household[r.group_id][r.household_id].append(r) updated_by_group_and_household[r.group_id][r.household_id].append(r)
all_updated: list[Recipe] = [] all_updated: list[Recipe] = []

View file

@ -402,15 +402,15 @@ class RecipeService(RecipeServiceBase):
return recipe return recipe
def update_one(self, slug_or_id: str | UUID, update_data: Recipe, strict: bool) -> Recipe: def update_one(self, slug_or_id: str | UUID, update_data: Recipe) -> Recipe:
recipe = self._pre_update_check(slug_or_id, update_data, strict) recipe = self._pre_update_check(slug_or_id, update_data, True)
new_data = self.group_recipes.update(recipe.slug, update_data) new_data = self.group_recipes.update(recipe.slug, update_data)
self.check_assets(new_data, recipe.slug) self.check_assets(new_data, recipe.slug)
return new_data return new_data
def patch_one(self, slug_or_id: str | UUID, patch_data: Recipe) -> Recipe: def patch_one(self, slug_or_id: str | UUID, patch_data: Recipe) -> Recipe:
recipe: Recipe = self._pre_update_check(slug_or_id, patch_data) recipe: Recipe = self._pre_update_check(slug_or_id, patch_data, False)
new_data = self.group_recipes.patch(recipe.slug, patch_data.model_dump(exclude_unset=True)) new_data = self.group_recipes.patch(recipe.slug, patch_data.model_dump(exclude_unset=True))