date wise task show
This commit is contained in:
parent
5f76483841
commit
e712a5a6d1
@ -184,7 +184,7 @@ export const getTasksByDates = async (req, res) => {
|
|||||||
|
|
||||||
// Initialize filter object
|
// Initialize filter object
|
||||||
const filter = {};
|
const filter = {};
|
||||||
|
console.log(req.userType);
|
||||||
// Determine the filter based on user type
|
// Determine the filter based on user type
|
||||||
if (req.userType === "SalesCoOrdinator") {
|
if (req.userType === "SalesCoOrdinator") {
|
||||||
filter.taskAssignedTo = req.user._id; // Use `=` to assign values, and `===` for comparison
|
filter.taskAssignedTo = req.user._id; // Use `=` to assign values, and `===` for comparison
|
||||||
@ -213,7 +213,7 @@ export const getTasksByDates = async (req, res) => {
|
|||||||
createdAt: { $gte: startOfDay, $lte: endOfDay },
|
createdAt: { $gte: startOfDay, $lte: endOfDay },
|
||||||
})
|
})
|
||||||
.populate({
|
.populate({
|
||||||
path: req.userType === "SalesCoOrdinator" ? "taskAssignedTo" : "taskAssignedBy", // Change path based on user type
|
path: req.userType === "SalesCoOrdinator" ? "taskAssignedBy" : "taskAssignedTo", // Change path based on user type
|
||||||
select: "name mobileNumber email",
|
select: "name mobileNumber email",
|
||||||
})
|
})
|
||||||
.sort({ createdAt: -1 });
|
.sort({ createdAt: -1 });
|
||||||
|
Loading…
Reference in New Issue
Block a user