date wise task show

This commit is contained in:
Sibunnayak 2024-10-14 17:46:11 +05:30
parent 5f76483841
commit e712a5a6d1

View File

@ -184,7 +184,7 @@ export const getTasksByDates = async (req, res) => {
// Initialize filter object
const filter = {};
console.log(req.userType);
// Determine the filter based on user type
if (req.userType === "SalesCoOrdinator") {
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 },
})
.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",
})
.sort({ createdAt: -1 });