feat: make responsiblePerson required on project creation/edit
- Zod schema: responsiblePerson now min(1) required, no longer optional - ProjectModal: required indicator (*), HTML required attribute, no undefined fallback - ProjectWizard: same fix for create flow - Existing projects with null responsiblePerson still work (DB allows null) - Validation enforced at API boundary on new creates/updates Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
@@ -204,7 +204,7 @@ export function ProjectModal({ project, onClose }: ProjectModalProps) {
|
||||
startDate: new Date(form.startDate),
|
||||
endDate: new Date(form.endDate),
|
||||
status: form.status as unknown as ProjectStatus,
|
||||
responsiblePerson: form.responsiblePerson.trim() || undefined,
|
||||
responsiblePerson: form.responsiblePerson.trim(),
|
||||
...(form.color ? { color: form.color } : {}),
|
||||
...(form.utilizationCategoryId ? { utilizationCategoryId: form.utilizationCategoryId } : {}),
|
||||
...(form.clientId ? { clientId: form.clientId } : {}),
|
||||
@@ -223,7 +223,7 @@ export function ProjectModal({ project, onClose }: ProjectModalProps) {
|
||||
status: form.status as unknown as ProjectStatus,
|
||||
staffingReqs: [],
|
||||
dynamicFields: {},
|
||||
responsiblePerson: form.responsiblePerson.trim() || undefined,
|
||||
responsiblePerson: form.responsiblePerson.trim(),
|
||||
...(form.color ? { color: form.color } : {}),
|
||||
...(form.utilizationCategoryId ? { utilizationCategoryId: form.utilizationCategoryId } : {}),
|
||||
...(form.clientId ? { clientId: form.clientId } : {}),
|
||||
@@ -521,8 +521,8 @@ export function ProjectModal({ project, onClose }: ProjectModalProps) {
|
||||
</div>
|
||||
<div>
|
||||
<label className={labelClass} htmlFor="responsiblePerson">
|
||||
Responsible Person
|
||||
<InfoTooltip content="Project lead or account manager responsible for this project." />
|
||||
Responsible Person <span className="text-red-500">*</span>
|
||||
<InfoTooltip content="Project lead or account manager responsible for this project. Required." />
|
||||
</label>
|
||||
<input
|
||||
id="responsiblePerson"
|
||||
@@ -530,6 +530,7 @@ export function ProjectModal({ project, onClose }: ProjectModalProps) {
|
||||
value={form.responsiblePerson}
|
||||
onChange={(e) => setField("responsiblePerson", e.target.value)}
|
||||
placeholder="Name or EID"
|
||||
required
|
||||
className={inputClass}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1089,7 +1089,7 @@ export function ProjectWizard({ open, onClose }: ProjectWizardProps) {
|
||||
endDate: new Date(state.endDate),
|
||||
staffingReqs: state.staffingReqs,
|
||||
status: state.saveAsDraft ? ProjectStatus.DRAFT : ProjectStatus.ACTIVE,
|
||||
responsiblePerson: state.responsiblePerson.trim() || undefined,
|
||||
responsiblePerson: state.responsiblePerson.trim(),
|
||||
blueprintId: state.blueprintId ?? undefined,
|
||||
dynamicFields: {},
|
||||
});
|
||||
|
||||
@@ -28,7 +28,7 @@ export const CreateProjectBaseSchema = z.object({
|
||||
dynamicFields: z.record(z.string(), z.unknown()).default({}),
|
||||
blueprintId: z.string().optional(),
|
||||
status: z.nativeEnum(ProjectStatus).default(ProjectStatus.DRAFT),
|
||||
responsiblePerson: z.string().max(200).optional(),
|
||||
responsiblePerson: z.string().min(1, "Responsible person is required").max(200),
|
||||
color: z.string().regex(/^#[0-9a-fA-F]{6}$/, "Must be a hex color like #3b82f6").optional(),
|
||||
utilizationCategoryId: z.string().optional(),
|
||||
clientId: z.string().optional(),
|
||||
|
||||
Reference in New Issue
Block a user