shuttlepro-shared 1.4.25 → 1.4.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -45,8 +45,9 @@ class CallRepository {
|
|
|
45
45
|
action,
|
|
46
46
|
agentId = null,
|
|
47
47
|
details = "",
|
|
48
|
-
direction = "
|
|
48
|
+
direction = "user",
|
|
49
49
|
platformTimestamp = "",
|
|
50
|
+
actionBy = null,
|
|
50
51
|
}) {
|
|
51
52
|
return {
|
|
52
53
|
timestamp: new Date(),
|
|
@@ -55,6 +56,7 @@ class CallRepository {
|
|
|
55
56
|
agentId,
|
|
56
57
|
details,
|
|
57
58
|
direction,
|
|
59
|
+
actionBy,
|
|
58
60
|
};
|
|
59
61
|
}
|
|
60
62
|
|
|
@@ -72,9 +74,11 @@ class CallRepository {
|
|
|
72
74
|
createCall(callData) {
|
|
73
75
|
const entry = this._historyEntry({
|
|
74
76
|
action: "created",
|
|
75
|
-
direction:
|
|
76
|
-
details: "
|
|
77
|
+
direction: callData?.direction || "user",
|
|
78
|
+
details: callData?.details || "Incomming call from whatsapp user",
|
|
77
79
|
platformTimestamp: callData.platformTimestamp || "",
|
|
80
|
+
agentId: callData.agentId || null,
|
|
81
|
+
actionBy: callData.userId || null,
|
|
78
82
|
});
|
|
79
83
|
|
|
80
84
|
return this._safeExec(
|
|
@@ -105,12 +109,11 @@ class CallRepository {
|
|
|
105
109
|
);
|
|
106
110
|
}
|
|
107
111
|
|
|
108
|
-
endCall(callId,
|
|
109
|
-
const entry = this._historyEntry({ ...history, agentId });
|
|
112
|
+
endCall(callId, updateObj = {}, history = {}) {
|
|
110
113
|
return this._safeExec(
|
|
111
114
|
Call.findOneAndUpdate(
|
|
112
115
|
{ callId },
|
|
113
|
-
{ $set: { ...updateObj }, $push: { callHistory:
|
|
116
|
+
{ $set: { ...updateObj }, $push: { callHistory: history } },
|
|
114
117
|
{ new: true }
|
|
115
118
|
),
|
|
116
119
|
`Failed to end call ${callId}`
|
|
@@ -332,7 +335,7 @@ class CallRepository {
|
|
|
332
335
|
if (match.workspaceId && typeof match.workspaceId === "string")
|
|
333
336
|
match.workspaceId = new Types.ObjectId(match.workspaceId);
|
|
334
337
|
if (match.agentId && typeof match.agentId === "string")
|
|
335
|
-
match.agentId =
|
|
338
|
+
match.agentId = match.agentId;
|
|
336
339
|
|
|
337
340
|
const [stats] = await Call.aggregate([
|
|
338
341
|
{ $match: match },
|
package/models/Call.js
CHANGED
|
@@ -83,6 +83,7 @@ const callSchema = new mongoose.Schema(
|
|
|
83
83
|
},
|
|
84
84
|
direction: String, // USER INITIATED // AGENT INITIATED
|
|
85
85
|
agentId: String, // agent id
|
|
86
|
+
actionBy: String,
|
|
86
87
|
details: String, // "Status changed to hold"
|
|
87
88
|
startTime: String, // platform start time
|
|
88
89
|
endTime: String, // platform endTime time
|