mirror of
https://github.com/bitbaum/vitareba.git
synced 2026-12-04 08:38:54 +01:00
Completes the domain-schema consolidation pass: - lib/domain/programmes.ts: new — programmeUpdateSchema (fixes magic 10 → PROGRAMME_START_DATE_MAX_LENGTH constant added to lib/config/portal.ts) - lib/domain/bookings.ts: new — bookingCreateSchema - lib/domain/messages.ts: add replySchema alongside existing message utils API routes now import from domain; no more inline z.object() definitions in app/api/**. All routes thin; all validation logic has a single home. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
12 lines
564 B
TypeScript
12 lines
564 B
TypeScript
import { z } from "zod";
|
|
import { PROGRAMME_ENUM_VALUES, PHASE_ENUM_VALUES } from "@/lib/config/programmes";
|
|
import { PATIENT_NOTE_MAX_LENGTH, PROGRAMME_START_DATE_MAX_LENGTH } from "@/lib/config/portal";
|
|
|
|
/** Validates an admin PATCH body for programme assignment upserts */
|
|
export const programmeUpdateSchema = z.object({
|
|
programme: z.enum(PROGRAMME_ENUM_VALUES),
|
|
phase: z.enum(PHASE_ENUM_VALUES),
|
|
startDate: z.string().max(PROGRAMME_START_DATE_MAX_LENGTH).nullable().optional(),
|
|
notes: z.string().max(PATIENT_NOTE_MAX_LENGTH).nullable().optional(),
|
|
});
|