master^2
Bhaskar 4 months ago
parent 93599bfcf5
commit 2b7234ad1e

@ -5345,6 +5345,7 @@ exports.particularCategory = async (req, reply) => {
}; };
exports.assignCategorizeIssue = async (request, reply) => { exports.assignCategorizeIssue = async (request, reply) => {
const { supportId } = request.params; const { supportId } = request.params;
const { support_teamMemberId, startDate, endDate, category, masterHardwareId } = request.body; const { support_teamMemberId, startDate, endDate, category, masterHardwareId } = request.body;
@ -5371,21 +5372,24 @@ exports.assignCategorizeIssue = async (request, reply) => {
return reply.code(400).send({ error: 'Invalid startDate or endDate' }); return reply.code(400).send({ error: 'Invalid startDate or endDate' });
} }
// ✅ Format to "DD-MM-YYYY HH:mm:ss"
const formattedStart = moment(start).format("DD-MM-YYYY HH:mm:ss");
const formattedEnd = moment(end).format("DD-MM-YYYY HH:mm:ss");
let assignedCount = 0; let assignedCount = 0;
support.categorizedIssues.forEach(issue => { support.categorizedIssues.forEach(issue => {
const issueDate = new Date(issue.movedAt);
if ( if (
issue.masterHardwareId === masterHardwareId && issue.masterHardwareId === masterHardwareId &&
issue.category === category issue.category === category
) { ) {
issue.assignedTo = { issue.assignedTo = {
name: teamMember.name, name: teamMember.name,
support_teamMemberId: teamMember.support_teamMemberId, support_teamMemberId: teamMember.support_teamMemberId,
phone: teamMember.phone, phone: teamMember.phone,
email: teamMember.email, email: teamMember.email,
startDate: startDate, // Add startDate startDate: formattedStart, // 👈 use formatted date
endDate: endDate // Add endDate endDate: formattedEnd // 👈 use formatted date
}; };
assignedCount++; assignedCount++;
} }

Loading…
Cancel
Save