2021-04-13 21:53:58 +02:00
|
|
|
import { Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common';
|
|
|
|
import { PrismaClient } from '@prisma/client';
|
|
|
|
|
|
|
|
@Injectable()
|
2021-04-25 12:07:32 +02:00
|
|
|
export class PrismaService
|
|
|
|
extends PrismaClient
|
2021-04-13 21:53:58 +02:00
|
|
|
implements OnModuleInit, OnModuleDestroy {
|
|
|
|
async onModuleInit() {
|
|
|
|
await this.$connect();
|
|
|
|
}
|
|
|
|
|
|
|
|
async onModuleDestroy() {
|
|
|
|
await this.$disconnect();
|
|
|
|
}
|
|
|
|
}
|