notifications.dto
dto
codex_platform.notifications.dto
Notification payload contracts.
Three classes:
NotificationPayloadDTO — base, always required fields TemplateNotificationDTO — Mode 1: workers fetches context from Redis, renders template RenderedNotificationDTO — Mode 2: pre-rendered HTML (e.g. from Django)
Classes
NotificationRecipient
Bases: BaseDTO
Recipient info. PII fields auto-masked in repr via BaseDTO.
Source code in src/codex_platform/notifications/dto.py
NotificationPayloadDTO
Bases: BaseDTO
Base notification payload — identification and routing only.
Do not use directly. Use TemplateNotificationDTO or RenderedNotificationDTO.
Source code in src/codex_platform/notifications/dto.py
TemplateNotificationDTO
Bases: NotificationPayloadDTO
Mode 1 — Worker renders the template itself (requires Jinja2).
Redis key where context_data is stored (JSON).
Allows updating data after enqueue (e.g. reschedule).
template_name: Relative template path (e.g. 'booking/bk_confirmation.html').
Source code in src/codex_platform/notifications/dto.py
RenderedNotificationDTO
Bases: NotificationPayloadDTO
Mode 2 — Pre-rendered HTML passed directly to the workers.
Use when Django (or another layer) renders the template and the workers only needs to deliver.