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;