Fix clear-data to check recipe delete return value

The delete_recipe() returns (success, error) tuple but
clear-data wasn't checking the result, so failed deletes
weren't being reported.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-12 19:02:16 +00:00
parent 2e3d3a5c6d
commit b36aab33bb

View File

@@ -122,8 +122,11 @@ async def clear_user_data(request: Request):
recipes = await recipe_service.list_recipes(actor_id, offset=0, limit=10000) recipes = await recipe_service.list_recipes(actor_id, offset=0, limit=10000)
for recipe in recipes: for recipe in recipes:
try: try:
await recipe_service.delete_recipe(recipe["recipe_id"], actor_id) success, error = await recipe_service.delete_recipe(recipe["recipe_id"], actor_id)
deleted["recipes"] += 1 if success:
deleted["recipes"] += 1
else:
errors.append(f"Recipe {recipe['recipe_id']}: {error}")
except Exception as e: except Exception as e:
errors.append(f"Recipe {recipe['recipe_id']}: {e}") errors.append(f"Recipe {recipe['recipe_id']}: {e}")
except Exception as e: except Exception as e: