📌 Description
routes/settlements.ts's GET / supports filtering by ?anchor= and ?asset= only. An operator investigating settlements above/below a certain size (e.g. auditing unusually large settlements) currently has to fetch everything and filter client-side.
🧩 Requirements and context
- Accept optional
?minAmount=/?maxAmount= query params, validated as non-negative numbers via utils/validation.ts.
- Apply the range filter in
SettlementService.list (extend its filters parameter) rather than in the route handler, consistent with the existing anchor/asset filtering pattern.
- Combine correctly with existing
?anchor=/?asset= filters, sorting, and pagination.
🛠️ Suggested execution
- Extend
src/services/settlementService.ts's list(filters) signature to accept minAmount/maxAmount and filter accordingly.
- Modify
src/routes/settlements.ts's GET / handler to parse and pass the new query params through.
- Update
src/openapi.ts's /api/v1/settlements GET parameters.
- Add tests in
src/services/settlementService.test.ts and src/routes/settlements.test.ts.
✅ Acceptance criteria
🔒 Security notes
N/A — read-path filter over already-exposed settlement data.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
routes/settlements.ts'sGET /supports filtering by?anchor=and?asset=only. An operator investigating settlements above/below a certain size (e.g. auditing unusually large settlements) currently has to fetch everything and filter client-side.🧩 Requirements and context
?minAmount=/?maxAmount=query params, validated as non-negative numbers viautils/validation.ts.SettlementService.list(extend itsfiltersparameter) rather than in the route handler, consistent with the existing anchor/asset filtering pattern.?anchor=/?asset=filters, sorting, and pagination.🛠️ Suggested execution
src/services/settlementService.ts'slist(filters)signature to acceptminAmount/maxAmountand filter accordingly.src/routes/settlements.ts'sGET /handler to parse and pass the new query params through.src/openapi.ts's/api/v1/settlementsGETparameters.src/services/settlementService.test.tsandsrc/routes/settlements.test.ts.✅ Acceptance criteria
GET /api/v1/settlements?minAmount=100&maxAmount=500returns only settlements within that range.?anchor=,?asset=, sorting, and pagination.🔒 Security notes
N/A — read-path filter over already-exposed settlement data.
📋 Guidelines