aboutsummaryrefslogtreecommitdiff
path: root/server/controllers/transaction.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/transaction.js')
-rw-r--r--server/controllers/transaction.js15
1 files changed, 5 insertions, 10 deletions
diff --git a/server/controllers/transaction.js b/server/controllers/transaction.js
index 356672b..b8c2bf4 100644
--- a/server/controllers/transaction.js
+++ b/server/controllers/transaction.js
@@ -135,17 +135,12 @@ module.exports = {
async showPaid(req, res) {
const orders = await Order.find({status: 'paid'});
- let formattedResponse = [];
-
- orders.forEach(order => {
- formattedResponse.push({
- shipping: order.shipping,
- items: order.items,
- updatedAt: order.updatedAt
- });
- });
+ res.json(orders);
+ },
- res.json(formattedResponse);
+ async showPaidByUser(req, res) {
+ const orders = await Order.find({status: 'paid', userId: req.user._id});
+ res.json(orders);
}
};