Skip to content

feat: add remove method to SettlementRepository#199

Open
Agencybuilds wants to merge 1 commit into
AnchorNet-Org:mainfrom
Agencybuilds:feat/settlement-repository-remove
Open

feat: add remove method to SettlementRepository#199
Agencybuilds wants to merge 1 commit into
AnchorNet-Org:mainfrom
Agencybuilds:feat/settlement-repository-remove

Conversation

@Agencybuilds

Copy link
Copy Markdown

Closes #163

Description

This PR introduces the remove(id: number): boolean method to the SettlementRepository. Prior to this change, SettlementRepository only supported create and save, leaving no way to completely remove a settlement record.

This brings it into parity with the remove method already present in AnchorRepository and LiquidityRepository. This is a repository-layer primitive only and is not wired to any public route to maintain security.

Changes Made

  • src/repositories/settlementRepository.ts: Added the remove method. It deletes the record from the in-memory store and effectively manages the anchorIndex mapping to avoid leaving stale index entries.
  • src/repositories/settlementRepository.test.ts: Added unit tests to ensure that:
    • Removing an existing settlement succeeds, returns true, and correctly updates the repo count, list, and the anchor mapping index.
    • Removing a non-existent settlement safely returns false and doesn't affect the repository.

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.
  • Minimum 95% test coverage.

Security Notes

The remove function acts solely as an underlying repository primitive to allow for test fixture cleanup or administrative overrides. By design, no API endpoint was added to expose this functionality, meaning the usual cancel and execute process remains the standard operational flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant