|
|
|
|
@ -5128,6 +5128,7 @@ exports.raiseATicketSlave = async (req, reply) => {
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.getDisconnectedIssuesBySupportId = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
|
const { supportId, customerId } = req.params;
|
|
|
|
|
@ -5305,9 +5306,15 @@ exports.getDisconnectedIssuesBySupportId = async (req, reply) => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const commentTexts = (supportRecord.comments || []).map(c => c.text);
|
|
|
|
|
// Add comments with text and createdAt to each master device
|
|
|
|
|
const comments = (supportRecord.comments || []).map(c => ({
|
|
|
|
|
text: c.text,
|
|
|
|
|
commentsTime: moment(c.createdAt).tz("Asia/Kolkata").format("DD-MM-YYYY HH:mm")
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const master of Object.values(masterMap)) {
|
|
|
|
|
master.comments = commentTexts;
|
|
|
|
|
master.comments = comments;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return reply.send({
|
|
|
|
|
@ -5325,6 +5332,7 @@ exports.getDisconnectedIssuesBySupportId = async (req, reply) => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// exports.getRemoveConnectedMastersWithSlaves = async (req, reply) => {
|
|
|
|
|
// try {
|
|
|
|
|
// const { supportId } = req.params;
|
|
|
|
|
@ -7071,19 +7079,18 @@ exports.updateComments = async (req, reply) => {
|
|
|
|
|
return reply.code(404).send({ error: "HardwareId not found in this support record's issues" });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Step 4: Append comment object correctly
|
|
|
|
|
// Step 4: Append comment object with formatted createdAt
|
|
|
|
|
const commentObj = {
|
|
|
|
|
text: trimmedComment,
|
|
|
|
|
customerId,
|
|
|
|
|
hardwareId,
|
|
|
|
|
createdAt: new Date()
|
|
|
|
|
createdAt: moment().format("DD-MM-YYYY HH:mm")
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (!Array.isArray(supportRecord.comments)) {
|
|
|
|
|
supportRecord.comments = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Use push instead of spreading to keep Mongoose subdoc validation intact
|
|
|
|
|
supportRecord.comments.push(commentObj);
|
|
|
|
|
|
|
|
|
|
await supportRecord.save();
|
|
|
|
|
@ -7095,4 +7102,3 @@ exports.updateComments = async (req, reply) => {
|
|
|
|
|
return reply.code(500).send({ error: "Internal server error" });
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|