Problem
PATCH /opportunity/:id cannot change opportunity_type. The field is absent from ApiOpportunityPatch in the SDK and from parseOpportunity in the BE, so coordinators have no way to correct a type set during submission.
SDK change required first
Add to ApiOpportunityPatch in the SDK:
opportunity_type?: OpportunityType;
Then update parseOpportunity in src/services/dto/parser-opportunity-patch-data.ts:
opportunity: {
status: body.statusOpportunity,
numberVolunteers: body.numberVolunteers,
info: body.description,
infoConfidential: body.description,
type: body.opportunity_type, // ← add this
},
Notes
- The
Opportunity entity already has a type column — no migration needed.
- When switching from
accompanying to another type, the accompanying details row is left in place (no cascade delete needed on the BE — the FE should warn the user).
- When switching to
accompanying, the FE must prompt for accompanying details separately (the existing PATCH accompanyingDetails field can be sent in the same request).
Related
FE issue: need4deed-org/fe#751
Problem
PATCH /opportunity/:idcannot changeopportunity_type. The field is absent fromApiOpportunityPatchin the SDK and fromparseOpportunityin the BE, so coordinators have no way to correct a type set during submission.SDK change required first
Add to
ApiOpportunityPatchin the SDK:Then update
parseOpportunityinsrc/services/dto/parser-opportunity-patch-data.ts:Notes
Opportunityentity already has atypecolumn — no migration needed.accompanyingto another type, the accompanying details row is left in place (no cascade delete needed on the BE — the FE should warn the user).accompanying, the FE must prompt for accompanying details separately (the existing PATCHaccompanyingDetailsfield can be sent in the same request).Related
FE issue: need4deed-org/fe#751