From e03bfa4459d898d21047b45f032e3daf8eca5b09 Mon Sep 17 00:00:00 2001 From: Bhaskar Date: Tue, 24 Jun 2025 14:30:44 +0530 Subject: [PATCH] code genrated for assgn team member --- src/controllers/installationController.js | 7 +++++-- src/models/store.js | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/controllers/installationController.js b/src/controllers/installationController.js index c411125d..6ab8075e 100644 --- a/src/controllers/installationController.js +++ b/src/controllers/installationController.js @@ -8883,6 +8883,7 @@ exports.assignCategorizeIssue = async (request, reply) => { } const assignedAt = moment().format("DD-MM-YYYY HH:mm:ss"); +const assignmentCode = Math.floor(100000 + Math.random() * 900000).toString(); // random 6-digit code let assignedCount = 0; support.categorizedIssues.forEach(issue => { @@ -8895,7 +8896,8 @@ exports.assignCategorizeIssue = async (request, reply) => { support_teamMemberId: teamMember.support_teamMemberId, phone: teamMember.phone, email: teamMember.email, - assignedAt: assignedAt + assignedAt: assignedAt, + assignmentCode: assignmentCode // ← Add this field }; assignedCount++; } @@ -8909,12 +8911,13 @@ exports.assignCategorizeIssue = async (request, reply) => { return reply.send({ message: `Assigned ${assignedCount} categorized issue(s) to ${teamMember.name}`, + assignmentCode: assignmentCode, // ← Return the code in response assignedTo: { support_teamMemberId: teamMember.support_teamMemberId, name: teamMember.name, phone: teamMember.phone, email: teamMember.email, - assignedAt: assignedAt + assignedAt: assignedAt, } }); }; diff --git a/src/models/store.js b/src/models/store.js index 5e8f515f..505953aa 100644 --- a/src/models/store.js +++ b/src/models/store.js @@ -283,7 +283,8 @@ const installationschema = new mongoose.Schema({ email: String, startDate: String, endDate: String, - assignedAt: String + assignedAt: String, + assignmentCode: String } });