import { Injectable } from '@nestjs/common'; import { HealthCheckError, HealthIndicator, type HealthIndicatorResult } from '@nestjs/terminus'; import { PrismaService } from '@modules/shared'; @Injectable() export class PrismaHealthIndicator extends HealthIndicator { constructor(private readonly prisma: PrismaService) { super(); } async isHealthy(key: string): Promise { try { await this.prisma.$queryRawUnsafe('SELECT 1'); return this.getStatus(key, true); } catch { throw new HealthCheckError('Database check failed', this.getStatus(key, false)); } } }