@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 ADDED
@@ -0,0 +1,14 @@
1
+ lib-cov
2
+ *.seed
3
+ *.log
4
+ *.csv
5
+ *.dat
6
+ *.out
7
+ *.pid
8
+ *.gz
9
+
10
+ npm-debug.log
11
+ node_modules
12
+
13
+ .DS_Store
14
+ .idea
@@ -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;