fix(api): add Zod bounds on financial fields, type vacation router, type scenarioData

- dailyCostCents, hoursPerDay, percentage now validated at API boundary
- vacation router no longer uses ctx.db as any
- scenarioData reads through typed Zod schema

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-09 14:08:16 +02:00
parent d3bfa8ca98
commit 9a42615a21
5 changed files with 158 additions and 11 deletions
@@ -6,7 +6,7 @@ export const CreateAllocationBaseSchema = z.object({
projectId: z.string(),
startDate: z.coerce.date(),
endDate: z.coerce.date(),
hoursPerDay: z.number().min(0).max(24),
hoursPerDay: z.number().positive().max(24),
percentage: z.number().min(0).max(100),
role: z.string().max(200).optional(),
roleId: z.string().optional(),
@@ -20,7 +20,7 @@ export const CreateDemandRequirementBaseSchema = z.object({
projectId: z.string(),
startDate: z.coerce.date(),
endDate: z.coerce.date(),
hoursPerDay: z.number().min(0).max(24),
hoursPerDay: z.number().positive().max(24),
percentage: z.number().min(0).max(100),
role: z.string().max(200).optional(),
roleId: z.string().optional(),
@@ -36,7 +36,7 @@ export const CreateAssignmentBaseSchema = z.object({
projectId: z.string(),
startDate: z.coerce.date(),
endDate: z.coerce.date(),
hoursPerDay: z.number().min(0).max(24),
hoursPerDay: z.number().positive().max(24),
percentage: z.number().min(0).max(100),
role: z.string().max(200).optional(),
roleId: z.string().optional(),