assigned at added

master^2
Bhaskar 3 months ago
parent 996a542daa
commit 7a8d12ba90

@ -8858,12 +8858,15 @@ exports.updateHardwareList = async (req, reply) => {
exports.assignCategorizeIssue = async (request, reply) => { exports.assignCategorizeIssue = async (request, reply) => {
const { supportId } = request.params; const { supportId } = request.params;
const { support_teamMemberId, category, masterHardwareId } = request.body; const { support_teamMemberId, category, masterHardwareId } = request.body;
if (!support_teamMemberId || !category || !masterHardwareId) { if (!support_teamMemberId || !category || !masterHardwareId) {
return reply.code(400).send({ error: 'support_teamMemberId, startDate, endDate, category, and masterHardwareId are required' }); return reply.code(400).send({
error: 'support_teamMemberId, category, and masterHardwareId are required'
});
} }
const support = await Support.findOne({ supportId }); const support = await Support.findOne({ supportId });
@ -8878,17 +8881,7 @@ exports.assignCategorizeIssue = async (request, reply) => {
return reply.code(400).send({ error: `Team member ID ${support_teamMemberId} not found` }); return reply.code(400).send({ error: `Team member ID ${support_teamMemberId} not found` });
} }
// ✅ Parse using moment with expected format const assignedAt = moment().format("DD-MM-YYYY HH:mm:ss");
// const start = moment(startDate, "DD-MM-YYYY HH:mm", true);
// const end = moment(endDate, "DD-MM-YYYY HH:mm", true);
// if (!start.isValid() || !end.isValid()) {
// return reply.code(400).send({ error: 'Invalid startDate or endDate format. Use DD-MM-YYYY HH:mm' });
// }
// const formattedStart = start.format("DD-MM-YYYY HH:mm:ss");
// const formattedEnd = end.format("DD-MM-YYYY HH:mm:ss");
let assignedCount = 0; let assignedCount = 0;
support.categorizedIssues.forEach(issue => { support.categorizedIssues.forEach(issue => {
@ -8901,8 +8894,7 @@ 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,
// startDate: formattedStart, assignedAt: assignedAt
// endDate: formattedEnd
}; };
assignedCount++; assignedCount++;
} }
@ -8916,13 +8908,20 @@ 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}`,
assignedTo: teamMember.support_teamMemberId assignedTo: {
support_teamMemberId: teamMember.support_teamMemberId,
name: teamMember.name,
phone: teamMember.phone,
email: teamMember.email,
assignedAt: assignedAt
}
}); });
}; };
exports.getCategorizedIssue = async (request, reply) => { exports.getCategorizedIssue = async (request, reply) => {
try { try {
const { support_teamMemberId, customerId } = request.params; const { support_teamMemberId, customerId } = request.params;

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

Loading…
Cancel
Save