Compare commits
No commits in common. "7bfd085167e4f9e79ec64c5cd7fd1c5ab69961d2" and "c07f44b149689accb2fe75cea073704dcbc1c892" have entirely different histories.
7bfd085167
...
c07f44b149
@ -702,14 +702,7 @@ const formatDate = (date) => {
|
||||
|
||||
export const getOrderCounts = async (req, res) => {
|
||||
try {
|
||||
// console.log(req.user._id,"");
|
||||
const userId = req.user._id;
|
||||
const statusCounts = await PdOrder.aggregate([
|
||||
{
|
||||
$match: {
|
||||
addedBy: userId, // Only match orders added by the current user
|
||||
},
|
||||
},
|
||||
{
|
||||
$group: {
|
||||
_id: "$status", // Group by status
|
||||
|
@ -50,6 +50,6 @@ router
|
||||
router
|
||||
.route("/change/status/:id")
|
||||
.patch(isAuthenticatedUser, authorizeRoles("admin"), updateOrderStatusById);
|
||||
router.route("/get-counts-pdOrders").get(isAuthenticatedUser, getOrderCounts);
|
||||
router.route("/get-counts-pdOrders").get(getOrderCounts);
|
||||
|
||||
export default router;
|
||||
|
Loading…
Reference in New Issue
Block a user