Problem
When an agent creates a new opportunity with type Accompanying, the accompanying details section has no required field validation. The schema marks all fields as optional, so the form can be submitted with empty critical fields, sending null values to the BE.
Affected file
src/components/Dashboard/Profile/sections/AccompanyingDetails/accompanyingDetailsSchema.ts
Bugs to fix
- No required validation on key fields —
appointmentAddress, appointmentPostcode, appointmentDate, appointmentTime, refugeeName are all .optional() in the schema. For accompanying type these should be required (or at minimum address + date).
accompanyingDetailsSchema is shared between the creation form (NewOpportunity) and the profile edit section (AccompanyingDetails). The creation form should enforce stricter validation than the edit form (where partial saves are acceptable). Consider a separate schema or a stricter variant for creation.
Expected behaviour
When opportunity type is Accompanying and the agent clicks Create, form submission should be blocked until the required accompanying fields are filled in, with inline error messages shown.
Related
Problem
When an agent creates a new opportunity with type Accompanying, the accompanying details section has no required field validation. The schema marks all fields as optional, so the form can be submitted with empty critical fields, sending null values to the BE.
Affected file
src/components/Dashboard/Profile/sections/AccompanyingDetails/accompanyingDetailsSchema.tsBugs to fix
appointmentAddress,appointmentPostcode,appointmentDate,appointmentTime,refugeeNameare all.optional()in the schema. For accompanying type these should be required (or at minimum address + date).accompanyingDetailsSchemais shared between the creation form (NewOpportunity) and the profile edit section (AccompanyingDetails). The creation form should enforce stricter validation than the edit form (where partial saves are acceptable). Consider a separate schema or a stricter variant for creation.Expected behaviour
When opportunity type is Accompanying and the agent clicks Create, form submission should be blocked until the required accompanying fields are filled in, with inline error messages shown.
Related