code genrated for assgn team member

master^2
Bhaskar 3 months ago
parent 0d9444275f
commit e03bfa4459

@ -8883,6 +8883,7 @@ exports.assignCategorizeIssue = async (request, reply) => {
} }
const assignedAt = moment().format("DD-MM-YYYY HH:mm:ss"); 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; let assignedCount = 0;
support.categorizedIssues.forEach(issue => { support.categorizedIssues.forEach(issue => {
@ -8895,7 +8896,8 @@ exports.assignCategorizeIssue = async (request, reply) => {
support_teamMemberId: teamMember.support_teamMemberId, support_teamMemberId: teamMember.support_teamMemberId,
phone: teamMember.phone, phone: teamMember.phone,
email: teamMember.email, email: teamMember.email,
assignedAt: assignedAt assignedAt: assignedAt,
assignmentCode: assignmentCode // ← Add this field
}; };
assignedCount++; assignedCount++;
} }
@ -8909,12 +8911,13 @@ exports.assignCategorizeIssue = async (request, reply) => {
return reply.send({ return reply.send({
message: `Assigned ${assignedCount} categorized issue(s) to ${teamMember.name}`, message: `Assigned ${assignedCount} categorized issue(s) to ${teamMember.name}`,
assignmentCode: assignmentCode, // ← Return the code in response
assignedTo: { assignedTo: {
support_teamMemberId: teamMember.support_teamMemberId, support_teamMemberId: teamMember.support_teamMemberId,
name: teamMember.name, name: teamMember.name,
phone: teamMember.phone, phone: teamMember.phone,
email: teamMember.email, email: teamMember.email,
assignedAt: assignedAt assignedAt: assignedAt,
} }
}); });
}; };

@ -283,7 +283,8 @@ const installationschema = new mongoose.Schema({
email: String, email: String,
startDate: String, startDate: String,
endDate: String, endDate: String,
assignedAt: String assignedAt: String,
assignmentCode: String
} }
}); });

Loading…
Cancel
Save