@@ -43,9 +43,14 @@ export class Query<T> {
4343
4444import { Prisma , PrismaClient , Webhook } from '@prisma/client' ;
4545import { WebhookEvents } from '../whatsapp/dto/webhook.dto' ;
46- import { BadRequestException , NotFoundException } from '../exceptions' ;
46+ import {
47+ BadRequestException ,
48+ InternalServerErrorException ,
49+ NotFoundException ,
50+ } from '../exceptions' ;
4751import { Logger } from '../config/logger.config' ;
4852import { ConfigService , Database } from '../config/env.config' ;
53+ import { PrismaPg } from '@prisma/adapter-pg' ;
4954
5055type CreateLogs = {
5156 context : string ;
@@ -56,7 +61,16 @@ type CreateLogs = {
5661
5762export class Repository extends PrismaClient {
5863 constructor ( private readonly configService : ConfigService ) {
59- super ( ) ;
64+ super ( {
65+ adapter : new PrismaPg (
66+ { connectionString : process . env . DATABASE_URL } ,
67+ {
68+ onConnectionError ( err ) {
69+ throw new InternalServerErrorException ( err ) ;
70+ } ,
71+ } ,
72+ ) ,
73+ } ) ;
6074 }
6175
6276 private readonly logger = new Logger ( this . configService , Repository . name ) ;
@@ -94,7 +108,7 @@ export class Repository extends PrismaClient {
94108 }
95109
96110 const k = `ARRAY['${ key } ']` ;
97- const v = `to_jsonb(${ value } ::boolean)` ;
111+ const v = `to_jsonb(${ value as string } ::boolean)` ;
98112
99113 await this . $queryRaw (
100114 Prisma . sql `UPDATE "Webhook" SET events = jsonb_set(events, ${ Prisma . raw (
0 commit comments