matcher/old/modules/database/adapters/secondaries/prisma.service.ts

16 lines
403 B
TypeScript
Raw Normal View History

2023-04-06 09:12:49 +00:00
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();
});
}
}