mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-25 18:08:40 -06:00
fix: fetch instances
This commit is contained in:
parent
fce3e55e91
commit
23640a71b8
@ -382,7 +382,9 @@ export class InstanceController {
|
|||||||
return this.waMonitor.instanceInfoById(instanceId, number);
|
return this.waMonitor.instanceInfoById(instanceId, number);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.waMonitor.instanceInfo([instanceName]);
|
const instanceNames = instanceName ? [instanceName] : null;
|
||||||
|
|
||||||
|
return this.waMonitor.instanceInfo(instanceNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async setPresence({ instanceName }: InstanceDto, data: SetPresenceDto) {
|
public async setPresence({ instanceName }: InstanceDto, data: SetPresenceDto) {
|
||||||
|
@ -1762,7 +1762,8 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
website: business?.website?.shift(),
|
website: business?.website?.shift(),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
const info: Instance = await waMonitor.instanceInfo([instanceName]);
|
const instanceNames = instanceName ? [instanceName] : null;
|
||||||
|
const info: Instance = await waMonitor.instanceInfo(instanceNames);
|
||||||
const business = await this.fetchBusinessProfile(jid);
|
const business = await this.fetchBusinessProfile(jid);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -60,6 +60,7 @@ export class WAMonitoringService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async instanceInfo(instanceNames?: string[]): Promise<any> {
|
public async instanceInfo(instanceNames?: string[]): Promise<any> {
|
||||||
|
if (instanceNames && instanceNames.length > 0) {
|
||||||
const inexistentInstances = instanceNames ? instanceNames.filter((instance) => !this.waInstances[instance]) : [];
|
const inexistentInstances = instanceNames ? instanceNames.filter((instance) => !this.waInstances[instance]) : [];
|
||||||
|
|
||||||
if (inexistentInstances.length > 0) {
|
if (inexistentInstances.length > 0) {
|
||||||
@ -67,10 +68,11 @@ export class WAMonitoringService {
|
|||||||
`Instance${inexistentInstances.length > 1 ? 's' : ''} "${inexistentInstances.join(', ')}" not found`,
|
`Instance${inexistentInstances.length > 1 ? 's' : ''} "${inexistentInstances.join(', ')}" not found`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const clientName = this.configService.get<Database>('DATABASE').CONNECTION.CLIENT_NAME;
|
const clientName = this.configService.get<Database>('DATABASE').CONNECTION.CLIENT_NAME;
|
||||||
|
|
||||||
const where = instanceNames
|
const where = instanceNames && instanceNames.length > 0
|
||||||
? {
|
? {
|
||||||
name: {
|
name: {
|
||||||
in: instanceNames,
|
in: instanceNames,
|
||||||
@ -123,7 +125,9 @@ export class WAMonitoringService {
|
|||||||
throw new NotFoundException(`Instance "${instanceName}" not found`);
|
throw new NotFoundException(`Instance "${instanceName}" not found`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.instanceInfo([instanceName]);
|
const instanceNames = instanceName ? [instanceName] : null;
|
||||||
|
|
||||||
|
return this.instanceInfo(instanceNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async cleaningUp(instanceName: string) {
|
public async cleaningUp(instanceName: string) {
|
||||||
|
Loading…
Reference in New Issue
Block a user