start date and end date added

master^2
Bhaskar 5 months ago
parent 13bff31a0a
commit f77dac00f8

@ -4279,6 +4279,7 @@ exports.assignCategorizeIssue = async (request, reply) => {
exports.getCategorizedIssue = async (request, reply) => {
try {
const { support_teamMemberId } = request.params;
@ -4301,6 +4302,10 @@ exports.getCategorizedIssue = async (request, reply) => {
.map(i => ({ ...i, supportId: s.supportId }))
);
if (!allIssues.length) {
return reply.code(404).send({ message: 'No categorized issues found for this team member.' });
}
const supportId = allIssues[0].supportId;
const hardwareIds = allIssues.map(issue => issue.hardwareId).filter(Boolean);
const masterHardwareIds = allIssues.map(issue => issue.masterHardwareId).filter(Boolean);
@ -4365,7 +4370,13 @@ exports.getCategorizedIssue = async (request, reply) => {
type: "slave",
typeOfWater: "",
support_lora_last_check_time: null,
category: issue?.category || ""
category: issue?.category || "",
startDate: issue?.assignedTo?.startDate
? moment(issue.assignedTo.startDate).format("YYYY-MM-DD HH:mm:ss")
: null,
endDate: issue?.assignedTo?.endDate
? moment(issue.assignedTo.endDate).format("YYYY-MM-DD HH:mm:ss")
: null
});
}
@ -4381,7 +4392,13 @@ exports.getCategorizedIssue = async (request, reply) => {
support_gsm_last_check_time: null,
connected_slave_count: slaveDetails.length,
connected_slaves: slaveDetails,
category: masterIssue?.category || ""
category: masterIssue?.category || "",
startDate: masterIssue?.assignedTo?.startDate
? moment(masterIssue.assignedTo.startDate).format("YYYY-MM-DD HH:mm:ss")
: null,
endDate: masterIssue?.assignedTo?.endDate
? moment(masterIssue.assignedTo.endDate).format("YYYY-MM-DD HH:mm:ss")
: null
});
}
@ -4391,6 +4408,7 @@ exports.getCategorizedIssue = async (request, reply) => {
totalMasters: disconnectedIssues.length,
disconnectedIssues
});
} catch (error) {
console.error("Error in getCategorizedIssue:", error);
return reply.code(500).send({ error: "Internal server error" });

Loading…
Cancel
Save