import { Injectable } from '@nestjs/common'; import { HealthCheckError, HealthIndicator, HealthIndicatorResult, } from '@nestjs/terminus'; import { UsersRepository } from '../../../user/adapters/secondaries/users.repository'; @Injectable() export class PrismaHealthIndicatorUseCase extends HealthIndicator { constructor(private readonly repository: UsersRepository) { super(); } isHealthy = async (key: string): Promise => { try { await this.repository.healthCheck(); return this.getStatus(key, true); } catch (e) { throw new HealthCheckError('Prisma', { prisma: e.message, }); } }; }