import { Dexie } from 'Dexie'; import { DexieMessageTable, messageTableColumn, MessageTable } from './schema/message'; import { DexieMembersTableSchema, MemberTableColumn } from './schema/members'; import { DexieRoomsTable, RoomTableColumn } from './schema/room'; import { DexieTypingsTable, TypingTableColumn } from './schema/typing'; import { MessageEntity } from '../../../domain/entity/message'; import { AttachmentTable, AttachmentTableColumn, DexieAttachmentsTableSchema } from './schema/attachment'; // import DexieMemory from 'dexie-in-memory'; // Database declaration (move this to its own module also) export const chatDatabase = new Dexie('chat-database-infra') as Dexie & { message: DexieMessageTable, members: DexieMembersTableSchema, room: DexieRoomsTable, typing: DexieTypingsTable, attachment: DexieAttachmentsTableSchema, }; chatDatabase.version(1).stores({ message: messageTableColumn, members: MemberTableColumn, room: RoomTableColumn, typing: TypingTableColumn, attachment: AttachmentTableColumn }); chatDatabase.message.mapToClass(MessageEntity) // Apply in-memory storage