@dhyasama/totem-models 6.6.3 → 6.7.0
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.
- package/.npmignore +14 -0
- package/lib/Interaction.js +17 -0
- package/package-lock.json +1829 -0
- package/package.json +1 -1
package/.npmignore
ADDED
package/lib/Interaction.js
CHANGED
|
@@ -155,6 +155,23 @@ module.exports = function(mongoose, config) {
|
|
|
155
155
|
|
|
156
156
|
};
|
|
157
157
|
|
|
158
|
+
Interaction.statics.getMostRecent = function getMostRecent(customerId, personIds, cb) {
|
|
159
|
+
|
|
160
|
+
// Gets the most recent interaction with a customer across a list of people
|
|
161
|
+
// Typically used to get the last interaction the firm had with an org
|
|
162
|
+
// So you'd pass in the id of the customer and a list of the people at an org and get back the most recent interaction
|
|
163
|
+
|
|
164
|
+
var self = this;
|
|
165
|
+
|
|
166
|
+
var query = self
|
|
167
|
+
.find({'totemCustomerId': customerId, 'attendees.external': { $in : personIds }})
|
|
168
|
+
.sort({'startTime': -1})
|
|
169
|
+
.limit(1);
|
|
170
|
+
|
|
171
|
+
query.exec(cb);
|
|
172
|
+
|
|
173
|
+
};
|
|
174
|
+
|
|
158
175
|
Interaction.statics.getNotes = function getNotes(personIds, options, cb) {
|
|
159
176
|
|
|
160
177
|
var self = this;
|