@dhyasama/totem-models 9.39.0 → 9.40.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.
@@ -39,7 +39,7 @@ module.exports = function(mongoose, config) {
39
39
 
40
40
  transactions: [{
41
41
  fund: {type: Schema.ObjectId, ref: 'Fund'},
42
- type: { type: String, enum: ['commitment', 'contribution', 'distribution', 'fee', 'expense', 'carry', 'income', 'realized', 'unrealized'] },
42
+ type: { type: String, enum: ['commitment', 'contribution', 'distribution', 'fee', 'expense', 'carry', 'income', 'realized', 'unrealized', 'transfer'] },
43
43
  amount: { type: Number, default: 0 },
44
44
  date: { type: Date, default: null },
45
45
  description: { type: String, default: '' },
@@ -178,6 +178,13 @@ module.exports = function(mongoose, config) {
178
178
  }, 0);
179
179
  });
180
180
 
181
+ LimitedPartner.virtual('totalTransfer').get(function () {
182
+ var self = this;
183
+ return _.reduce(self.transactions, function(memo, transaction) {
184
+ return memo + ((transaction.type === 'transfer' && Math.abs(transaction.amount) > 0) ? transaction.amount : 0);
185
+ }, 0);
186
+ });
187
+
181
188
  LimitedPartner.virtual('fundsInvested').get(function () {
182
189
 
183
190
  var self = this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "9.39.0",
3
+ "version": "9.40.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",