mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-22 20:12:02 -06:00
fix: include instance Id field in the instance configuration
This commit is contained in:
parent
2d6a29664a
commit
da796347c4
@ -5,7 +5,6 @@ import { Auth, ConfigService } from '../../config/env.config';
|
||||
import { Logger } from '../../config/logger.config';
|
||||
import { AUTH_DIR } from '../../config/path.config';
|
||||
import { IInsert, Repository } from '../abstract/abstract.repository';
|
||||
import { InstanceDto } from '../dto/instance.dto';
|
||||
import { AuthRaw, IAuthModel } from '../models';
|
||||
|
||||
export class AuthRepository extends Repository {
|
||||
@ -65,7 +64,7 @@ export class AuthRepository extends Repository {
|
||||
}
|
||||
}
|
||||
|
||||
public async findInstanceNameById(instanceId: string): Promise<string> {
|
||||
public async findInstanceNameById(instanceId: string): Promise<string | null> {
|
||||
try {
|
||||
this.logger.verbose('finding auth by instanceId');
|
||||
if (this.dbSettings.ENABLED) {
|
||||
@ -77,7 +76,7 @@ export class AuthRepository extends Repository {
|
||||
|
||||
this.logger.verbose('finding auth in store is not supported');
|
||||
} catch (error) {
|
||||
return '';
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -162,6 +162,10 @@ export class WAMonitoringService {
|
||||
public async instanceInfoById(instanceId?: string) {
|
||||
this.logger.verbose('get instance info');
|
||||
const instanceName = await this.repository.auth.findInstanceNameById(instanceId);
|
||||
if (!instanceName) {
|
||||
throw new NotFoundException(`Instance "${instanceId}" not found`);
|
||||
}
|
||||
|
||||
if (instanceName && !this.waInstances[instanceName]) {
|
||||
throw new NotFoundException(`Instance "${instanceName}" not found`);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user