aggio gasordine
This commit is contained in:
@@ -144,7 +144,24 @@ router.post('/import', authenticate, async (req, res) => {
|
||||
}
|
||||
}
|
||||
|
||||
let recProductExist = await Product.findOne({ idProductInfo: product.idProductInfo }).lean();
|
||||
// Cerca il GAS
|
||||
let recGas = null;
|
||||
if (prod.gas_name) {
|
||||
// Cerca il GAS
|
||||
recGas = await Gasordine.findOne({ idapp, name: prod.gas_name }).lean();
|
||||
}
|
||||
|
||||
let recProductExist = null;
|
||||
let queryprod = { idProductInfo: product.idProductInfo };
|
||||
|
||||
if (recGas) {
|
||||
queryprod = {...queryprod, gas}
|
||||
} else {
|
||||
recProductExist = await Product.findOne().lean();
|
||||
}
|
||||
|
||||
recProductExist = await Product.findOne({ queryprod }).lean();
|
||||
|
||||
if (!recProductExist) {
|
||||
isnuovo = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user