From da25c894ca9a1eb869230052cc21e697d326da21 Mon Sep 17 00:00:00 2001 From: noctera Date: Sun, 10 Oct 2021 10:49:14 +0200 Subject: [PATCH] refactor: moved transaction downwards --- app/Services/ImportServiceProvider.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Services/ImportServiceProvider.js b/app/Services/ImportServiceProvider.js index f3af5f7e..0849c6af 100644 --- a/app/Services/ImportServiceProvider.js +++ b/app/Services/ImportServiceProvider.js @@ -12,8 +12,6 @@ async function storeGroupVocabulary( active, activate ) { - const transaction = await sequelize.transaction(); - const languagePackage = await LanguagePackage.findOne({ where: { userId, @@ -25,6 +23,8 @@ async function storeGroupVocabulary( throw new ApiError(httpStatus.NOT_FOUND, 'language package not found'); } + const transaction = await sequelize.transaction(); + try { const group = await Group.create( {