import { Injectable, OnModuleDestroy } from '@nestjs/common'; import { PrismaClient } from '@prisma/client'; /** * PrismaClient as a Nest provider. Connections are opened lazily on first * query (Prisma default), so the application can boot — and report an * unready state via /readyz — while the database is still starting up. */ @Injectable() export class PrismaService extends PrismaClient implements OnModuleDestroy { async onModuleDestroy(): Promise { await this.$disconnect(); } }