feat: expand public interest schema with name split, address, berth
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -64,10 +64,25 @@ export const generateRecommendationsSchema = z.object({
|
|||||||
|
|
||||||
// ─── Public Interest ──────────────────────────────────────────────────────────
|
// ─── Public Interest ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
export const publicInterestSchema = z.object({
|
const addressSchema = z.object({
|
||||||
fullName: z.string().min(1).max(200),
|
street: z.string().max(500).optional(),
|
||||||
|
city: z.string().max(200).optional(),
|
||||||
|
stateProvince: z.string().max(200).optional(),
|
||||||
|
postalCode: z.string().max(50).optional(),
|
||||||
|
country: z.string().max(100).optional(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const publicInterestSchema = z
|
||||||
|
.object({
|
||||||
|
// New: first/last split
|
||||||
|
firstName: z.string().min(1).max(100).optional(),
|
||||||
|
lastName: z.string().min(1).max(100).optional(),
|
||||||
|
// Backward compat
|
||||||
|
fullName: z.string().min(1).max(200).optional(),
|
||||||
email: z.string().email(),
|
email: z.string().email(),
|
||||||
phone: z.string().optional(),
|
phone: z.string().min(1),
|
||||||
|
preferredContactMethod: z.enum(['email', 'phone', 'sms']).optional(),
|
||||||
|
mooringNumber: z.string().max(50).optional(),
|
||||||
companyName: z.string().optional(),
|
companyName: z.string().optional(),
|
||||||
yachtName: z.string().optional(),
|
yachtName: z.string().optional(),
|
||||||
yachtLengthFt: z.coerce.number().positive().optional(),
|
yachtLengthFt: z.coerce.number().positive().optional(),
|
||||||
@@ -76,7 +91,12 @@ export const publicInterestSchema = z.object({
|
|||||||
preferredBerthSize: z.string().optional(),
|
preferredBerthSize: z.string().optional(),
|
||||||
source: z.literal('website').default('website'),
|
source: z.literal('website').default('website'),
|
||||||
notes: z.string().max(2000).optional(),
|
notes: z.string().max(2000).optional(),
|
||||||
});
|
address: addressSchema.optional(),
|
||||||
|
})
|
||||||
|
.refine((data) => data.fullName || (data.firstName && data.lastName), {
|
||||||
|
message: 'Either fullName or both firstName and lastName are required',
|
||||||
|
path: ['fullName'],
|
||||||
|
});
|
||||||
|
|
||||||
// ─── Reorder Waiting List ─────────────────────────────────────────────────────
|
// ─── Reorder Waiting List ─────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user