Something went wrong. Try again.
because I got bored of customising my CV for every job
Something went wrong. Try again.
TypeScript
12345678910111213141516171819202122232425262728293031import { Injectable, type OnModuleDestroy, type OnModuleInit,} from "@nestjs/common";import { ConfigService } from "@nestjs/config";import { PrismaPg } from "@prisma/adapter-pg";import { PrismaClient } from "@prisma/client";import { Pool } from "pg";
@Injectable()export class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy{ constructor(private readonly configService: ConfigService) { const connectionString = configService.getOrThrow<string>("DATABASE_URL"); const pool = new Pool({ connectionString }); const adapter = new PrismaPg(pool); super({ adapter }); }
async onModuleInit() { await this["$connect"](); }
async onModuleDestroy() { await this["$disconnect"](); }}