Skip to content

Commit

Permalink
ordercontroller route and logic update
Browse files Browse the repository at this point in the history
  • Loading branch information
PKBAJPAI12 committed Aug 24, 2024
1 parent 3fe470f commit 785c066
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions backend/controller/orderController.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ res.status(200).json({
exports.myOrders=catchAsyncError(async(req,res,next)=>{
//populate used for get specified data from particular model of mentioned fields
console.log('id', req.user._id);
const orders=await Order.findById({user:req.user._id});
const orders=await Order.find({user:req.user._id});
console.log('orders', orders);
res.status(200).json({
res.status(200).json({
success:true,
orders,
})
Expand Down
2 changes: 1 addition & 1 deletion backend/routes/orderRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const {
const { isAuthenticatedUser, authorisedRole} = require("../middleware/auth");
router.post('/order/new',isAuthenticatedUser,newOrder);
router.get('/order/:id',isAuthenticatedUser,getSingleOrder);
router.post('/orders/me',isAuthenticatedUser,myOrders);
router.get('/orders/me',isAuthenticatedUser,myOrders);
router.get('/admin/orders',isAuthenticatedUser,authorisedRole("admin"),getAllOrders);
router.put('/admin/order/:id',isAuthenticatedUser,authorisedRole("admin"),updateOrder);
router.delete('/admin/order/:id',isAuthenticatedUser,authorisedRole("admin"),deleteOrder);
Expand Down

0 comments on commit 785c066

Please sign in to comment.