Skip to content

Commit

Permalink
fix(orders): fix permissions issue on get-all orders (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkarenzi authored Jul 26, 2024
1 parent 4844c5c commit 3f0ef95
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/controller/cartController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export const deleteAllOrders = errorHandler(

export const getAllOrders = errorHandler(
async (req: Request, res: Response) => {
const orders = await orderRepository.find({ relations: ['orderDetails'] });
const orders = await orderRepository.find({ relations: ['orderDetails','orderDetails.product','orderDetails.product.vendor'] });
return res.status(200).json({ orders });
}
);
Expand Down
2 changes: 1 addition & 1 deletion src/routes/checkoutRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '../controller/cartController';

const checkoutRoutes = Router();
checkoutRoutes.use(IsLoggedIn, checkRole(['Buyer', 'Admin']));
checkoutRoutes.use(IsLoggedIn, checkRole(['Buyer','Vendor', 'Admin']));
checkoutRoutes.route('/').post(checkout);
checkoutRoutes.route('/removeall-order').delete(deleteAllOrders);
checkoutRoutes.route('/getall-order').get(getAllOrders);
Expand Down

0 comments on commit 3f0ef95

Please sign in to comment.