@dhyasama/totem-models 7.43.0 → 7.45.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/lib/Account.js CHANGED
@@ -192,6 +192,7 @@ module.exports = function(mongoose, config) {
192
192
  });
193
193
 
194
194
  Account.set('autoIndex', false);
195
+ Account.set('usePushEach', true);
195
196
  Account.on('index', function(err) { console.log('error building account indexes: ' + err); });
196
197
 
197
198
  var deepPopulate = require('mongoose-deep-populate')(mongoose);
package/lib/Activity.js CHANGED
@@ -131,6 +131,7 @@ module.exports = function(mongoose, config) {
131
131
  };
132
132
 
133
133
  Activity.set('autoIndex', false);
134
+ Activity.set('usePushEach', true);
134
135
  Activity.on('index', function(err) { console.log('error building activity indexes: ' + err); });
135
136
 
136
137
  mongoose.model('Activity', Activity);
@@ -183,6 +183,7 @@ module.exports = function(mongoose, config) {
183
183
  });
184
184
 
185
185
  CalendarEvent.set('autoIndex', false);
186
+ CalendarEvent.set('usePushEach', true);
186
187
  CalendarEvent.on('index', function(err) { console.log('error building calendar event indexes: ' + err); });
187
188
 
188
189
  mongoose.model('CalendarEvent', CalendarEvent);
