shuttlepro-shared 1.4.27 → 1.4.29

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.
@@ -120,36 +120,13 @@ class CallRepository {
120
120
  );
121
121
  }
122
122
 
123
- updateCall(callId, updateData) {
124
- const allowed = [
125
- "status",
126
- "agentId",
127
- "callerName",
128
- "callerNumber",
129
- "tags",
130
- "metadata",
131
- "platformId",
132
- "workspaceId",
133
- "profileId",
134
- "receiver",
135
- ];
136
- const filtered = this._filterAllowedFields(updateData, allowed);
137
-
123
+ updateCall(callId, updateData, history = {}) {
138
124
  const updateOps = {
139
- $set: { ...filtered, "connectionMetadata.lastHeartbeat": new Date() },
125
+ $set: { ...updateData },
126
+ };
127
+ updateOps.$push = {
128
+ callHistory: history,
140
129
  };
141
-
142
- if (updateData.status) {
143
- updateOps.$push = {
144
- callHistory: this._historyEntry({
145
- action: updateData.status,
146
- agentId: updateData.agentId,
147
- details:
148
- updateData.reason || `Status changed to ${updateData.status}`,
149
- }),
150
- };
151
- }
152
-
153
130
  return this._safeExec(
154
131
  Call.findOneAndUpdate({ callId }, updateOps, { new: true }),
155
132
  `Failed to update call ${callId}`
@@ -266,6 +243,18 @@ class CallRepository {
266
243
  return query.exec();
267
244
  }
268
245
 
246
+ async addCallHistory(callId, historyData = {}) {
247
+ const entry = historyData;
248
+ return this._safeExec(
249
+ Call.findOneAndUpdate(
250
+ { callId },
251
+ { $push: { callHistory: entry } },
252
+ { new: true }
253
+ ),
254
+ `Failed to add call history for ${callId}`
255
+ );
256
+ }
257
+
269
258
  getCallsByAgent(
270
259
  agentId,
271
260
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shuttlepro-shared",
3
- "version": "1.4.27",
3
+ "version": "1.4.29",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {