changes on callrecord

master^2
Bhaskar 3 months ago
parent b726ccd0c5
commit 627fde7ee1

@ -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
}));
// 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;
// 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()
};
// const callRecordObj = {
// call_status,
// call_time,
// customerId,
// hardwareId,
// createdAt: new Date()
// };
supportRecord.callRecord = supportRecord.callRecord || [];
supportRecord.callRecord.push(callRecordObj);
// supportRecord.callRecord = supportRecord.callRecord || [];
// supportRecord.callRecord.push(callRecordObj);
// Save support record
await supportRecord.save();

@ -289,7 +289,9 @@ const installationschema = new mongoose.Schema({
});
const CommentSchema = new Schema({
text: { type: String, required: true },
text: { type: String },
call_status: { type: String },
call_time: { type: String },
customerId: String,
hardwareId: String,
createdAt: { type: Date, default: Date.now }
@ -329,7 +331,7 @@ const installationschema = new mongoose.Schema({
timeOfLogin: { type: String, default: null },
currentTime: { type: Date, default: Date.now },
comments: [CommentSchema],
callRecord: [CallRecordSchema],
// callRecord: [CallRecordSchema],
lastTicketRaisedAt: {type : String},
issues: [IssueSchema],

Loading…
Cancel
Save