From 9bdff9c5045654b6862f8a66088f1b0295b27838 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Fri, 10 Jan 2025 17:15:14 +0100 Subject: [PATCH 1/2] fix: explicit postgres time conversion --- backend/src/ee/services/audit-log/audit-log-dal.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/ee/services/audit-log/audit-log-dal.ts b/backend/src/ee/services/audit-log/audit-log-dal.ts index b2c80aa0b5..bcef06e100 100644 --- a/backend/src/ee/services/audit-log/audit-log-dal.ts +++ b/backend/src/ee/services/audit-log/audit-log-dal.ts @@ -100,10 +100,10 @@ export const auditLogDALFactory = (db: TDbClient) => { // Filter by date range if (startDate) { - void sqlQuery.where(`${TableName.AuditLog}.createdAt`, ">=", startDate); + void sqlQuery.whereRaw(`"${TableName.AuditLog}"."createdAt" >= ?::timestamptz`, [startDate]); } if (endDate) { - void sqlQuery.where(`${TableName.AuditLog}.createdAt`, "<=", endDate); + void sqlQuery.whereRaw(`"${TableName.AuditLog}"."createdAt" <= ?::timestamptz`, [endDate]); } // we timeout long running queries to prevent DB resource issues (2 minutes) From 17249d603b2b3ae0db325b690de6b268aa27d95d Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Fri, 10 Jan 2025 17:15:26 +0100 Subject: [PATCH 2/2] fix: add delete secrets event type to frontend --- frontend/src/hooks/api/auditLogs/constants.tsx | 1 + frontend/src/hooks/api/auditLogs/enums.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/frontend/src/hooks/api/auditLogs/constants.tsx b/frontend/src/hooks/api/auditLogs/constants.tsx index a75767108c..fd764f1f5d 100644 --- a/frontend/src/hooks/api/auditLogs/constants.tsx +++ b/frontend/src/hooks/api/auditLogs/constants.tsx @@ -3,6 +3,7 @@ import { EventType, UserAgentType } from "./enums"; export const eventToNameMap: { [K in EventType]: string } = { [EventType.GET_SECRETS]: "List secrets", [EventType.GET_SECRET]: "Read secret", + [EventType.DELETE_SECRETS]: "Delete secrets", [EventType.CREATE_SECRET]: "Create secret", [EventType.UPDATE_SECRET]: "Update secret", [EventType.DELETE_SECRET]: "Delete secret", diff --git a/frontend/src/hooks/api/auditLogs/enums.tsx b/frontend/src/hooks/api/auditLogs/enums.tsx index 0b0c44d7b0..5e8adf5b13 100644 --- a/frontend/src/hooks/api/auditLogs/enums.tsx +++ b/frontend/src/hooks/api/auditLogs/enums.tsx @@ -17,6 +17,7 @@ export enum UserAgentType { export enum EventType { GET_SECRETS = "get-secrets", + DELETE_SECRETS = "delete-secrets", GET_SECRET = "get-secret", CREATE_SECRET = "create-secret", UPDATE_SECRET = "update-secret",