@dhyasama/totem-models 1.17.5 → 1.17.7

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.
@@ -433,6 +433,12 @@ module.exports = function(mongoose, config) {
433
433
  });
434
434
  }
435
435
 
436
+ // self
437
+ // .find({'people': personId}, this.getReadFilterKeys(role))
438
+ // .populate('fundsInvested.fund')
439
+ // .populate('people', 'name')
440
+ // .exec(cb);
441
+
436
442
  };
437
443
 
438
444
  LimitedPartner.statics.list = function (role, cb) {
@@ -669,11 +675,16 @@ module.exports = function(mongoose, config) {
669
675
  });
670
676
 
671
677
  LimitedPartner.pre('init', function(next) {
672
- if (!LPS_ENABLED) throw new Error('LPS_ENABLED is false');
678
+ if (CUSTOMER_ID != 'GLOBAL_PROCESS' && !LPS_ENABLED) throw new Error('LPS_ENABLED is false');
673
679
  else next();
674
680
  });
675
681
 
676
- LimitedPartner.post('init', function() {
682
+ LimitedPartner.post('init', function(doc, next) {
683
+
684
+ if (CUSTOMER_ID != 'GLOBAL_PROCESS' && !LPS_ENABLED) {
685
+ doc = null;
686
+ return next();
687
+ }
677
688
 
678
689
  // Decrypt sensitive data
679
690
 
@@ -706,6 +717,8 @@ module.exports = function(mongoose, config) {
706
717
 
707
718
  if (this.k1 && this.k1.EIN) { this.k1.EIN = crypto.decrypt(this.k1.EIN); }
708
719
 
720
+ next();
721
+
709
722
  });
710
723
 
711
724
  //////////////////////////////
@@ -730,7 +743,7 @@ module.exports = function(mongoose, config) {
730
743
 
731
744
  //////////////////////////////
732
745
 
733
- LimitedPartner.set('autoIndex', false);
746
+ LimitedPartner.set('autoIndex', true);
734
747
  LimitedPartner.on('index', function(err) { console.log('error building limited partner indexes: ' + err); });
735
748
 
736
749
  LimitedPartner.set('toJSON', { virtuals: true });
@@ -493,6 +493,7 @@ module.exports = function(mongoose, config) {
493
493
 
494
494
  // Check if person is already added
495
495
  var match = _.find(self.people, function(existingPerson) {
496
+ if (existingPerson.person == null) return null;
496
497
  var id = utils.isValidObjectId(existingPerson.person) ? existingPerson.person : existingPerson.person.id;
497
498
  return id.toString() == personToAdd.person.toString();
498
499
  });
@@ -734,7 +735,7 @@ module.exports = function(mongoose, config) {
734
735
  Organization.statics.getById = function getById(id, cb) {
735
736
 
736
737
  var self = this;
737
- console.log(self.customerFunds)
738
+
738
739
  self
739
740
  .findById(id)
740
741
  .populate('people.person', 'name avatarUrl title calendarEventSummaries sources')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "1.17.5",
3
+ "version": "1.17.7",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",