fix(05-01): add imageFilename to Zod validation schemas
- Root cause: Zod schemas for createItem and createCandidate did not include imageFilename field, so @hono/zod-validator silently stripped it from validated payloads before reaching the service layer - Images uploaded successfully but filename was never persisted to DB - Added imageFilename as optional string to both createItemSchema and createCandidateSchema Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ export const createItemSchema = z.object({
|
|||||||
categoryId: z.number().int().positive(),
|
categoryId: z.number().int().positive(),
|
||||||
notes: z.string().optional(),
|
notes: z.string().optional(),
|
||||||
productUrl: z.string().url().optional().or(z.literal("")),
|
productUrl: z.string().url().optional().or(z.literal("")),
|
||||||
|
imageFilename: z.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const updateItemSchema = createItemSchema.partial().extend({
|
export const updateItemSchema = createItemSchema.partial().extend({
|
||||||
@@ -43,6 +44,7 @@ export const createCandidateSchema = z.object({
|
|||||||
categoryId: z.number().int().positive(),
|
categoryId: z.number().int().positive(),
|
||||||
notes: z.string().optional(),
|
notes: z.string().optional(),
|
||||||
productUrl: z.string().url().optional().or(z.literal("")),
|
productUrl: z.string().url().optional().or(z.literal("")),
|
||||||
|
imageFilename: z.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const updateCandidateSchema = createCandidateSchema.partial();
|
export const updateCandidateSchema = createCandidateSchema.partial();
|
||||||
|
|||||||
Reference in New Issue
Block a user