Files
hoppscotch/packages/hoppscotch-backend/src/prisma/prisma.service.ts
2022-12-13 16:10:58 +05:30

20 lines
417 B
TypeScript

import { Injectable, OnModuleInit, OnModuleDestroy } from '@nestjs/common';
import { PrismaClient } from 'prisma/prisma-client/scripts/default-index';
@Injectable()
export class PrismaService
extends PrismaClient
implements OnModuleInit, OnModuleDestroy
{
constructor() {
super();
}
async onModuleInit() {
await this.$connect();
}
async onModuleDestroy() {
await this.$disconnect();
}
}