Files
hackerspace.sh/lib/validations/areas.ts
T
Moheeb ZaraandClaude Opus 4.8 18d5e22ad4 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) <[email protected]>
2026-08-02 04:19:11 -07:00

21 lines
686 B
TypeScript

import { z } from 'zod'
export const createAreaSchema = z.object({
code: z
.string()
.min(1, 'Code is required')
.max(40)
.regex(/^[a-z0-9-]+$/, 'Code must be lowercase letters, numbers, and hyphens only'),
name: z.string().min(1, 'Name is required').max(80),
icon: z.string().max(20).optional().nullable(),
sort_order: z.number().int().min(0).max(100000).optional(),
})
export const updateAreaSchema = z.object({
areaId: z.string().uuid('Invalid area ID'),
name: z.string().min(1).max(80).optional(),
icon: z.string().max(20).optional().nullable(),
sort_order: z.number().int().min(0).max(100000).optional(),
is_archived: z.boolean().optional(),
})