feat: add list_bounties and list_all_bounties methods to storage adapter
Add filtering methods to JsonFileRoomStorage for Phase 2 soft delete support: - list_bounties(room_id): returns only non-deleted bounties for normal queries - list_all_bounties(room_id, include_deleted=True): returns all bounties for /recover Update RoomStorage protocol to include the new methods. Update mock classes in tests to pass isinstance checks. Fixes #42
This commit is contained in:
@@ -40,6 +40,25 @@ class RoomStorage(Protocol):
|
||||
"""Get a specific bounty from a room by ID."""
|
||||
...
|
||||
|
||||
def list_bounties(self, room_id: int) -> list[Bounty]:
|
||||
"""List all non-deleted bounties in a room.
|
||||
|
||||
Soft-deleted bounties (where deleted_at is not None) are excluded.
|
||||
"""
|
||||
...
|
||||
|
||||
def list_all_bounties(
|
||||
self, room_id: int, include_deleted: bool = True
|
||||
) -> list[Bounty]:
|
||||
"""List all bounties including or excluding soft-deleted.
|
||||
|
||||
Args:
|
||||
room_id: The room ID
|
||||
include_deleted: If True, return all bounties including soft-deleted.
|
||||
If False, return only non-deleted bounties.
|
||||
"""
|
||||
...
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class TrackingStorage(Protocol):
|
||||
|
||||
Reference in New Issue
Block a user