mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
|
|
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
|