eletrotupi / tcc/ api/src/lib/serializers/notification.ts1b8d5d79f03d61a20e683b0da33bbd8abe43bf86
603 B | 19 lines Raw
1
import { Prisma } from '@prisma/client';
2

3
// DB-level projection of what a notification leaves the API as -- the inbox
4
// needs the rendered text, the moment it was meant for, its window and what it
5
// relates to. The owning user and the delivery timestamp stay server-side.
6
export const publicNotificationSelect = {
7
  id: true,
8
  kind: true,
9
  title: true,
10
  body: true,
11
  scheduledFor: true,
12
  expiresAt: true,
13
  regimenId: true,
14
  createdAt: true,
15
} satisfies Prisma.NotificationSelect;
16

17
export type PublicNotification = Prisma.NotificationGetPayload<{
18
  select: typeof publicNotificationSelect;
19
}>;