This commit is contained in:
ROSHAN GARG 2024-09-10 11:02:40 +05:30
commit 9c31ccdd7c
11 changed files with 7 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

View File

@ -54,7 +54,7 @@ const salescoordinatorSchema = new mongoose.Schema(
}, },
fcm_token: { fcm_token: {
type: String, type: String,
unique: true, default: null,
}, },
mappedby: { mappedby: {
type: mongoose.Schema.Types.ObjectId, type: mongoose.Schema.Types.ObjectId,

View File

@ -138,6 +138,7 @@ export const assignTask = async (req, res) => {
export const getTasksByStatus = async (req, res) => { export const getTasksByStatus = async (req, res) => {
try { try {
await updateOverdueTasks();
const { status } = req.params; // This should be "New", "Pending", or "Completed" const { status } = req.params; // This should be "New", "Pending", or "Completed"
// Validate the provided status // Validate the provided status
@ -167,6 +168,7 @@ export const getTasksByStatus = async (req, res) => {
}; };
export const getAllTasksByStatus = async (req, res) => { export const getAllTasksByStatus = async (req, res) => {
try { try {
await updateOverdueTasks();
const { status } = req.params; // This should be "New", "Pending", or "Completed" const { status } = req.params; // This should be "New", "Pending", or "Completed"
// Validate the provided status // Validate the provided status
@ -201,6 +203,7 @@ export const getAllTasksByStatus = async (req, res) => {
}; };
export const getTasksbytask = async (req, res) => { export const getTasksbytask = async (req, res) => {
try { try {
await updateOverdueTasks();
const { task } = req.params; const { task } = req.params;
// Validate the provided status // Validate the provided status

View File

@ -54,7 +54,7 @@ const territorymanagerSchema = new mongoose.Schema(
}, },
fcm_token: { fcm_token: {
type: String, type: String,
unique: true, default: null,
}, },
}, },
{ timestamps: true } { timestamps: true }

View File

@ -1169,7 +1169,7 @@ export const mappedbyTM = catchAsyncErrors(async (req, res, next) => {
export const mappedbySC = catchAsyncErrors(async (req, res, next) => { export const mappedbySC = catchAsyncErrors(async (req, res, next) => {
const { id } = req.params; // SalesCoOrdinator ID from URL parameters const { id } = req.params; // SalesCoOrdinator ID from URL parameters
const { mappedbySC } = req.body; // TerritoryManager ID from request body const { mappedbySC } = req.body; // TerritoryManager ID from request body
// console.log(id, mappedby); // console.log(id, mappedbySC);
// Validate that the TerritoryManager ID is provided // Validate that the TerritoryManager ID is provided
if (!mappedbySC) { if (!mappedbySC) {
return res.status(400).json({ return res.status(400).json({

View File

@ -30,7 +30,7 @@ app.get("/", (req, res) => {
}); });
// } // }
// Schedule the cron job // Schedule the cron job
cron.schedule("10 0 * * *", updateOverdueTasks, { cron.schedule("3 0 * * *", updateOverdueTasks, {
timezone: "Asia/Kolkata", timezone: "Asia/Kolkata",
}); });
//<---------deployement-------------> //<---------deployement------------->