@dhyasama/totem-models 1.17.2 → 1.17.4

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.
@@ -10,6 +10,7 @@ module.exports = function(mongoose, config) {
10
10
  Schema = mongoose.Schema,
11
11
  Note = mongoose.model('Note'),
12
12
 
13
+ customerFunds = [],
13
14
  customerPortfolio = [],
14
15
 
15
16
  Organization = new Schema({
@@ -733,7 +734,7 @@ module.exports = function(mongoose, config) {
733
734
  Organization.statics.getById = function getById(id, cb) {
734
735
 
735
736
  var self = this;
736
-
737
+ console.log(self.customerFunds)
737
738
  self
738
739
  .findById(id)
739
740
  .populate('people.person', 'name avatarUrl title calendarEventSummaries sources')
@@ -1026,6 +1027,12 @@ module.exports = function(mongoose, config) {
1026
1027
 
1027
1028
  };
1028
1029
 
1030
+ Organization.statics.setCustomerFunds = function setCustomerFunds(fundids) {
1031
+ var self = this;
1032
+ self.customerFunds = fundids;
1033
+ return self.customerFunds;
1034
+ };
1035
+
1029
1036
  Organization.statics.setCustomerPortfolio = function setCustomerPortfolio(portfolio) {
1030
1037
  var self = this;
1031
1038
  self.customerPortfolio = portfolio;
@@ -1105,6 +1112,20 @@ module.exports = function(mongoose, config) {
1105
1112
 
1106
1113
  });
1107
1114
 
1115
+ // var customerFunds = doc.constructor.customerFunds;
1116
+ // //console.log('customerFunds', customerFunds);
1117
+ // doc.lps = _.filter(doc.lps, function(lp) {
1118
+ // var lpFunds = _.pluck(lp.fundsInvested, 'fund');
1119
+ // var intersection = _.intersection(lpFunds, customerFunds);
1120
+ // return intersection.length >= 1;
1121
+ // });
1122
+
1123
+ // will there ever be a reason to show an org's lps?
1124
+ // a customer should only be able to see their own lps, which are queried and viewable on /lps
1125
+ // and if it's not used, why is it here?
1126
+ // todo - research flipping ref onto lp model
1127
+ doc.lps = [];
1128
+
1108
1129
  return next();
1109
1130
 
1110
1131
  });
package/lib/Round.js CHANGED
@@ -816,6 +816,10 @@ module.exports = function(mongoose, config) {
816
816
  if (mostRecentInvestment.closingDate) doc.closingDate = mostRecentInvestment.closingDate;
817
817
  }
818
818
 
819
+ doc.vehicles = _.filter(doc.vehicles, function(v) {
820
+ return v.investments.length >= 1;
821
+ });
822
+
819
823
  });
820
824
 
821
825
  return next();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "1.17.2",
3
+ "version": "1.17.4",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",