2024-08-13 10:52:35 +01:00
|
|
|
import { z } from "zod";
|
|
|
|
|
import { EntityTable } from 'Dexie';
|
2024-08-13 17:05:46 +01:00
|
|
|
import { zodDataUrlSchema } from "src/app/utils/zod";
|
2024-08-13 10:52:35 +01:00
|
|
|
|
|
|
|
|
export const AttachmentTableSchema = z.object({
|
2024-08-13 17:05:46 +01:00
|
|
|
id: z.string().optional(), // attachment id
|
|
|
|
|
$id: z.number().optional(), // local id
|
|
|
|
|
$messageId: z.number(),
|
|
|
|
|
attachmentId: z.string().optional(),
|
|
|
|
|
file: zodDataUrlSchema,
|
2024-08-13 10:52:35 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export type AttachmentTable = z.infer<typeof AttachmentTableSchema>
|
|
|
|
|
export type DexieAttachmentsTableSchema = EntityTable<AttachmentTable, '$id'>;
|
2024-08-13 17:05:46 +01:00
|
|
|
export const AttachmentTableColumn = '++$id, id, $messageId, messageId, file'
|