refactor(validations): split lib/validations.ts into a barrel'd folder (slice 1)
1141-line lib/validations.ts → lib/validations/<feature>.ts + primitives.ts + an index.ts barrel. '@/lib/validations' now resolves to the barrel, so all 40 importers are untouched. Every one of the 143 exports is preserved verbatim (verified by symbol-diff); schemas moved unchanged. tsc 0, 635 tests green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
c8c60358c7
commit
18d5e22ad4
@@ -0,0 +1,20 @@
|
||||
import { z } from 'zod'
|
||||
import { emailField } from './primitives'
|
||||
|
||||
export const createContactSchema = z.object({
|
||||
name: z.string().min(1, 'Name is required').max(200),
|
||||
contact_type: z.enum(['vendor', 'supplier', 'partner', 'landlord', 'city']),
|
||||
email: emailField().optional().nullable(),
|
||||
phone: z.string().max(20).optional().nullable(),
|
||||
details: z.string().max(500).optional().nullable(),
|
||||
note: z.string().max(2000).optional().nullable(),
|
||||
group_label: z.string().max(100).optional().nullable(),
|
||||
tags: z.array(z.string().max(50)).max(10).optional(),
|
||||
code: z.string().max(50).optional().nullable(),
|
||||
})
|
||||
|
||||
export const updateContactSchema = createContactSchema.partial().extend({
|
||||
contactId: z.string().uuid('Invalid contact ID'),
|
||||
})
|
||||
|
||||
export type CreateContactInput = z.infer<typeof createContactSchema>
|
||||
Reference in New Issue
Block a user