@dhyasama/totem-models 5.3.4 → 5.4.1

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
package/lib/Message.js CHANGED
@@ -262,6 +262,18 @@ module.exports = function(mongoose, config) {
262
262
 
263
263
  };
264
264
 
265
+ Message.statics.getUnprocessedDeals = function getUnprocessedDeals(customerId, cb) {
266
+
267
+ var self = this;
268
+ var query = self.find({
269
+ customer: customerId,
270
+ subtype: 'deals',
271
+ organization: { $exists: false }
272
+ });
273
+ query.exec(cb);
274
+
275
+ };
276
+
265
277
  Message.statics.upsert = function(message, cb) {
266
278
  message.createdOn = new Date();
267
279
  message.save(cb);
@@ -1541,6 +1541,9 @@ module.exports = function(mongoose, config) {
1541
1541
  org.entered.by = username;
1542
1542
  org.entered.on = new Date();
1543
1543
 
1544
+ // Clean up missing references
1545
+ org.people = _.reject(org.people, function(item) { return !item.person; });
1546
+
1544
1547
  org.save(cb);
1545
1548
 
1546
1549
  };