refactor private property in health module

This commit is contained in:
sbriat 2023-06-29 10:24:42 +02:00
parent d9fc46513d
commit 9728ed69ab
1 changed files with 3 additions and 3 deletions

View File

@ -14,7 +14,7 @@ import { MessagePublisherPort } from '@libs/ports/message-publisher.port';
@Injectable() @Injectable()
export class RepositoriesHealthIndicatorUseCase extends HealthIndicator { export class RepositoriesHealthIndicatorUseCase extends HealthIndicator {
private checkRepositories: CheckRepositoryPort[]; private _checkRepositories: CheckRepositoryPort[];
constructor( constructor(
@Inject(AD_REPOSITORY) @Inject(AD_REPOSITORY)
private readonly adRepository: AdRepositoryPort, private readonly adRepository: AdRepositoryPort,
@ -22,12 +22,12 @@ export class RepositoriesHealthIndicatorUseCase extends HealthIndicator {
private readonly messagePublisher: MessagePublisherPort, private readonly messagePublisher: MessagePublisherPort,
) { ) {
super(); super();
this.checkRepositories = [adRepository]; this._checkRepositories = [adRepository];
} }
isHealthy = async (key: string): Promise<HealthIndicatorResult> => { isHealthy = async (key: string): Promise<HealthIndicatorResult> => {
try { try {
await Promise.all( await Promise.all(
this.checkRepositories.map( this._checkRepositories.map(
async (checkRepository: CheckRepositoryPort) => { async (checkRepository: CheckRepositoryPort) => {
await checkRepository.healthCheck(); await checkRepository.healthCheck();
}, },