From 42c3a54104137c6f11e5b016d2909a9691752898 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 5 Dec 2024 15:22:18 +0000 Subject: [PATCH] Clean audit log endpoint code --- packages/frontend-core/src/api/auditLogs.ts | 37 +-------------------- 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/packages/frontend-core/src/api/auditLogs.ts b/packages/frontend-core/src/api/auditLogs.ts index 60caca0c85..e0407f0412 100644 --- a/packages/frontend-core/src/api/auditLogs.ts +++ b/packages/frontend-core/src/api/auditLogs.ts @@ -14,48 +14,13 @@ export interface AuditLogEndpoints { getDownloadUrl: (opts: DownloadAuditLogsRequest) => string } -const buildOpts = (opts: SearchAuditLogsRequest) => { - const { bookmark, startDate, endDate, fullSearch, events, userIds, appIds } = - opts - const parsedOpts: SearchAuditLogsRequest = {} - - if (bookmark) { - parsedOpts.bookmark = bookmark - } - - if (opts.startDate && endDate) { - parsedOpts.startDate = startDate - parsedOpts.endDate = endDate - } else if (startDate && !endDate) { - parsedOpts.startDate = startDate - } - - if (fullSearch) { - parsedOpts.fullSearch = fullSearch - } - - if (events?.length) { - parsedOpts.events = events - } - - if (userIds?.length) { - parsedOpts.userIds = userIds - } - - if (appIds?.length) { - parsedOpts.appIds = appIds - } - - return parsedOpts -} - export const buildAuditLogEndpoints = ( API: BaseAPIClient ): AuditLogEndpoints => ({ searchAuditLogs: async opts => { return await API.post({ url: `/api/global/auditlogs/search`, - body: buildOpts(opts), + body: opts, }) }, getEventDefinitions: async () => {