Now in the manager, when logging in with the client's apikey, the listing only shows the instance corresponding to the provided apikey (only with MongoDB)

This commit is contained in:
Davidson Gomes
2024-05-23 11:30:47 -03:00
parent 395b81a6ac
commit 2fcb476c50
5 changed files with 59 additions and 13 deletions

View File

@@ -83,7 +83,7 @@ export class WAMonitoringService {
}
}
public async instanceInfo(instanceName?: string) {
public async instanceInfo(instanceName?: string, arrayReturn = false) {
this.logger.verbose('get instance info');
if (instanceName && !this.waInstances[instanceName]) {
throw new NotFoundException(`Instance "${instanceName}" not found`);
@@ -171,6 +171,9 @@ export class WAMonitoringService {
this.logger.verbose('return instance info: ' + instances.length);
if (arrayReturn) {
return [instances.find((i) => i.instance.instanceName === instanceName) ?? instances];
}
return instances.find((i) => i.instance.instanceName === instanceName) ?? instances;
}