Skip to content

feat: allow changing opportunity type (accompanying/regular/event) via PATCH /opportunity/:id #730

Description

@nadavosa

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

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions