import { Injectable, OnModuleInit, OnModuleDestroy } from '@nestjs/common'; import { adapterPostgres } from 'prisma.config.postgres'; import { PrismaClient } from 'prisma/postgres/generated/prisma/client/postgres/client'; @Injectable() export class PrismaPostgresService extends PrismaClient implements OnModuleInit, OnModuleDestroy { readonly client: PrismaClient; constructor() { super({ adapter: adapterPostgres }) } async onModuleInit() { await this.$connect(); } async onModuleDestroy() { await this.$disconnect(); } } export type TransactionClient = Parameters[0]>[0];