aggiornamento scontistica, corretto errori
This commit is contained in:
@@ -223,6 +223,13 @@ module.exports.getOrdersCartByUserId = async function (uid, idapp, numorder) {
|
||||
model: 'Storehouse'
|
||||
},
|
||||
})
|
||||
.populate({
|
||||
path: 'items.order',
|
||||
populate: {
|
||||
path: 'idScontisticas',
|
||||
model: 'Scontistica'
|
||||
},
|
||||
})
|
||||
.populate({
|
||||
path: 'userId',
|
||||
model: 'User',
|
||||
@@ -237,13 +244,15 @@ module.exports.getOrdersCartByUserId = async function (uid, idapp, numorder) {
|
||||
if (item.order) {
|
||||
try {
|
||||
item.order.product = item.order.idProduct;
|
||||
item.order.idProduct = item.order.product._id;
|
||||
item.order.idProduct = item.order.product ? item.order.product._id : '';
|
||||
item.order.producer = item.order.idProducer;
|
||||
item.order.idProducer = item.order.producer._id;
|
||||
item.order.idProducer = item.order.producer ? item.order.producer._id : '';
|
||||
item.order.storehouse = item.order.idStorehouse;
|
||||
item.order.idStorehouse = item.order.storehouse._id;
|
||||
item.order.idStorehouse = item.order.storehouse ? item.order.storehouse._id : '';
|
||||
item.order.provider = item.order.idProvider;
|
||||
item.order.idProvider = item.order.provider._id;
|
||||
item.order.idProvider = item.order.provider ? item.order.provider._id : '';
|
||||
item.order.scontisticas = item.order.scontisticas;
|
||||
item.order.idScontisticas = item.order.idScontisticas ? item.order.idScontisticas._id : '';
|
||||
} catch (e) {
|
||||
console.error('Err: ', e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user