
import { INestApplication, Injectable, OnModuleInit } from '@nestjs/common';
import { PrismaClient } from '@prisma/client'

@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit {
  // constructor() {
  //   super({
  //     log: ["error", "info", "query", "warn"],
  //     // log: ["query"],
  //   });
  // }
  async onModuleInit() {
    await this.$connect();
  }

  // https://github.com/prisma/prisma/issues/20171#issuecomment-1632599621
  // async enableShutdownHooks(app: INestApplication) {
  //   this.$on('beforeExit', async () => {
  //     await app.close();
  //   });
  // }
}
