14 lines
380 B
TypeScript
14 lines
380 B
TypeScript
import { Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common';
|
|
import { PrismaClient } from '@prisma/client';
|
|
|
|
@Injectable()
|
|
export class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
|
|
async onModuleInit(): Promise<void> {
|
|
await this.$connect();
|
|
}
|
|
|
|
async onModuleDestroy(): Promise<void> {
|
|
await this.$disconnect();
|
|
}
|
|
}
|