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
Example commit message
feat(api): consistent 409 conflict responses for duplicate resources
Guidelines
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
Suggested execution
Implement changes
ConflictErrortype and mapping to problem+json.Test and commit
npm testExample commit message
Guidelines