From f7d0a00adea0a0a5d8cc9720262cfd3311f36cb0 Mon Sep 17 00:00:00 2001 From: muhammadhasanz Date: Tue, 13 Aug 2024 09:51:29 +0800 Subject: [PATCH] refactor(infrastructure): Registering mysql heath check --- src/core/modules/health/useCases/health/HealthController.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/modules/health/useCases/health/HealthController.ts b/src/core/modules/health/useCases/health/HealthController.ts index e75e302..f9cdfa2 100644 --- a/src/core/modules/health/useCases/health/HealthController.ts +++ b/src/core/modules/health/useCases/health/HealthController.ts @@ -4,6 +4,7 @@ import { MongooseHealthIndicator } from '../healthIndicator/database/mongooseHea import { RabbitmqHealthIndicator } from '../healthIndicator/message-broker/rabbitmqHealthIndicator'; import { Controller } from '@/core/infrastructure/Controller'; import { Container, Service } from '@/core/infrastructure/Container'; +import { SequelizeHealthIndicator } from '../healthIndicator/database/sequelizeHealthIndicator'; @Service() export default class HealthController extends Controller { @@ -11,6 +12,7 @@ export default class HealthController extends Controller { private readonly health: HealthCheck, private readonly mongoose: MongooseHealthIndicator, private readonly rabbitmq: RabbitmqHealthIndicator, + private readonly sequelize: SequelizeHealthIndicator, ) { super(); } @@ -38,6 +40,10 @@ export default class HealthController extends Controller { services.push(async () => this.mongoose.pingCheck('mongo')); } + if (health?.mysql) { + services.push(async () => this.sequelize.pingCheck('mysql')); + } + return services; } }