Turns the rows of notifications, once checked, into the Notification that GET /api/me/notifications answers.
f
isNotificationRow(obj: unknown): obj is NotificationRow
Checks whether obj, a row getNotificationsForUser selected, is a
NotificationRow.
f
notificationRowToApi(row: NotificationRow): Notification
Converts a row to the Notification the client gets.
I
NotificationRow
Stored by the triggers of notification-service.ts, and read back by
getNotificationsForUser.
- created_at: string
-
data: string
The NotificationData as JSON, not checked by the guard.
- id: string
-
read: number
0 or 1.
-
source_key: string | null
Names the event that caused the notification. A unique index keeps a second row with the same
(user_id, source_key)out; null allows duplicates. -
type: string
A NotificationType, not checked by the guard.
- user_id: string
Usage
import * as mod from "api/model/notification.ts";