From 61296555fe4a28e3eddc94a19643cbdca76fd512 Mon Sep 17 00:00:00 2001 From: "rodrigo.zamboni" Date: Thu, 1 Sep 2022 12:41:46 -0300 Subject: [PATCH] FIX: not deleting failed connection when it comes from request body --- .../connection-test/connection-test.service.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/modules/connection-test/connection-test.service.ts b/src/modules/connection-test/connection-test.service.ts index 53218ce..e25aa75 100644 --- a/src/modules/connection-test/connection-test.service.ts +++ b/src/modules/connection-test/connection-test.service.ts @@ -89,13 +89,15 @@ export class ConnectionTestService { plugin, }), ).catch(async (e) => { - await this.connectionsService.deleteConnection({ - body: { id: connection_id }, - info: { customer_id, customer_name, user_id }, - }); + if (!body.connection_id) { + await this.connectionsService.deleteConnection({ + body: { id: connection_id }, + info: { customer_id, customer_name, user_id }, + }); + } throw e; }); - if (!operation_result) { + if (!operation_result && !body.connection_id) { await this.connectionsService.deleteConnection({ body: { id: connection_id }, info: { customer_id, customer_name, user_id },