2024-06-27 16:53:45 +01:00
|
|
|
import { Dexie, EntityTable, liveQuery } from 'Dexie';
|
|
|
|
|
import { z } from 'zod';
|
|
|
|
|
|
|
|
|
|
export const NotificationTableSchema = z.object({
|
|
|
|
|
notificationId: z.string().nullable(),
|
|
|
|
|
title: z.string().optional().nullable(),
|
|
|
|
|
service: z.string().nullable(),
|
|
|
|
|
object: z.string().optional().nullable(),
|
|
|
|
|
idObject: z.string().nullable(),
|
|
|
|
|
folderId: z.string().optional().nullable(),
|
|
|
|
|
dateInit: z.string().optional().nullable(),
|
|
|
|
|
dateEnd: z.string().optional().nullable(),
|
|
|
|
|
location: z.string().optional().nullable(),
|
|
|
|
|
status: z.boolean().optional(),
|
|
|
|
|
})
|
|
|
|
|
export type NotificationTable = z.infer<typeof NotificationTableSchema>
|
|
|
|
|
|
|
|
|
|
// Database declaration (move this to its own module also)
|
|
|
|
|
export const NotificationDataSource = new Dexie('NotificationDataSource') as Dexie & {
|
|
|
|
|
notification: EntityTable<NotificationTable, 'notificationId'>;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NotificationDataSource.version(1).stores({
|
2024-06-28 07:44:43 +01:00
|
|
|
notification: 'notificationId, title, service, object, idObject, folderId, dateInit, dateEnd, location, createdAt, status'
|
2024-06-27 16:53:45 +01:00
|
|
|
});
|