Remove ensure_room/ensure_tracking from Protocol - tests prove not needed
Tests with SimpleRoomStorage and SimpleTrackingStorage (without ensure_*) show that add_bounty() and track_bounty() work fine without explicit ensure methods - they create rooms/tracking internally. This simplifies the Protocol to only essential methods.
This commit is contained in:
@@ -24,10 +24,6 @@ class RoomStorage(Protocol):
|
||||
"""Save all data for a room."""
|
||||
...
|
||||
|
||||
def ensure_room(self, room_id: int) -> RoomData:
|
||||
"""Ensure a room exists, creating it if necessary. Returns RoomData."""
|
||||
...
|
||||
|
||||
def add_bounty(self, room_id: int, bounty: Bounty) -> None:
|
||||
"""Add a new bounty to a room. Creates room if it doesn't exist."""
|
||||
...
|
||||
@@ -50,7 +46,6 @@ class TrackingStorage(Protocol):
|
||||
"""Storage port for tracking data.
|
||||
|
||||
Tracks which bounties a user is tracking in a specific room.
|
||||
Use ensure_tracking() to create a new tracking entry before tracking bounties.
|
||||
"""
|
||||
|
||||
def load(self, room_id: int, user_id: int) -> TrackingData | None:
|
||||
@@ -61,12 +56,8 @@ class TrackingStorage(Protocol):
|
||||
"""Save tracking data."""
|
||||
...
|
||||
|
||||
def ensure_tracking(self, room_id: int, user_id: int) -> TrackingData:
|
||||
"""Ensure tracking exists for user in room, creating if necessary. Returns TrackingData."""
|
||||
...
|
||||
|
||||
def track_bounty(self, room_id: int, user_id: int, tracked: TrackedBounty) -> None:
|
||||
"""Add a bounty to a user's tracking list. Creates tracking if needed."""
|
||||
"""Add a bounty to a user's tracking list. Creates tracking entry if needed."""
|
||||
...
|
||||
|
||||
def untrack_bounty(self, room_id: int, user_id: int, bounty_id: int) -> None:
|
||||
|
||||
Reference in New Issue
Block a user