@dhyasama/totem-models 8.4.0 → 8.5.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.
@@ -570,6 +570,32 @@ module.exports = function(mongoose, config) {
570
570
 
571
571
  };
572
572
 
573
+ LimitedPartner.statics.list = function (customerId, options, cb) {
574
+
575
+ const self = this;
576
+
577
+ if (!cb) { throw new Error('cb is required'); }
578
+ if (!customerId) { return cb(new Error('customerId is required'), null); }
579
+ if (!mongoose.Types.ObjectId.isValid(customerId)) { return cb(new Error('customerId is not a valid ObjectId'), null); }
580
+ if (!options) { return cb(new Error('options is required'), null); }
581
+
582
+ options = helpers.getDefaultOptions(options);
583
+
584
+ let query;
585
+
586
+ if (options.isWorkerProcess) {
587
+ query = self.find({}, self.getReadFilterKeys(options.role));
588
+ }
589
+ else {
590
+ query = self.find({ 'fundsInvested.fund': { $in : self.customerFunds }}, self.getReadFilterKeys(options.role));
591
+ }
592
+
593
+ query.populate('fundsInvested.fund');
594
+ query.sort({ 'name': -1 });
595
+ query.exec(cb);
596
+
597
+ };
598
+
573
599
  LimitedPartner.statics.listByFund = function (fundId, options, cb) {
574
600
 
575
601
  const self = this;
package/lib/Person.js CHANGED
@@ -314,7 +314,7 @@ module.exports = function(mongoose, config) {
314
314
 
315
315
  this
316
316
  .find({ 'contact.email.email': { $in : emails }, 'deleted': {$ne: true}})
317
- .select('name avatarUrl title doNotDisplay')
317
+ .select('name avatarUrl title doNotDisplay contact')
318
318
  .sort('name.full')
319
319
  .exec(cb);
320
320
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "8.4.0",
3
+ "version": "8.5.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",