import { RepositoriesHealthIndicatorUseCase } from '@modules/health/core/application/usecases/repositories.health-indicator.usecase'; import { Controller, Get } from '@nestjs/common'; import { HealthCheckService, HealthCheck, HealthCheckResult, } from '@nestjs/terminus'; @Controller('health') export class HealthHttpController { constructor( private readonly repositoriesHealthIndicatorUseCase: RepositoriesHealthIndicatorUseCase, private readonly healthCheckService: HealthCheckService, ) {} @Get() @HealthCheck() async check(): Promise { try { return await this.healthCheckService.check([ async () => this.repositoriesHealthIndicatorUseCase.isHealthy('repositories'), ]); } catch (error) { throw error; } } }