From 5dbd9cda780848e972d399e55fe02f0586f561e1 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Thu, 28 Nov 2024 09:37:38 +0000 Subject: [PATCH] fix: operation on s3 protocol (#592) --- src/http/plugins/db.ts | 3 ++- src/internal/database/client.ts | 2 +- src/internal/database/connection.ts | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/http/plugins/db.ts b/src/http/plugins/db.ts index 369ee12f..9e0b3b87 100644 --- a/src/http/plugins/db.ts +++ b/src/http/plugins/db.ts @@ -49,7 +49,7 @@ export const db = fastifyPlugin( headers: request.headers, path: request.url, method: request.method, - operation: request.operation?.type, + operation: () => request.operation?.type, }) }) @@ -111,6 +111,7 @@ export const dbSuperUser = fastifyPlugin( method: request.method, headers: request.headers, disableHostCheck: opts.disableHostCheck, + operation: () => request.operation?.type, }) }) diff --git a/src/internal/database/client.ts b/src/internal/database/client.ts index 30c3c173..68225733 100644 --- a/src/internal/database/client.ts +++ b/src/internal/database/client.ts @@ -12,7 +12,7 @@ interface ConnectionOptions { user: User superUser: User disableHostCheck?: boolean - operation?: string + operation?: () => string | undefined } /** diff --git a/src/internal/database/connection.ts b/src/internal/database/connection.ts index ceb2d20e..440333ed 100644 --- a/src/internal/database/connection.ts +++ b/src/internal/database/connection.ts @@ -34,7 +34,7 @@ interface TenantConnectionOptions { headers?: Record method?: string path?: string - operation?: string + operation?: () => string | undefined } export interface User { @@ -252,7 +252,7 @@ export class TenantConnection { headers, this.options.method || '', this.options.path || '', - this.options.operation || '', + this.options.operation?.() || '', ] ) }