feat: split into multiple items

This commit is contained in:
vas3k
2025-05-23 14:33:40 +02:00
parent 289b436236
commit 25c61f0519
17 changed files with 332 additions and 57 deletions

View File

@@ -47,5 +47,16 @@ export const transactionFormSchema = z
.optional(),
text: z.string().optional(),
note: z.string().optional(),
items: z
.string()
.optional()
.transform((val) => {
if (!val || val.trim() === '') return []
try {
return JSON.parse(val)
} catch (e) {
throw new z.ZodError([{ message: "Invalid items JSON", path: ["items"], code: z.ZodIssueCode.custom }])
}
}),
})
.catchall(z.string())