Skip to content

Commit

Permalink
add image to getOrders
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatino12 committed Mar 18, 2022
1 parent 472d24a commit 55032da
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/controllers/order.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,15 @@ export async function getOrders(id: string) {
},
select: {
name: true,
image: true,
},
});
if (product.name) product.name = product.name.name;
productsInfo.push({ name: product.name, cantidad: product.cantidad });
if (product.name) {
product.image = product.name.image
product.name = product.name.name;
}

productsInfo.push({ name: product.name, cantidad: product.cantidad, image: product.image});
}
orders[j].userInfo = userInfo;
orders[j].productsInfo = productsInfo;
Expand All @@ -64,6 +69,7 @@ export async function getOrders(id: string) {
},
select: {
name: true,

},
});
for (let i = 0; i < userOrders[j].ordenProductsId.length; i++) {
Expand All @@ -74,12 +80,17 @@ export async function getOrders(id: string) {
},
select: {
name: true,
image: true,
},
});
if (product.name) product.name = product.name.name;
if (product.name){
product.image = product.name.image
product.name = product.name.name;
}
productsInfo.push({
name: product.name,
cantidad: product.cantidad,
image: product.image
});
}
userOrders[j].shopInfo = shopInfo;
Expand Down

0 comments on commit 55032da

Please sign in to comment.