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-17 22:05:57 +01:00
|
|
|
import { MessageAttachmentFileType, MessageAttachmentSource } from "src/app/module/chat/data/dto/message/messageOutputDTO";
|
2024-08-13 10:52:35 +01:00
|
|
|
|
|
|
|
|
export const AttachmentTableSchema = z.object({
|
2024-08-13 17:05:46 +01:00
|
|
|
$id: z.number().optional(), // local id
|
|
|
|
|
$messageId: z.number(),
|
|
|
|
|
attachmentId: z.string().optional(),
|
|
|
|
|
file: zodDataUrlSchema,
|
2024-08-17 22:05:57 +01:00
|
|
|
//
|
|
|
|
|
fileType: z.nativeEnum(MessageAttachmentFileType),
|
|
|
|
|
source: z.nativeEnum(MessageAttachmentSource),
|
|
|
|
|
fileName: z.string().optional(),
|
|
|
|
|
applicationId: z.number().optional(),
|
|
|
|
|
docId: z.string().optional(),
|
|
|
|
|
mimeType: z.string().optional(),
|
|
|
|
|
id: z.string().optional(),
|
|
|
|
|
description: z.string().optional(),
|
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'
|