refactor(clients): strip yacht/company/proxy fields from validator

Remove deprecated companyName, isProxy, proxyType, actualOwnerName, yacht
dimensions, and berthSizeDesired fields from createClientSchema and the
isProxy filter from listClientsSchema. First step of PR 8; cascading TS
errors in clients.service.ts and client-form.tsx are addressed in 8.2/8.3.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt Ciaccio
2026-04-24 14:25:10 +02:00
parent ddcffe9f6f
commit 367fc9800e
2 changed files with 11 additions and 18 deletions

View File

@@ -17,19 +17,7 @@ export const contactSchema = z.object({
export const createClientSchema = z.object({
fullName: z.string().min(1).max(200),
contacts: z.array(contactSchema).min(1, 'At least one contact is required'),
companyName: z.string().optional(),
nationality: z.string().optional(),
isProxy: z.boolean().optional().default(false),
proxyType: z.string().optional(),
actualOwnerName: z.string().optional(),
yachtName: z.string().optional(),
yachtLengthFt: z.string().optional(),
yachtWidthFt: z.string().optional(),
yachtDraftFt: z.string().optional(),
yachtLengthM: z.string().optional(),
yachtWidthM: z.string().optional(),
yachtDraftM: z.string().optional(),
berthSizeDesired: z.string().optional(),
preferredContactMethod: z.enum(['email', 'phone', 'whatsapp']).optional(),
preferredLanguage: z.string().optional(),
timezone: z.string().optional(),
@@ -40,17 +28,15 @@ export const createClientSchema = z.object({
// ─── Update ──────────────────────────────────────────────────────────────────
export const updateClientSchema = createClientSchema.omit({ contacts: true, tagIds: true }).partial();
export const updateClientSchema = createClientSchema
.omit({ contacts: true, tagIds: true })
.partial();
// ─── List ─────────────────────────────────────────────────────────────────────
export const listClientsSchema = baseListQuerySchema.extend({
source: z.enum(['website', 'manual', 'referral', 'broker']).optional(),
nationality: z.string().optional(),
isProxy: z
.string()
.transform((v) => v === 'true')
.optional(),
tagIds: z
.string()
.transform((v) => v.split(',').filter(Boolean))