From 6cc96f39b17ff3ac6a2fbd2185d7664c8e95a0ab Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 20 Feb 2023 17:20:42 +0000 Subject: [PATCH] Minor fixes for friendly audited events, and a new function for comparing app IDs. --- packages/backend-core/src/db/utils.ts | 10 ++++++++++ packages/types/src/api/web/global/auditLogs.ts | 2 +- packages/types/src/sdk/events/event.ts | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/backend-core/src/db/utils.ts b/packages/backend-core/src/db/utils.ts index c22685b912..d9dbb809d1 100644 --- a/packages/backend-core/src/db/utils.ts +++ b/packages/backend-core/src/db/utils.ts @@ -392,6 +392,16 @@ export async function getDevAppIDs() { return apps.filter((id: any) => isDevAppID(id)) } +export function isSameAppID( + appId1: string | undefined, + appId2: string | undefined +) { + if (appId1 == undefined || appId2 == undefined) { + return false + } + return getProdAppID(appId1) === getProdAppID(appId2) +} + export async function dbExists(dbName: any) { return doWithDB( dbName, diff --git a/packages/types/src/api/web/global/auditLogs.ts b/packages/types/src/api/web/global/auditLogs.ts index dbd22b2bf2..ef9927b89a 100644 --- a/packages/types/src/api/web/global/auditLogs.ts +++ b/packages/types/src/api/web/global/auditLogs.ts @@ -35,5 +35,5 @@ export interface SearchAuditLogsResponse extends PaginationResponse { } export interface DefinitionsAuditLogsResponse { - events: typeof AuditedEventFriendlyName + events: Record } diff --git a/packages/types/src/sdk/events/event.ts b/packages/types/src/sdk/events/event.ts index 4fb3e873ae..1be0ea2bdf 100644 --- a/packages/types/src/sdk/events/event.ts +++ b/packages/types/src/sdk/events/event.ts @@ -197,7 +197,7 @@ export const AuditedEventFriendlyName: Record = { [Event.USER_PERMISSION_ADMIN_REMOVED]: `User "{{ email }}" admin role removed`, [Event.USER_PERMISSION_BUILDER_ASSIGNED]: `User "{{ email }}" builder role assigned`, [Event.USER_PERMISSION_BUILDER_REMOVED]: `User "{{ email }}" builder role removed`, - [Event.USER_INVITED]: `User "{{ email }} invited`, + [Event.USER_INVITED]: `User "{{ email }}" invited`, [Event.USER_INVITED_ACCEPTED]: `User "{{ email }}" accepted invite`, [Event.USER_PASSWORD_UPDATED]: `User "{{ email }}" password updated`, [Event.USER_PASSWORD_RESET_REQUESTED]: `User "{{ email }}" password reset requested`,