mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-22 13:22:21 -06:00
fix: include instance Id field in the instance configuration
This commit is contained in:
@@ -5,6 +5,7 @@ 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 {
|
||||
@@ -63,4 +64,20 @@ export class AuthRepository extends Repository {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
public async findInstanceNameById(instanceId: string): Promise<string> {
|
||||
try {
|
||||
this.logger.verbose('finding auth by instanceId');
|
||||
if (this.dbSettings.ENABLED) {
|
||||
this.logger.verbose('finding auth in db');
|
||||
const response = await this.authModel.findOne({ instanceId });
|
||||
|
||||
return response._id;
|
||||
}
|
||||
|
||||
this.logger.verbose('finding auth in store is not supported');
|
||||
} catch (error) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user