feat(shopping): setCartServings mit Positiv-Validation
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 2m15s

This commit is contained in:
hsiegeln
2026-04-21 22:59:12 +02:00
parent 83fe95ac76
commit 85bf197084
2 changed files with 29 additions and 5 deletions

View File

@@ -55,11 +55,16 @@ export function removeRecipeFromCart(
}
export function setCartServings(
_db: Database.Database,
_recipeId: number,
_servings: number
db: Database.Database,
recipeId: number,
servings: number
): void {
throw new Error('not implemented');
if (!Number.isInteger(servings) || servings <= 0) {
throw new Error(`Invalid servings: ${servings}`);
}
db.prepare(
'UPDATE shopping_cart_recipe SET servings = ? WHERE recipe_id = ?'
).run(servings, recipeId);
}
export function listShoppingList(db: Database.Database): ShoppingListSnapshot {