Skip to content

Add a SettlementRepository.remove(id) method for administrative purge/test cleanupΒ #163

Description

@Jagadeeshftw

πŸ“Œ Description

AnchorRepository and LiquidityRepository both expose a remove, but SettlementRepository only has create/save β€” there's no way to delete a settlement record outright. This is fine for normal lifecycle operations (which use cancel, not deletion), but there's no supported path for, e.g., purging test fixtures or correcting an erroneously-created settlement record without restarting the process.

🧩 Requirements and context

  • Add remove(id: number): boolean to SettlementRepository, matching the return-true-if-existed convention already used by AnchorRepository.remove/LiquidityRepository.remove.
  • This is a repository-layer primitive only β€” do not wire it to a public route in this issue unless it's clearly gated as an administrative operation; if adding a route, require the configured API key and note the destructive nature in the endpoint's summary.

πŸ› οΈ Suggested execution

  • Add remove to src/repositories/settlementRepository.ts.
  • Add tests in src/repositories/settlementRepository.test.ts covering removal of an existing id, a non-existent id, and that count()/all() reflect the removal.
  • If a route is added, gate it behind apiKeyAuth (already true for all mutating routes when configured) and document the destructive/administrative nature explicitly in openapi.ts.

βœ… Acceptance criteria

  • SettlementRepository.remove(id) removes the settlement and returns true; returns false for an unknown id.
  • count() and all() correctly reflect removal.
  • New tests pass.

πŸ”’ Security notes

A destructive delete on financial-adjacent settlement records; if exposed via a route, it must not be reachable without the same protections as other mutating endpoints, and ideally requires an explicit acknowledgement that it bypasses the normal cancel/execute lifecycle.

πŸ“‹ Guidelines

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

Metadata

Metadata

Assignees

Labels

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

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions