|
|
|
@ -6579,20 +6579,20 @@ exports.getDisconnectedIssuesBySupportId = async (req, reply) => {
|
|
|
|
|
for (const master of Object.values(masterMap)) {
|
|
|
|
|
master.comments = comments;
|
|
|
|
|
|
|
|
|
|
const masterCallRecords = (supportRecord.callRecord || [])
|
|
|
|
|
.filter(record =>
|
|
|
|
|
record.customerId === customerId &&
|
|
|
|
|
record.hardwareId === master.hardwareId
|
|
|
|
|
)
|
|
|
|
|
.map(record => ({
|
|
|
|
|
call_status: record.call_status,
|
|
|
|
|
call_time: record.call_time,
|
|
|
|
|
createdAt: record.createdAt
|
|
|
|
|
? moment(record.createdAt).tz("Asia/Kolkata").format("DD-MM-YYYY HH:mm")
|
|
|
|
|
: null
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
master.callRecord = masterCallRecords;
|
|
|
|
|
// const masterCallRecords = (supportRecord.callRecord || [])
|
|
|
|
|
// .filter(record =>
|
|
|
|
|
// record.customerId === customerId &&
|
|
|
|
|
// record.hardwareId === master.hardwareId
|
|
|
|
|
// )
|
|
|
|
|
// .map(record => ({
|
|
|
|
|
// call_status: record.call_status,
|
|
|
|
|
// call_time: record.call_time,
|
|
|
|
|
// createdAt: record.createdAt
|
|
|
|
|
// ? moment(record.createdAt).tz("Asia/Kolkata").format("DD-MM-YYYY HH:mm")
|
|
|
|
|
// : null
|
|
|
|
|
// }));
|
|
|
|
|
|
|
|
|
|
// master.callRecord = masterCallRecords;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return reply.send({
|
|
|
|
@ -10075,18 +10075,18 @@ if (!orders.length) {
|
|
|
|
|
: null
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
const masterCallRecords = (support.callRecord || [])
|
|
|
|
|
.filter(call =>
|
|
|
|
|
call.hardwareId === master.hardwareId &&
|
|
|
|
|
call.customerId === customerId
|
|
|
|
|
)
|
|
|
|
|
.map(call => ({
|
|
|
|
|
call_status: call.call_status,
|
|
|
|
|
call_time: call.call_time,
|
|
|
|
|
createdAt: call.createdAt
|
|
|
|
|
? moment(call.createdAt).tz("Asia/Kolkata").format("DD-MM-YYYY HH:mm")
|
|
|
|
|
: null
|
|
|
|
|
}));
|
|
|
|
|
// const masterCallRecords = (support.callRecord || [])
|
|
|
|
|
// .filter(call =>
|
|
|
|
|
// call.hardwareId === master.hardwareId &&
|
|
|
|
|
// call.customerId === customerId
|
|
|
|
|
// )
|
|
|
|
|
// .map(call => ({
|
|
|
|
|
// call_status: call.call_status,
|
|
|
|
|
// call_time: call.call_time,
|
|
|
|
|
// createdAt: call.createdAt
|
|
|
|
|
// ? moment(call.createdAt).tz("Asia/Kolkata").format("DD-MM-YYYY HH:mm")
|
|
|
|
|
// : null
|
|
|
|
|
// }));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const trimmedMasterId = (master.hardwareId || "").trim();
|
|
|
|
@ -10112,7 +10112,7 @@ if (!orders.length) {
|
|
|
|
|
support_gm_last_check_time: master.support_gsm_last_check_time || null,
|
|
|
|
|
connected_slaves: slaveDetails,
|
|
|
|
|
comments: masterComments,
|
|
|
|
|
callRecord: masterCallRecords,
|
|
|
|
|
// callRecord: masterCallRecords,
|
|
|
|
|
outDoor_status: master.outDoor_status || "inprogress",
|
|
|
|
|
movedAt: category !== "Resolved" ? (issue?.movedAt || null) : null,
|
|
|
|
|
resolvedAt: category === "Resolved" ? (issue?.resolvedAt || null) : null,
|
|
|
|
@ -10697,6 +10697,8 @@ exports.updateComments = async (req, reply) => {
|
|
|
|
|
// Step 4: Add comment
|
|
|
|
|
const commentObj = {
|
|
|
|
|
text: trimmedComment,
|
|
|
|
|
call_status,
|
|
|
|
|
call_time,
|
|
|
|
|
customerId,
|
|
|
|
|
hardwareId,
|
|
|
|
|
createdAt: new Date()
|
|
|
|
@ -10706,16 +10708,16 @@ exports.updateComments = async (req, reply) => {
|
|
|
|
|
supportRecord.comments.push(commentObj);
|
|
|
|
|
|
|
|
|
|
// Step 5: Add call record
|
|
|
|
|
const callRecordObj = {
|
|
|
|
|
call_status,
|
|
|
|
|
call_time,
|
|
|
|
|
customerId,
|
|
|
|
|
hardwareId,
|
|
|
|
|
createdAt: new Date()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
supportRecord.callRecord = supportRecord.callRecord || [];
|
|
|
|
|
supportRecord.callRecord.push(callRecordObj);
|
|
|
|
|
// const callRecordObj = {
|
|
|
|
|
// call_status,
|
|
|
|
|
// call_time,
|
|
|
|
|
// customerId,
|
|
|
|
|
// hardwareId,
|
|
|
|
|
// createdAt: new Date()
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// supportRecord.callRecord = supportRecord.callRecord || [];
|
|
|
|
|
// supportRecord.callRecord.push(callRecordObj);
|
|
|
|
|
|
|
|
|
|
// Save support record
|
|
|
|
|
await supportRecord.save();
|
|
|
|
|