fix: Adjust in store files

This commit is contained in:
Davidson Gomes
2023-07-07 15:55:33 -03:00
parent 5bd7dd3022
commit a7be7c3e19
10 changed files with 75 additions and 21 deletions

View File

@@ -17,7 +17,11 @@ export class MessageRepository extends Repository {
super(configService);
}
public async insert(data: MessageRaw[], saveDb = false): Promise<IInsert> {
public async insert(
data: MessageRaw[],
instanceName: string,
saveDb = false,
): Promise<IInsert> {
if (!Array.isArray(data) || data.length === 0) {
return;
}
@@ -52,7 +56,7 @@ export class MessageRepository extends Repository {
if (store.MESSAGES) {
data.forEach((msg) =>
this.writeStore<MessageRaw>({
path: join(this.storePath, 'messages', msg.owner),
path: join(this.storePath, 'messages', instanceName),
fileName: msg.key.id,
data: msg,
}),