Skip to content

Commit

Permalink
Merge pull request #101 from ta-vivo/fix-integrations-on-create-checks
Browse files Browse the repository at this point in the history
fixing intrgrations checks addition on create
  • Loading branch information
itsalb3rt authored Jul 4, 2024
2 parents a8d5576 + d173587 commit 1b28a13
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/services/CheckService.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ class CheckService {
let entityCreated = await Checks.create(checkForCreate, { transaction: t });
entityCreated = JSON.parse(JSON.stringify(entityCreated));

if (newCheck.addIntegrations) {
this.addIntegrations(entityCreated.id, newCheck.addIntegrations);
}

if (checkForCreate.authorizationHeader && checkForCreate.authorizationHeader.name && checkForCreate.authorizationHeader.token) {
const encryptedHeaders = encrypt(checkForCreate.authorizationHeader.token);
Expand All @@ -133,6 +130,11 @@ class CheckService {
}

await t.commit();

if (newCheck.addIntegrations) {
this.addIntegrations(entityCreated.id, newCheck.addIntegrations);
}

this.runCheck(entityCreated);
return entityCreated;
} catch (error) {
Expand Down

0 comments on commit 1b28a13

Please sign in to comment.