import { Injectable, OnModuleInit } from '@nestjs/common'; import { PrismaClient } from '@prisma/client'; @Injectable() export class PrismaService extends PrismaClient implements OnModuleInit { constructor() { super({ log: [ { emit: 'event', level: 'query', }, ], }); } async onModuleInit() { await this.$connect(); } } @Injectable() export class PrismaRepository { public model: Pick; constructor(private _prismaService: PrismaService) { this.model = this._prismaService; } }