orxtra v0.13.0 /services.src.orxtra.services._notifications
On this page

Caller-scoped notification delivery CRUD: list_deliveries() and acknowledge_delivery() enforce that a principal can only see or acknowledge its own NotificationPort deliveries.

#services.src.orxtra.services._notifications

#services.src.orxtra.services._notifications

Notification CRUD service functions.

Thin wrappers over NotificationPort that enforce caller scoping: a caller can only list and acknowledge their own deliveries.

#list_deliveries

python
async def list_deliveries(notification_port: NotificationPort, caller_principal: Principal, *, unacknowledged_only: bool=True, cursor: UUID | None=None, limit: int=50) -> list[NotificationDelivery]

List deliveries for the authenticated caller's principal.

The caller can ONLY list their own deliveries -- the principal is derived from the authenticated context, not a user-supplied parameter.

#acknowledge_delivery

python
async def acknowledge_delivery(notification_port: NotificationPort, caller_principal: Principal, *, delivery_id: UUID) -> None

Acknowledge a delivery, enforcing ownership.

Fetches the delivery first (via a single-item list query) and compares the target_principal_id against the caller. If the delivery does not belong to the caller, a hard error is raised.

Search