package/lib/CapTable.js CHANGED
@@ -419,6 +419,7 @@ module.exports = function(mongoose, config) {
419
419
  ///////////////////////////////////////////////////////////////////////////////////////
420
420
 
421
421
  CapTable.set('toJSON', { virtuals: true });
422
+ CapTable.set('usePushEach', true);
422
423
  CapTable.set('autoIndex', false);
423
424
 
424
425
  CapTable.index({ organization: 1, customer: 1 }, { unique: true, partialFilterExpression : { type :"string" } });
package/lib/Deal.js CHANGED
@@ -333,13 +333,13 @@ module.exports = function(mongoose, config) {
333
333
 
334
334
  deal.history = deal.history || [];
335
335
 
336
- deal.history = deal.history.concat([{
336
+ deal.history.push({
337
337
  timestamp: new Date(),
338
338
  account: user,
339
339
  stage: deal.stage,
340
340
  fundraise: deal.fundraise,
341
341
  description: description
342
- }]);
342
+ });
343
343
 
344
344
  }
345
345
 
@@ -388,6 +388,7 @@ module.exports = function(mongoose, config) {
388
388
 
389
389
  Deal.set('toJSON', { virtuals: true });
390
390
  Deal.set('autoIndex', false);
391
+ Deal.set('usePushEach', true);
391
392
  Deal.on('index', function(err) { console.log('error building deal indexes: ' + err); });
392
393
 
393
394
  var deepPopulate = require('mongoose-deep-populate')(mongoose);
package/lib/Document.js CHANGED
@@ -202,6 +202,7 @@ module.exports = function(mongoose, config) {
202
202
 
203
203
  Document.set('toJSON', { virtuals: true });
204
204
  Document.set('autoIndex', false);
205
+ Document.set('usePushEach', true);
205
206
  Document.on('index', function(err) { console.log('error building document indexes: ' + err); });
206
207
 
207
208
  mongoose.model('Document', Document);
package/lib/Financials.js CHANGED
@@ -514,6 +514,7 @@ module.exports = function(mongoose, config) {
514
514
  ///////////////////////////////////////////////////////////////////////////////////////
515
515
 
516
516
  Financials.set('toJSON', { virtuals: true });
517
+ Financials.set('usePushEach', true);
517
518
  Financials.set('autoIndex', false);
518
519
 
519
520
  Financials.on('index', function(err) { console.log('error building financials indexes: ' + err); });
package/lib/Flag.js CHANGED
@@ -95,6 +95,7 @@ module.exports = function(mongoose, config) {
95
95
  });
96
96
 
97
97
  Flag.set('autoIndex', false);
98
+ Flag.set('usePushEach', true);
98
99
  Flag.on('index', function(err) { console.log('error building Flag indexes: ' + err); });
99
100
 
100
101
  mongoose.model('Flag', Flag);
package/lib/Fund.js CHANGED
@@ -195,6 +195,7 @@ module.exports = function(mongoose, config) {
195
195
  });
196
196
 
197
197
  Fund.set('autoIndex', false);
198
+ Fund.set('usePushEach', true);
198
199
  Fund.on('index', function(err) { console.log('error building fund indexes: ' + err); });
199
200
 
200
201
  mongoose.model('Fund', Fund);
@@ -222,6 +222,7 @@ module.exports = function(mongoose, config) {
222
222
  };
223
223
 
224
224
  Interaction.set('autoIndex', false);
225
+ Interaction.set('usePushEach', true);
225
226
  Interaction.on('index', function(err) { console.log('error building interaction indexes: ' + err); });
226
227
 
227
228
  var deepPopulate = require('mongoose-deep-populate')(mongoose);
package/lib/Investment.js CHANGED
@@ -171,6 +171,7 @@ module.exports = function(mongoose, config) {
171
171
  ///////////////////////////////////////////////////////////////////////////////////////
172
172
 
173
173
  Investment.set('toJSON', { virtuals: true });
174
+ Investment.set('usePushEach', true);
174
175
  Investment.set('autoIndex', false);
175
176
 
176
177
  Investment.on('index', function(err) { console.log('error building Investment indexes: ' + err); });
@@ -345,7 +345,7 @@ module.exports = function(mongoose, config) {
345
345
  return personId.toString() == idOfPersonToAdd.toString();
346
346
  });
347
347
 
348
- if (!match) this.people = this.people.concat([idOfPersonToAdd]);
348
+ if (!match) this.people.push(idOfPersonToAdd);
349
349
 
350
350
  };
351
351
 
@@ -957,6 +957,7 @@ module.exports = function(mongoose, config) {
957
957
  //////////////////////////////
958
958
 
959
959
  LimitedPartner.set('autoIndex', false);
960
+ LimitedPartner.set('usePushEach', true);
960
961
  LimitedPartner.on('index', function(err) { console.log('error building limited partner indexes: ' + err); });
961
962
 
962
963
  LimitedPartner.set('toJSON', { virtuals: true });
package/lib/List.js CHANGED
@@ -95,7 +95,7 @@ module.exports = function(mongoose, config) {
95
95
  if (err) return cb(err, null);
96
96
  if (!result) return cb(null, null);
97
97
 
98
- result[collection] = result.collection.concat([itemId]);
98
+ result[collection].push(itemId);
99
99
 
100
100
  result.save(cb);
101
101
 
@@ -297,6 +297,7 @@ module.exports = function(mongoose, config) {
297
297
  });
298
298
 
299
299
  List.set('autoIndex', false);
300
+ List.set('usePushEach', true);
300
301
  List.on('index', function(err) { console.log('error building list indexes: ' + err); });
301
302
 
302
303
  mongoose.model('List', List);
package/lib/Message.js CHANGED
@@ -329,6 +329,7 @@ module.exports = function(mongoose, config) {
329
329
  ///////////////////////////////////////
330
330
 
331
331
  Message.set('autoIndex', false);
332
+ Message.set('usePushEach', true);
332
333
  Message.set('toJSON', { virtuals: true });
333
334
 
334
335
  var deepPopulate = require('mongoose-deep-populate')(mongoose);
package/lib/News.js CHANGED
@@ -120,6 +120,7 @@ module.exports = function(mongoose, config) {
120
120
  };
121
121
 
122
122
  News.set('autoIndex', false);
123
+ News.set('usePushEach', true);
123
124
  News.on('index', function(err) { console.log('error building news indexes: ' + err); });
124
125
 
125
126
  mongoose.model('News', News);
package/lib/Note.js CHANGED
@@ -133,6 +133,7 @@ module.exports = function(mongoose, config) {
133
133
  });
134
134
 
135
135
  Note.set('autoIndex', false);
136
+ Note.set('usePushEach', true);
136
137
  Note.on('index', function(err) { console.log('error building note indexes: ' + err); });
137
138
 
138
139
  mongoose.model('Note', Note);
@@ -570,7 +570,7 @@ module.exports = function(mongoose, config) {
570
570
  // Add website to website aliases
571
571
  // There are unique constraints on website and website aliases
572
572
  // This enables us to enforce uniqueness across both and across documents
573
- if (obj.website && obj.websiteAliases) obj.websiteAliases = obj.websiteAliases.concat([obj.website]);
573
+ if (obj.website && obj.websiteAliases) obj.websiteAliases.push(obj.website);
574
574
 
575
575
  if (obj.websiteAliases) {
576
576
  obj.websiteAliases = _.uniq(obj.websiteAliases);
@@ -1068,7 +1068,7 @@ module.exports = function(mongoose, config) {
1068
1068
  if (dealMatch) { dealMatch = deal; }
1069
1069
 
1070
1070
  // Add the deal
1071
- else self.deals = self.deals.concat([deal]);
1071
+ else { self.deals.push(deal); }
1072
1072
 
1073
1073
  };
1074
1074
 
@@ -1089,7 +1089,7 @@ module.exports = function(mongoose, config) {
1089
1089
  });
1090
1090
 
1091
1091
  // If not, add it
1092
- if (!match) self.people = self.people.concat([personToAdd]);
1092
+ if (!match) self.people.push(personToAdd);
1093
1093
 
1094
1094
  };
1095
1095
 
@@ -1117,7 +1117,7 @@ module.exports = function(mongoose, config) {
1117
1117
  return orgId.toString() == id.toString();
1118
1118
  });
1119
1119
 
1120
- if (!match) self.related = self.related.concat([id]);
1120
+ if (!match) { self.related.push(id); }
1121
1121
 
1122
1122
  };
