mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-12 07:36:42 +08:00
91c3040db7
Co-authored-by: himself65 <himself65@outlook.com>
17 lines
441 B
TypeScript
17 lines
441 B
TypeScript
import type { INestApplication, OnModuleInit } from '@nestjs/common';
|
|
import { Injectable } 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();
|
|
});
|
|
}
|
|
}
|