Prisma implementation...

This commit is contained in:
2022-09-08 13:24:07 +02:00
parent cd28031637
commit 6f5cc1642a
11 changed files with 69 additions and 43 deletions

View File

@@ -0,0 +1,15 @@
import { INestApplication, Injectable, OnModuleInit } from '@nestjs/common';
import { PrismaClient } from '@prisma/client';
@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit {
async onModuleInit() {
await this.$connect();
}
async enableShutdownHooks(app: INestApplication) {
this.$on('beforeExit', async () => {
await app.close();
});
}
}