change storage package to beast-rom

This commit is contained in:
Peter Maquiran
2022-03-10 23:08:29 +01:00
parent f3aabae9c7
commit c2b1a54a6e
18 changed files with 256 additions and 185 deletions
+45
View File
@@ -0,0 +1,45 @@
import { models } from 'beast-orm'
import { AESEncrypt } from '../services/aesencrypt.service'
const _AESEncrypt = new AESEncrypt()
export class MessageModel extends models.Model {
channels = models.IndDbJsonField()
mentions = models.IndDbJsonField()
msg = models.CharField()
rid = models.CharField()
ts = models.CharField()
u = models.IndDbJsonField()
_id = models.CharField({unique:true})
_updatedAt = models.CharField()
messageSend = models.BooleanField()
offline = models.BooleanField()
viewed = models.IndDbJsonField()
received = models.IndDbJsonField()
localReference = models.CharField({blank:true})
attachments = models.IndDbJsonField()
file = models.IndDbJsonField()
}
export class DeleteMessageModel extends models.Model {
messageId = models.IntegerField()
rid = models.CharField()
ts = models.CharField()
u = models.IndDbJsonField()
_id = models.CharField({unique:true})
receivedBy = models.IndDbJsonField()
}
models.register({
databaseName: 'chat-storage',
type: 'indexeddb',
version: 1,
models: [MessageModel, DeleteMessageModel]
})
+1
View File
@@ -67,6 +67,7 @@ interface FirstUnread {
export interface Message {
customFields:any;
_id: string;
id: null | string;
rid: string;
msg: string;
ts: Ts;
+46 -4
View File
@@ -1,4 +1,46 @@
export interface Message {
author: string;
message: string;
}
export interface IncomingChatMessage {
msg: string;
collection: string;
id: string;
fields: {
args: {
_id: string;
rid: string;
localReference: string;
msg: string;
file?: any;
ts: {
$date: number;
};
u: {
_id: string;
username: string;
name: string;
};
_updatedAt: {
$date: number;
};
mentions: any[];
channels: any[];
} [];
}
eventName: string;
};
export interface ChatMessageInterface {
_id: string;
rid: string;
localReference: string;
msg: string;
file?: any;
ts: number;
u: {
_id: string;
username: string;
name: string;
};
_updatedAt: number;
mentions: any[];
channels: any[];
};