@dhyasama/totem-models 11.36.0 → 11.38.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.
@@ -446,11 +446,13 @@ module.exports = function(mongoose, config) {
446
446
 
447
447
  });
448
448
 
449
- lp.transactions = _.filter(lp.transactions, function(transaction) {
450
- return _.find(options.funds, function(f) {
451
- return transaction.fund._id.toString() === f.toString();
449
+ if (options.fundids) {
450
+ lp.transactions = _.filter(lp.transactions, function(transaction) {
451
+ return _.find(options.fundids, function(f) {
452
+ return transaction.fund._id.toString() === f.toString();
453
+ });
452
454
  });
453
- });
455
+ }
454
456
 
455
457
  return cb(null, lp);
456
458
 
@@ -661,7 +663,7 @@ module.exports = function(mongoose, config) {
661
663
  query = self.find({}, getReadFilterKeys(options.role));
662
664
  }
663
665
  else {
664
- query = self.find({ 'transactions.fund': { $in : options.funds }}, getReadFilterKeys(options.role));
666
+ query = self.find({ 'transactions.fund': { $in : options.fundids }, customer: customerId }, getReadFilterKeys(options.role));
665
667
  }
666
668
 
667
669
  query.populate('transactions.fund');
@@ -671,13 +673,15 @@ module.exports = function(mongoose, config) {
671
673
 
672
674
  if (err) return cb(err);
673
675
 
674
- _.each(result, function(lp) {
675
- lp.transactions = _.filter(lp.transactions, function(transaction) {
676
- return _.find(options.funds, function(f) {
677
- return transaction.fund._id.toString() === f.toString();
676
+ if (options.fundids) {
677
+ _.each(result, function(lp) {
678
+ lp.transactions = _.filter(lp.transactions, function(transaction) {
679
+ return _.find(options.fundids, function(f) {
680
+ return transaction.fund._id.toString() === f.toString();
681
+ });
678
682
  });
679
683
  });
680
- });
684
+ }
681
685
 
682
686
  return cb(null, result);
683
687
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "11.36.0",
3
+ "version": "11.38.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",