refs #4823 Bug fixes

This commit is contained in:
Guillermo Bonet 2023-06-12 14:51:34 +02:00
parent e4461e255d
commit 9b2f7d12ab
2 changed files with 5 additions and 6 deletions

View File

@ -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';

View File

@ -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;