From 6bbdcffd092c58bf4f21bcde65ae62ea00e07399 Mon Sep 17 00:00:00 2001 From: Will Franklin Date: Tue, 26 Nov 2024 16:13:44 +0100 Subject: [PATCH] Merge pull request #95 from beabee-communityrm/fix/permanently-delete fix: permanently delete contacts not clearing everything --- packages/core/src/services/CalloutsService.ts | 5 +++++ packages/core/src/services/ContactsService.ts | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/packages/core/src/services/CalloutsService.ts b/packages/core/src/services/CalloutsService.ts index d8ba207fa..53458100f 100644 --- a/packages/core/src/services/CalloutsService.ts +++ b/packages/core/src/services/CalloutsService.ts @@ -328,6 +328,11 @@ class CalloutsService { { contactId: contact.id }, { contactId: null } ); + + await getRepository(CalloutResponse).update( + { assigneeId: contact.id }, + { assigneeId: null } + ); } /** diff --git a/packages/core/src/services/ContactsService.ts b/packages/core/src/services/ContactsService.ts index d950c9467..ac68106b6 100644 --- a/packages/core/src/services/ContactsService.ts +++ b/packages/core/src/services/ContactsService.ts @@ -34,6 +34,7 @@ import { Contact, ContactProfile, ContactRole, + ContactTagAssignment, GiftFlow, Password, Project, @@ -421,6 +422,9 @@ class ContactsService { .getRepository(GiftFlow) .update({ gifteeId: contact.id }, { gifteeId: null }); + await em + .getRepository(ContactTagAssignment) + .delete({ contactId: contact.id }); await em.getRepository(ContactRole).delete({ contactId: contact.id }); await em.getRepository(ContactProfile).delete({ contactId: contact.id }); await em.getRepository(Contact).delete(contact.id);