1123
1123
 
@@ -1202,7 +1202,7 @@ module.exports = function(mongoose, config) {
1202
1202
 
1203
1203
  var addDealToOrg = function addDealToOrg(previous, callback) {
1204
1204
 
1205
- previous.org.deals = previous.org.deals.concat([previous.deal]);
1205
+ previous.org.deals.push(previous.deal);
1206
1206
 
1207
1207
  self.upsert(previous.org, previous.user.username, function(err, result) {
1208
1208
 
@@ -2207,6 +2207,7 @@ module.exports = function(mongoose, config) {
2207
2207
  ///////////////////////////////////////////////////////////////////////////////////////
2208
2208
 
2209
2209
  Organization.set('toJSON', { virtuals: true });
2210
+ Organization.set('usePushEach', true);
2210
2211
  Organization.set('autoIndex', false);
2211
2212
 
2212
2213
  Organization.index({ website: 1, websiteAliases: 1 }, { unique: true, partialFilterExpression : { type :"string" } });
package/lib/Person.js CHANGED
@@ -233,7 +233,7 @@ module.exports = function(mongoose, config) {
233
233
  };
234
234
 
235
235
  Person.methods.relatePerson = function(id) {
236
- this.related = this.related.concat([id]);
236
+ this.related.push(id);
237
237
  };
238
238
 
239
239
  Person.methods.addChairPos = function(chairObj, orgId) {
@@ -245,11 +245,11 @@ module.exports = function(mongoose, config) {
245
245
 
246
246
  switch(chairObj.num) {
247
247
  case 'chair1':
248
- this.chairs.first = this.chairs.first.concat([chair]);
248
+ this.chairs.first.push(chair);
249
249
  break;
250
250
 
251
251
  case 'chair2':
252
- this.chairs.second = this.chairs.second.concat([chair]);
252
+ this.chairs.second.push(chair);
253
253
  break;
254
254
  }
255
255
 
@@ -276,12 +276,12 @@ module.exports = function(mongoose, config) {
276
276
  }
277
277
 
278
278
  if(chairObj.val && chairObj.val == "") {
279
- this.previous = this.previous.concat([{
279
+ this.previous.push({
280
280
  field: field,
281
281
  value: {
282
282
  company: orgId
283
283
  }
284
- }]);
284
+ });
285
285
  }
286
286
 
287
287
  };
@@ -459,7 +459,7 @@ module.exports = function(mongoose, config) {
459
459
 
460
460
  if (validator.isEmail(data.rawQuery)) {
461
461
  if (data.emails.indexOf(data.rawQuery) == -1) {
462
- data.emails = data.emails.concat([data.rawQuery]);
462
+ data.emails.push(data.rawQuery);
463
463
  }
464
464
  }
465
465
 
@@ -474,7 +474,7 @@ module.exports = function(mongoose, config) {
474
474
 
475
475
  if (pn.isValid()) {
476
476
  if (data.phones.indexOf(data.rawQuery) == -1) {
477
- data.phones = data.phones.concat([data.rawQuery]);
477
+ data.phones.push(data.rawQuery);
478
478
  }
479
479
  }
480
480
 
@@ -1068,11 +1068,11 @@ module.exports = function(mongoose, config) {
1068
1068
 
1069
1069
  switch(chairPos) {
1070
1070
  case 'first':
1071
- person.chairs.first = person.chairs.first.concat([chairObj]);
1071
+ person.chairs.first.push(chairObj);
1072
1072
  break;
1073
1073
 
1074
1074
  case 'second':
1075
- person.chairs.second = person.chairs.second.concat([chairObj]);
1075
+ person.chairs.second.push(chairObj);
1076
1076
  break;
1077
1077
  }
1078
1078
 
@@ -1351,6 +1351,7 @@ module.exports = function(mongoose, config) {
1351
1351
  Person.plugin(deepPopulate);
1352
1352
 
1353
1353
  Person.set('autoIndex', false);
1354
+ Person.set('usePushEach', true);
1354
1355
  Person.on('index', function(err) { console.log('error building person indexes: ' + err); });
1355
1356
 
1356
1357
  Person.set('toJSON', { virtuals: true });
package/lib/Round.js CHANGED
@@ -315,7 +315,7 @@ module.exports = function(mongoose, config) {
315
315
  });
316
316
 
317
317
  // If not, add it
318
- if (!match) vehicle.investments = vehicle.investments.concat([investment]);
318
+ if (!match) vehicle.investments.push(investment);
319
319
  // note there is no need to compute vehicle cost as it is done during upsert
320
320
 
321
321
  };
@@ -342,7 +342,9 @@ module.exports = function(mongoose, config) {
342
342
  });
343
343
 
344
344
  // If not, add it
345
- if (!match) self.people = self.people.concat([{person: person}]);
345
+ if (!match) self.people.push({
346
+ person: person
347
+ });
346
348
 
347
349
  };
348
350
 
@@ -390,7 +392,7 @@ module.exports = function(mongoose, config) {
390
392
  realized: data.realized,
391
393
  valuationDate: data.valuationDate
392
394
  };
393
- self.vehicles = self.vehicles.concat([vehicle]);
395
+ self.vehicles.push(vehicle);
394
396
  }
395
397
 
396
398
  return vehicle;
@@ -898,6 +900,7 @@ module.exports = function(mongoose, config) {
898
900
  ///////////////////////////////////////////////////////////////////////////////////////
899
901
 
900
902
  Round.set('toJSON', { virtuals: true });
903
+ Round.set('usePushEach', true);
901
904
  Round.set('autoIndex', false);
902
905
 
903
906
  Round.index({ organization: 1, roundName: 1 }, { unique: true, partialFilterExpression : { type :"string" } });
package/lib/Snapshot.js CHANGED
@@ -28,6 +28,8 @@ module.exports = function(mongoose, config) {
28
28
  snapshot.save(cb);
29
29
  };
30
30
 
31
+ Snapshot.set('usePushEach', true);
32
+
31
33
  mongoose.model('Snapshot', Snapshot, '_Snapshots');
32
34
 
33
35
  };
package/lib/Sync.js CHANGED
@@ -41,6 +41,7 @@ module.exports = function(mongoose, config) {
41
41
  };
42
42
 
43
43
  Sync.set('autoIndex', false);
44
+ Sync.set('usePushEach', true);
44
45
 
45
46
  mongoose.model('Sync', Sync, 'syncs');
46
47
 
package/lib/Webhook.js CHANGED
@@ -24,6 +24,7 @@ module.exports = function(mongoose, config) {
24
24
  };
25
25
 
26
26
  Webhook.set('autoIndex', false);
27
+ Webhook.set('usePushEach', true);
27
28
 
28
29
  mongoose.model('Webhook', Webhook);
29
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "7.43.0",
3
+ "version": "7.45.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",
@@ -31,7 +31,7 @@
31
31
  "devDependencies": {
32
32
  "mocha": "^5.2.0",
33
33
  "mocha-mongoose": "^1.2.0",
34
- "mongoose": "~4.5.7",
34
+ "mongoose": "~4.6.4",
35
35
  "nock": "^7.2.2",
36
36
  "rewire": "^3.0.2",
37
37
  "should": "^11.1.1"