Skip to content

Backend: Add consistent conflict detection and 409 responses for duplicate resources #227

Description

@greatest0fallt1me

Description

Standardize how the API detects and responds to duplicates (duplicate credit line open, duplicate risk evaluation create, duplicate webhook subscription). Return a consistent 409 error with a stable code and actionable details.

Requirements and context

  • Must be secure, tested, and documented.
  • Must avoid leaking sensitive identifiers in conflict details.

Suggested execution

git checkout -b feature/conflict-409-standard

Implement changes

  • Add a shared ConflictError type and mapping to problem+json.
  • Update repositories/services to throw conflict on unique constraint violations.
  • Integration tests for representative conflict scenarios.
  • Update OpenAPI error responses.

Test and commit

npm test

Example commit message

feat(api): consistent 409 conflict responses for duplicate resources

Guidelines

  • Timeframe: 96 hours.

Metadata

Metadata

Assignees

Labels

GRANTFOX OSSGrantFox OSS programMAYBE REWARDEDGrantFox — potentially rewardedOFFICIAL CAMPAIGNGrantFox official campaignapiHTTP API and routingbackendBackend servicequalityCode quality improvementstestingTests and coverage
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions