From 2068e7884f2bb4fca6737bbcc357f7b250e917eb Mon Sep 17 00:00:00 2001 From: RichardBray Date: Thu, 20 Jul 2023 11:43:32 +0100 Subject: [PATCH] chore(migration.sql): update migration to delete only listItem audits with auditEvent set to 'REMINDER' refactor(listItemEvent.ts): remove unnecessary check for "id" in response --- .../20230717140537_delete_unused_audits/migration.sql | 2 +- src/shared/listItemEvent.ts | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/server/models/db/migrations/20230717140537_delete_unused_audits/migration.sql b/src/server/models/db/migrations/20230717140537_delete_unused_audits/migration.sql index 6617a7fa7..bb9933d7e 100644 --- a/src/server/models/db/migrations/20230717140537_delete_unused_audits/migration.sql +++ b/src/server/models/db/migrations/20230717140537_delete_unused_audits/migration.sql @@ -1,3 +1,3 @@ -- Delete all lstItem audit events. DELETE FROM "Audit" -WHERE type = 'listItem'; +WHERE type = 'listItem' AND "auditEvent" = 'REMINDER'; diff --git a/src/shared/listItemEvent.ts b/src/shared/listItemEvent.ts index 79478357d..b2c86f15b 100644 --- a/src/shared/listItemEvent.ts +++ b/src/shared/listItemEvent.ts @@ -123,12 +123,10 @@ export const EVENTS = { }), [ListItemEvent.REMINDER]: ( - response: SendEmailResponse | {}, + response: SendEmailResponse, notes?: string[], reference?: string - ): EventCreate<"REMINDER"> | undefined => { - if (!("id" in response)) return; - + ): EventCreate<"REMINDER"> => { const notifyResponseWithoutContent = { id: response.id, template: response.template,