Skip to content

Commit

Permalink
add id product to getOrders
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatino12 committed Mar 18, 2022
1 parent ffeeaeb commit fbdce13
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/controllers/order.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,18 @@ export async function getOrders(id: string) {
image: true,
price: true,
discount: true,
id: true,
},
});
if (product.name) {
product.id = product.name.id;
product.discount = product.name.discount;
product.price = product.name.price;
product.image = product.name.image;
product.name = product.name.name;
}

productsInfo.push({ name: product.name, cantidad: product.cantidad,
productsInfo.push({ id: product.id, name: product.name, cantidad: product.cantidad,
image: product.image, price: product.price, discount: product.discount});
}
orders[j].userInfo = userInfo;
Expand Down Expand Up @@ -88,20 +90,24 @@ export async function getOrders(id: string) {
image: true,
price: true,
discount: true,
id: true,
},
});
if (product.name){
product.id = product.name.id
product.discount = product.name.discount
product.price = product.name.price
product.image = product.name.image
product.name = product.name.name;
}
productsInfo.push({
id: product.id,
name: product.name,
cantidad: product.cantidad,
image: product.image,
price: product.price,
discount: product.discount
discount: product.discount,

});
}
userOrders[j].shopInfo = shopInfo;
Expand Down

0 comments on commit fbdce13

Please sign in to comment.