From 9b2f7d12ab17337b86946e68cdaa52ae0f197969 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 12 Jun 2023 14:51:34 +0200 Subject: [PATCH] refs #4823 Bug fixes --- models/sequelize.js | 9 ++++----- utils.js | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/models/sequelize.js b/models/sequelize.js index 476b282..8c51a0b 100644 --- a/models/sequelize.js +++ b/models/sequelize.js @@ -19,14 +19,14 @@ console.log(chalk.hex('#06c581')( ` )) -let sequelize, conSpinner +let sequelize, spinner; try { - conSpinner = ora('Creating database connection...').start(); + spinner = ora('Creating database connection...').start(); sequelize = createConn(); await checkCon(); - conSpinner.succeed(); + spinner.succeed(); } catch (err) { - conSpinner.fail(); + spinner.fail(); criticalError(err); } @@ -165,7 +165,6 @@ try { criticalError(err); } -let spinner; try { const action = JSON.parse(env.FORCE_SYNC) ? { force: true } : { alter: true }; const actionMsg = JSON.parse(env.FORCE_SYNC) ? 'Forcing' : 'Altering'; diff --git a/utils.js b/utils.js index 29ee10f..80a02f3 100644 --- a/utils.js +++ b/utils.js @@ -449,7 +449,7 @@ export async function insertSupplyLine(supplyLine) { try { // Check if the warehouse exists, and if it doesn't, create it let warehouse = await models.warehouse.findOne({ - where: { warehouseId: object.warehouseId } + where: { warehouseId: supplyLine.warehouseId } }); if (!warehouse) { let warehouse = (await vnRequest('GET', `${env.API_URL}/warehouses/${supplyLine.warehouseId}`, null, null, spinner)).data;