Problem
The unique constraint `(opportunity_id, volunteer_id)` added in migration `1779738026660` means the POST `/api/opportunity-volunteer` fails with a constraint violation whenever the pair already exists (e.g. volunteers seeded as matched in `1779739039589`).
The route does a plain `save()` with no `id`, which always generates an INSERT:
```typescript
const opportunityVolunteer = new OpportunityVolunteer(request.body);
await opportunityVolunteerRepository.save(opportunityVolunteer);
```
Fix
Check for an existing row first. If found and not in a terminal status (matched/active/past), update it. If found in terminal status, return 201 without change. If not found, insert.
File
`src/server/routes/m2m/opportunity-volunteer.routes.ts`
Problem
The unique constraint `(opportunity_id, volunteer_id)` added in migration `1779738026660` means the POST `/api/opportunity-volunteer` fails with a constraint violation whenever the pair already exists (e.g. volunteers seeded as matched in `1779739039589`).
The route does a plain `save()` with no `id`, which always generates an INSERT:
```typescript
const opportunityVolunteer = new OpportunityVolunteer(request.body);
await opportunityVolunteerRepository.save(opportunityVolunteer);
```
Fix
Check for an existing row first. If found and not in a terminal status (matched/active/past), update it. If found in terminal status, return 201 without change. If not found, insert.
File
`src/server/routes/m2m/opportunity-volunteer.routes.ts`