Background
Notification APIs assume that created, notification_type, priority, block_timestamp, is_read, is_flagged, is_deleted, metainfo, and address are present for active records, but the ORM model still allows None for several of these fields. As a result, the router keeps type-checking assertions and response-specific guard code.
Description
Audit existing notification rows, decide which fields must be required for persisted notifications, and enforce those guarantees in the database schema and ORM typing. After that, simplify notification serialization and update endpoints so they no longer rely on repeated null checks or TYPE_CHECKING-only assertions to satisfy the response contract.
Scope
- Add migration and backfill logic for the notification fields that should be non-null.
- Update the Notification ORM model and response typing.
- Remove redundant assertions in notification list and update endpoints.
- Verify JSON serialization for block_timestamp, deleted_at, and metainfo.
- Add or update tests for notification listing, counting, and update flows.
Background
Notification APIs assume that created, notification_type, priority, block_timestamp, is_read, is_flagged, is_deleted, metainfo, and address are present for active records, but the ORM model still allows None for several of these fields. As a result, the router keeps type-checking assertions and response-specific guard code.
Description
Audit existing notification rows, decide which fields must be required for persisted notifications, and enforce those guarantees in the database schema and ORM typing. After that, simplify notification serialization and update endpoints so they no longer rely on repeated null checks or TYPE_CHECKING-only assertions to satisfy the response contract.
Scope