From 5e83ffa1df68af77d909b524918fcd627dfd566e Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Mon, 18 Oct 2021 18:45:47 +1100 Subject: [PATCH] fix: move deploytarget clean up to the right spot --- services/api/src/resources/project/helpers.ts | 6 ++++++ services/api/src/resources/project/resolvers.ts | 9 --------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/services/api/src/resources/project/helpers.ts b/services/api/src/resources/project/helpers.ts index 45eb1c0130..0425e26736 100644 --- a/services/api/src/resources/project/helpers.ts +++ b/services/api/src/resources/project/helpers.ts @@ -115,6 +115,12 @@ export const Helpers = (sqlClientPool: Pool) => { 'DELETE FROM `project_notification` WHERE `pid` = :id', { id } ); + // clean up deploytarget configurations + await query( + sqlClientPool, + 'DELETE FROM `deploy_target_config` WHERE `project` = :id', + { id } + ); await query(sqlClientPool, 'DELETE FROM `project` WHERE `id` = :id', { id }); diff --git a/services/api/src/resources/project/resolvers.ts b/services/api/src/resources/project/resolvers.ts index 139d28c5db..aea789cf6c 100644 --- a/services/api/src/resources/project/resolvers.ts +++ b/services/api/src/resources/project/resolvers.ts @@ -540,15 +540,6 @@ export const deleteProject: ResolverFn = async ( ); } - // clean up deploytarget configurations for this project - try { - await query(sqlClientPool, 'DELETE FROM deploy_target_config WHERE project = :pid', { - pid - }); - } catch (err) { - // Not allowed to stop execution. - } - // @TODO discuss if we want to delete projects in harbor or not //const harborOperations = createHarborOperations(sqlClientPool);