Mirror of https://github.com/roostorg/coop
github.com/roostorg/coop
1import { type ColumnType } from 'kysely';
2
3import {
4 type NotificationData,
5 type NotificationType,
6} from './notificationsService.js';
7
8export type NotificationsServicePg = {
9 // NB: In pg, we don't store all recipients from creation (for now),
10 // but we do store the user id.
11 // TODO: move this table to a dedicated schema.
12 notifications: {
13 id: string;
14 // NB: db does not enforce this beyond that it's a string,
15 // but we wanna make sure our writes do.
16 type: NotificationType;
17 message: string;
18 data: NotificationData<NotificationType>; // Ditto, db just checks this is json.
19 readAt: Date | null;
20 createdAt: ColumnType<Date, never, never>;
21 userId: string;
22 };
23};