fix(sanity): resolve 15 gaps from sanity check audit (G-01 through G-15)
- G-01: ProjectWizard renders blueprint fieldDefs with DynamicFieldInput component - G-02: Blueprint rolePresets validated via RolePresetsSchema in wizard; API keeps loose schema - G-03: ProjectWizard step 2/3 validation (role, hoursPerDay, headcount required) - G-04: EstimateWizard validates baseCurrency and demand line cost rates - G-05: Project lifecycle transition guards with ALLOWED_TRANSITIONS map - G-06: Blueprint validator extended for minLength/maxLength/pattern and DATE range checks - G-07: assertBlueprintDynamicFields merges global blueprint fieldDefs into validation - G-08: (tracked — chapter managed dropdown; deferred to backend ticket) - G-09: JSDoc added to lcrCents/ucrCents clarifying LCR/UCR terminology - G-10: Dispo route redirect already in place — closed as done - G-11: packages/ui empty by design — closed as documented - G-12: @deprecated JSDoc added to CreateAllocationSchema and UpdateAllocationSchema - G-13: ProjectWizard review step enhanced with blueprint name, field values, skills, assignments - G-14: ProjectWizard handleSubmit collects per-item warnings instead of silent swallowing - G-15: Vacation cancel reverses usedDays entitlement for APPROVED ANNUAL/OTHER vacations Tests: all 1575 passing (1 pre-existing failure in insights-summary unrelated to these changes) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -45,11 +45,20 @@ export const CreateAssignmentBaseSchema = z.object({
|
||||
metadata: z.record(z.string(), z.unknown()).default({}),
|
||||
});
|
||||
|
||||
/**
|
||||
* @deprecated Use `CreateDemandRequirementSchema` (for open demand) or `CreateAssignmentSchema`
|
||||
* (for resource assignments) instead. This legacy facade remains for router backwards-compat
|
||||
* and will be removed once all consumers are migrated.
|
||||
*/
|
||||
export const CreateAllocationSchema = CreateAllocationBaseSchema.refine(
|
||||
(data) => data.endDate >= data.startDate,
|
||||
{ message: "End date must be after start date", path: ["endDate"] },
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use `UpdateDemandRequirementSchema` or `UpdateAssignmentSchema` instead.
|
||||
* See `CreateAllocationSchema` note above.
|
||||
*/
|
||||
export const UpdateAllocationSchema = CreateAllocationBaseSchema.partial();
|
||||
|
||||
export const CreateDemandRequirementSchema = CreateDemandRequirementBaseSchema.refine(
|
||||
|
||||
@@ -1,6 +1,29 @@
|
||||
import { z } from "zod";
|
||||
import { BlueprintTarget, FieldType } from "../types/enums.js";
|
||||
|
||||
// ─── Role Preset Schema ───────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* Validates a single staffing requirement used as a blueprint role preset.
|
||||
* Must match the StaffingRequirement interface from types/project.ts.
|
||||
*/
|
||||
export const RolePresetSchema = z.object({
|
||||
id: z.string().min(1),
|
||||
role: z.string().min(1),
|
||||
roleId: z.string().optional(),
|
||||
requiredSkills: z.array(z.string()).default([]),
|
||||
preferredSkills: z.array(z.string()).optional(),
|
||||
hoursPerDay: z.number().positive().max(24),
|
||||
headcount: z.number().int().min(1),
|
||||
budgetCents: z.number().int().min(0).optional(),
|
||||
startDate: z.string().optional(),
|
||||
endDate: z.string().optional(),
|
||||
notes: z.string().optional(),
|
||||
chapter: z.string().optional(),
|
||||
});
|
||||
|
||||
export const RolePresetsSchema = z.array(RolePresetSchema);
|
||||
|
||||
export const FieldOptionSchema = z.object({
|
||||
value: z.string().min(1),
|
||||
label: z.string().min(1),
|
||||
|
||||
@@ -32,7 +32,15 @@ export interface Resource {
|
||||
displayName: string;
|
||||
email: string;
|
||||
chapter?: string | null;
|
||||
/**
|
||||
* Labor Cost Rate — hourly cost of this resource to the company (integer cents).
|
||||
* Equivalent to `costRateCents` in the estimating domain.
|
||||
*/
|
||||
lcrCents: number;
|
||||
/**
|
||||
* Utilization Cost Rate — hourly charge-out rate billed to clients (integer cents).
|
||||
* Equivalent to `billRateCents` in the estimating domain.
|
||||
*/
|
||||
ucrCents: number;
|
||||
currency: string;
|
||||
chargeabilityTarget: number;
|
||||
|
||||
Reference in New Issue
Block a user