13 lines
373 B
TypeScript
13 lines
373 B
TypeScript
import { Injectable, OnModuleInit, OnModuleDestroy } from '@nestjs/common';
|
|
import { PrismaClient } from '@prisma/client';
|
|
|
|
@Injectable()
|
|
export class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
|
|
constructor() {
|
|
super();
|
|
}
|
|
|
|
async onModuleInit() { await this.$connect(); }
|
|
async onModuleDestroy() { await this.$disconnect(); }
|
|
}
|