Fixing file name casing

This commit is contained in:
2024-10-12 23:15:06 +07:00
parent 5c40a2fd53
commit 0e3aa751ce
29 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
import {
ConsoleLogger,
INestApplication,
Injectable,
OnModuleInit,
} from '@nestjs/common';
import { PrismaClient } from '@prisma/client';
@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit {
private readonly logger = new ConsoleLogger(PrismaService.name);
constructor() {
super({
log: [
{
emit: 'stdout',
level: 'query',
},
{
emit: 'stdout',
level: 'error',
},
{
emit: 'event',
level: 'info',
},
{
emit: 'stdout',
level: 'warn',
},
],
});
}
async onModuleInit() {
this.logger.log('Try to connect database...');
await this.$connect();
this.logger.log('Connected.');
}
async enableShutdownHooks(app: INestApplication) {
this.$on('beforeExit' as never, async () => {
this.logger.log('Wait for application closing...');
await app.close();
});
}
}