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) <[email protected]>
27 lines
954 B
TypeScript
27 lines
954 B
TypeScript
import { z } from 'zod'
|
|
import { emailField, flexibleDateTime } from './primitives'
|
|
|
|
const importEmail = emailField('Invalid email')
|
|
|
|
export const importMembersSchema = z.array(
|
|
z.object({
|
|
display_name: z.string().min(1, 'Name required').max(100),
|
|
email: importEmail,
|
|
phone: z.string().max(20).optional().nullable(),
|
|
tier: z.enum(['plus', 'basic', 'associate']).optional(),
|
|
joined_at: flexibleDateTime().optional(),
|
|
last_paid_at: flexibleDateTime().optional(),
|
|
has_card_access: z.boolean().optional(),
|
|
}),
|
|
).max(5000)
|
|
|
|
export const importPaymentsCsvSchema = z.array(
|
|
z.object({
|
|
platform: z.enum(['paypal', 'zeffy', 'venmo', 'cash']),
|
|
amount: z.number().finite().positive('Amount must be positive').max(10_000_000),
|
|
from_identifier: z.string().min(1, 'Payer required').max(200),
|
|
from_note: z.string().max(500).optional().nullable(),
|
|
transaction_date: flexibleDateTime().optional(),
|
|
}),
|
|
).max(10000)
|