Skip to content

Add a ?status= filter to GET /api/v1/settlements, wired through settlementService.listΒ #140

Description

@Jagadeeshftw

πŸ“Œ Description

Settlement.status ("pending" | "executed" | "cancelled") is central to the settlement lifecycle, but SettlementService.list only accepts anchor/asset filters β€” there's no way to ask GET /api/v1/settlements for, say, only pending settlements, even though routes/metrics.ts already computes pendingSettlements internally via the same kind of filter.

🧩 Requirements and context

  • Extend SettlementService.list's filters parameter to accept an optional status, validated against the SettlementStatus union (reject anything else with 400).
  • Wire ?status= through routes/settlements.ts's GET / handler.
  • Combine correctly with existing ?anchor=/?asset= filters, sorting, and pagination.

πŸ› οΈ Suggested execution

  • Modify src/services/settlementService.ts's list to accept and validate status.
  • Modify src/routes/settlements.ts's GET / handler to parse req.query.status.
  • Update src/openapi.ts's /api/v1/settlements GET parameters.
  • Add tests in src/services/settlementService.test.ts and src/routes/settlements.test.ts covering each status value and an invalid value.

βœ… Acceptance criteria

  • GET /api/v1/settlements?status=pending returns only pending settlements.
  • An invalid ?status= value (not one of the three valid statuses) returns 400.
  • Combines correctly with existing filters, sort, and pagination.

πŸ”’ Security notes

N/A β€” read-path filter over already-exposed settlement lifecycle data.

πŸ“‹ Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSGrantFox open-source programMaybe RewardedGrantFox: potentially rewarded contributionOfficial Campaign | FWC26GrantFox official campaign issueapiHTTP/WebSocket APIenhancementNew feature or improvement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions