|
|
|
@ -9206,6 +9206,12 @@ exports.resolvedIssuesForSupport = async (req, reply) => {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!["Escalation", "Pending"].includes(category)) {
|
|
|
|
|
return reply.code(400).send({
|
|
|
|
|
message: "Invalid category. Only 'Escalation' or 'Pending' are allowed",
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const support = await Support.findOne({ supportId });
|
|
|
|
|
if (!support) {
|
|
|
|
|
return reply.code(404).send({ message: "Support record not found" });
|
|
|
|
@ -9297,22 +9303,23 @@ exports.resolvedIssuesForSupport = async (req, reply) => {
|
|
|
|
|
support.resolvedIssues[resolvedIndex].invalidatedAt = nowTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Move or update issue in categorizedIssues
|
|
|
|
|
if (categorizedIndex === -1) {
|
|
|
|
|
// Not in categorized — add with Escalation category
|
|
|
|
|
// Not in categorized — add with category from body
|
|
|
|
|
support.categorizedIssues.push({
|
|
|
|
|
type: issue.type,
|
|
|
|
|
hardwareId: issue.hardwareId,
|
|
|
|
|
masterHardwareId,
|
|
|
|
|
ticketId: issue.ticketId,
|
|
|
|
|
category: "Escalation",
|
|
|
|
|
category: category,
|
|
|
|
|
movedAt: nowTime,
|
|
|
|
|
movedToCategory: true,
|
|
|
|
|
slaveName: issue.slaveName || null,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// Already in categorized — update if category not "Escalation"
|
|
|
|
|
if (support.categorizedIssues[categorizedIndex].category !== "Escalation") {
|
|
|
|
|
support.categorizedIssues[categorizedIndex].category = "Escalation";
|
|
|
|
|
// Already in categorized — update if category has changed
|
|
|
|
|
if (support.categorizedIssues[categorizedIndex].category !== category) {
|
|
|
|
|
support.categorizedIssues[categorizedIndex].category = category;
|
|
|
|
|
support.categorizedIssues[categorizedIndex].movedAt = nowTime;
|
|
|
|
|
support.categorizedIssues[categorizedIndex].movedToCategory = true;
|
|
|
|
|
}
|
|
|
|
@ -9320,7 +9327,7 @@ exports.resolvedIssuesForSupport = async (req, reply) => {
|
|
|
|
|
|
|
|
|
|
await support.save();
|
|
|
|
|
return reply.send({
|
|
|
|
|
message: "Master or some slaves are disconnected. Issue moved/kept in escalation category.",
|
|
|
|
|
message: `Master or some slaves are disconnected. Issue moved/kept in '${category}' category.`,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
|
|
|
@ -9329,3 +9336,4 @@ exports.resolvedIssuesForSupport = async (req, reply) => {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|