fix: Accept null for all optional contact fields
lastName and secondaryEmail schemas now accept null values sent from frontend, matching other optional fields pattern. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,10 +8,10 @@ const router = express.Router()
|
||||
|
||||
const createContactSchema = z.object({
|
||||
firstName: z.string().min(1, 'Meno je povinné'),
|
||||
lastName: z.string().optional(),
|
||||
lastName: z.union([z.string(), z.literal(''), z.null()]).optional(),
|
||||
phone: z.union([z.string(), z.literal(''), z.null()]).optional(),
|
||||
email: z.string().email('Neplatný email'),
|
||||
secondaryEmail: z.union([z.string().email('Neplatný email'), z.literal('')]).optional(),
|
||||
secondaryEmail: z.union([z.string().email('Neplatný email'), z.literal(''), z.null()]).optional(),
|
||||
companyId: z.union([z.string().uuid(), z.literal(''), z.null()]).optional(),
|
||||
description: z.union([z.string().max(1000), z.literal(''), z.null()]).optional(),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user