mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-24 22:27:46 -06:00
fix: Adjust in store files
This commit is contained in:
@@ -16,7 +16,11 @@ export class ChatRepository extends Repository {
|
||||
super(configService);
|
||||
}
|
||||
|
||||
public async insert(data: ChatRaw[], saveDb = false): Promise<IInsert> {
|
||||
public async insert(
|
||||
data: ChatRaw[],
|
||||
instanceName: string,
|
||||
saveDb = false,
|
||||
): Promise<IInsert> {
|
||||
if (data.length === 0) {
|
||||
return;
|
||||
}
|
||||
@@ -32,7 +36,7 @@ export class ChatRepository extends Repository {
|
||||
if (store.CHATS) {
|
||||
data.forEach((chat) => {
|
||||
this.writeStore<ChatRaw>({
|
||||
path: join(this.storePath, 'chats', chat.owner),
|
||||
path: join(this.storePath, 'chats', instanceName),
|
||||
fileName: chat.id,
|
||||
data: chat,
|
||||
});
|
||||
|
||||
@@ -16,7 +16,11 @@ export class ContactRepository extends Repository {
|
||||
super(configService);
|
||||
}
|
||||
|
||||
public async insert(data: ContactRaw[], saveDb = false): Promise<IInsert> {
|
||||
public async insert(
|
||||
data: ContactRaw[],
|
||||
instanceName: string,
|
||||
saveDb = false,
|
||||
): Promise<IInsert> {
|
||||
if (data.length === 0) {
|
||||
return;
|
||||
}
|
||||
@@ -32,7 +36,7 @@ export class ContactRepository extends Repository {
|
||||
if (store.CONTACTS) {
|
||||
data.forEach((contact) => {
|
||||
this.writeStore({
|
||||
path: join(this.storePath, 'contacts', contact.owner),
|
||||
path: join(this.storePath, 'contacts', instanceName),
|
||||
fileName: contact.id,
|
||||
data: contact,
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
}),
|
||||
|
||||
@@ -17,7 +17,11 @@ export class MessageUpRepository extends Repository {
|
||||
super(configService);
|
||||
}
|
||||
|
||||
public async insert(data: MessageUpdateRaw[], saveDb?: boolean): Promise<IInsert> {
|
||||
public async insert(
|
||||
data: MessageUpdateRaw[],
|
||||
instanceName: string,
|
||||
saveDb?: boolean,
|
||||
): Promise<IInsert> {
|
||||
if (data.length === 0) {
|
||||
return;
|
||||
}
|
||||
@@ -33,7 +37,7 @@ export class MessageUpRepository extends Repository {
|
||||
if (store.MESSAGE_UP) {
|
||||
data.forEach((update) => {
|
||||
this.writeStore<MessageUpdateRaw>({
|
||||
path: join(this.storePath, 'message-up', update.owner),
|
||||
path: join(this.storePath, 'message-up', instanceName),
|
||||
fileName: update.id,
|
||||
data: update,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user