Add Notification Backend Protocol #24

Merged
A8065384 merged 5 commits from notification-protocol into main 2026-03-09 07:36:48 +00:00
Showing only changes of commit 9ce472f2ca - Show all commits

View File

@@ -16,9 +16,7 @@ logger = logging.getLogger(__name__)
class NotificationBackend(Protocol):
"""Backend-agnostic interface for notification storage."""
async def get_recent_notifications(
self, phone_number: str
) -> list[dict[str, Any]]:
async def get_recent_notifications(self, phone_number: str) -> list[dict[str, Any]]:
"""Return recent notifications for *phone_number*."""
...
@@ -51,9 +49,7 @@ class FirestoreNotificationBackend:
self._max_to_notify = max_to_notify
self._window_hours = window_hours
async def get_recent_notifications(
self, phone_number: str
) -> list[dict[str, Any]]:
async def get_recent_notifications(self, phone_number: str) -> list[dict[str, Any]]:
"""Get recent notifications for a user.
Retrieves notifications created within the configured time window,
@@ -159,9 +155,7 @@ class RedisNotificationBackend:
self._max_to_notify = max_to_notify
self._window_hours = window_hours
async def get_recent_notifications(
self, phone_number: str
) -> list[dict[str, Any]]:
async def get_recent_notifications(self, phone_number: str) -> list[dict[str, Any]]:
"""Get recent notifications for a user from Redis.
Reads from the ``notification:{phone}`` key, parses the JSON