fix(api): PATCH akzeptiert servings_default=0
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 1m19s

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) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-18 17:30:57 +02:00
parent 3d6f6393b3
commit 42f79f122b

View File

@@ -35,7 +35,7 @@ const PatchSchema = z
.object({ .object({
title: z.string().min(1).max(200).optional(), title: z.string().min(1).max(200).optional(),
description: z.string().max(2000).nullable().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(), servings_unit: z.string().max(30).nullable().optional(),
prep_time_min: z.number().int().nonnegative().nullable().optional(), prep_time_min: z.number().int().nonnegative().nullable().optional(),
cook_time_min: z.number().int().nonnegative().nullable().optional(), cook_time_min: z.number().int().nonnegative().nullable().optional(),