From 42f79f122b77c010c637d65c87b234d905ad1eb4 Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Sat, 18 Apr 2026 17:30:57 +0200 Subject: [PATCH] fix(api): PATCH akzeptiert servings_default=0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Das Schema hatte positive() statt nonnegative() — damit schlug jedes Save fehl, bei dem der Importer keine Portionsangabe finden konnte und 0 eingesetzt hatte (z.B. bei rezeptwelt.de-Rezepten). Alle anderen Int-Felder im gleichen Schema nutzen nonnegative() konsistent; servings_default war der Ausreißer. DB-Spalte erlaubt 0 ohnehin, insertRecipe akzeptiert 0 → nur die PATCH-Validierung hat unnötig blockiert. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/routes/api/recipes/[id]/+server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/api/recipes/[id]/+server.ts b/src/routes/api/recipes/[id]/+server.ts index 95773e2..efc43be 100644 --- a/src/routes/api/recipes/[id]/+server.ts +++ b/src/routes/api/recipes/[id]/+server.ts @@ -35,7 +35,7 @@ const PatchSchema = z .object({ title: z.string().min(1).max(200).optional(), description: z.string().max(2000).nullable().optional(), - servings_default: z.number().int().positive().nullable().optional(), + servings_default: z.number().int().nonnegative().nullable().optional(), servings_unit: z.string().max(30).nullable().optional(), prep_time_min: z.number().int().nonnegative().nullable().optional(), cook_time_min: z.number().int().nonnegative().nullable().optional(),