dcb-service-core-api/src/shared/services/prisma.service.ts
Mamadou Khoussa [028918 DSI/DAC/DIF/DS] bde4f90235 first commit
2025-10-22 00:14:41 +00:00

21 lines
506 B
TypeScript

import { Injectable, OnModuleInit, OnModuleDestroy } from '@nestjs/common';
import { PrismaClient } from '@prisma/client';
@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
constructor() {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
super({
log: ['query', 'info', 'warn', 'error'],
});
}
async onModuleInit() {
await this.$connect();
}
async onModuleDestroy() {
await this.$disconnect();
}
}