Resolve notification worker items to tenants
This commit is contained in:
@@ -12,6 +12,17 @@ class SqlNotificationDispatchProvider(NotificationDispatchProvider):
|
||||
self._settings = context.settings
|
||||
self._registry = context.registry
|
||||
|
||||
def tenant_id_for_notification(
|
||||
self,
|
||||
session: object,
|
||||
*,
|
||||
notification_id: str,
|
||||
) -> str | None:
|
||||
from govoplan_notifications.backend.db.models import NotificationMessage
|
||||
|
||||
notification = session.get(NotificationMessage, notification_id) # type: ignore[attr-defined]
|
||||
return notification.tenant_id if notification is not None else None
|
||||
|
||||
def enqueue_notification(
|
||||
self,
|
||||
session: object,
|
||||
|
||||
Reference in New Issue
Block a user