Notification API
Catalog: /apis/notification-api
Subscribes to NATS JetStream events, queues delivery jobs via Redis-backed Asynq workers, and dispatches multi-channel outputs (Email via Google SMTP on ports 587/465, Push via Firebase Cloud Messaging). Tracks token validity and opt-ins.
Endpoints Reference
Complete list of GraphQL mutations, queries, gRPC procedures, and HTTP routes for this module.
registerDeviceToken(token: String!, platform: String!, deviceName: String)
Saves an FCM registration token for mobile push notifications.
mutation { registerDeviceToken(token: "fcm_token_12345", platform: "android", deviceName: "Pixel 8") }
{ "data": { "registerDeviceToken": true } }
updateNotificationPreferences(category: NotificationCategory!, emailEnabled: Boolean!, pushEnabled: Boolean!)
Configures user preferences for Transactional, Security, Low Stock, Follows, or Marketing notifications.
mutation { updateNotificationPreferences(category: TRANSACTIONAL, emailEnabled: true, pushEnabled: true) { category emailEnabled pushEnabled } }
{ "data": { "updateNotificationPreferences": { "category": "TRANSACTIONAL", "emailEnabled": true, "pushEnabled": true } } }
Database Tables & Data Models
Relational database schemas and custom payload models governing this service domain.
📂 user_device_tokens (PostgreSQL)
Valid Firebase FCM registration tokens associated with user accounts.
| Field Name | Data Type | Description / Constraint |
|---|---|---|
| id | UUID (Primary Key) | Unique token line identifier. |
| user_id | UUID | Associated recipient user identifier. |
| token | TEXT (Unique) | Firebase registration token string. |
| platform | VARCHAR(20) | Target OS platform: 'ios' | 'android' | 'web'. |
📂 user_notification_preferences (PostgreSQL)
Opt-in / opt-out preferences governing message channels.
| Field Name | Data Type | Description / Constraint |
|---|---|---|
| user_id | UUID | Target user reference identifier. |
| category | VARCHAR(30) | Notification category: 'transactional' | 'security' | 'low_stock' | 'follows' | 'marketing'. |
| email_enabled / push_enabled | BOOLEAN | Channel transmission permissions. |