@dhyasama/totem-models 9.22.0 → 9.24.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.
- package/lib/Financials.js +16 -19
- package/lib/LimitedPartner.js +14 -0
- package/package.json +1 -1
package/lib/Financials.js
CHANGED
|
@@ -60,12 +60,10 @@ module.exports = function(mongoose, config) {
|
|
|
60
60
|
|
|
61
61
|
// For reminding customer about upcoming collections
|
|
62
62
|
// Don't store recipients, just query admins at time of sending or check postmark post-facto
|
|
63
|
-
// todo - scheduled worker process to add and update items in this list
|
|
64
63
|
adminReminders: [{
|
|
65
|
-
|
|
66
|
-
sent: { type: Boolean, default: false },
|
|
64
|
+
sentOn: { type: Date },
|
|
67
65
|
postmarkMessageId: { type: String, trim: true },
|
|
68
|
-
|
|
66
|
+
snapshotuuid: { type: String, trim: true },
|
|
69
67
|
}]
|
|
70
68
|
},
|
|
71
69
|
|
|
@@ -300,7 +298,9 @@ module.exports = function(mongoose, config) {
|
|
|
300
298
|
|
|
301
299
|
const self = this;
|
|
302
300
|
|
|
303
|
-
|
|
301
|
+
let query = self.find({});
|
|
302
|
+
|
|
303
|
+
query.populate('organization', 'name logoUrl');
|
|
304
304
|
|
|
305
305
|
query.exec(cb);
|
|
306
306
|
|
|
@@ -378,20 +378,6 @@ module.exports = function(mongoose, config) {
|
|
|
378
378
|
|
|
379
379
|
};
|
|
380
380
|
|
|
381
|
-
Financials.statics.getUpcomingRecurring = function getUpcomingRecurring(options, cb) {
|
|
382
|
-
|
|
383
|
-
const self = this;
|
|
384
|
-
const now = new Date();
|
|
385
|
-
|
|
386
|
-
const query = self.find({
|
|
387
|
-
'recurring.adminReminders.sendOn': { $lte: now },
|
|
388
|
-
'recurring.adminReminders.sent': false
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
query.exec(cb);
|
|
392
|
-
|
|
393
|
-
};
|
|
394
|
-
|
|
395
381
|
Financials.statics.getCompanyInitialToSend = function getCompanyInitialToSend(cb) {
|
|
396
382
|
|
|
397
383
|
var self = this;
|
|
@@ -733,6 +719,17 @@ module.exports = function(mongoose, config) {
|
|
|
733
719
|
|
|
734
720
|
};
|
|
735
721
|
|
|
722
|
+
Financials.statics.updateProperty = function updateProperty(id, key, value, cb) {
|
|
723
|
+
|
|
724
|
+
const self = this;
|
|
725
|
+
const filter = { '_id': id };
|
|
726
|
+
const update = { $set: { key: value } };
|
|
727
|
+
const options = { 'upsert': false, 'new': true };
|
|
728
|
+
|
|
729
|
+
self.findOneAndUpdate(filter, update, options, cb);
|
|
730
|
+
|
|
731
|
+
};
|
|
732
|
+
|
|
736
733
|
Financials.statics.removeCustomerFinancials = function removeCustomerFinancials(customerId, cb) {
|
|
737
734
|
|
|
738
735
|
// this is only used to wipe out financials created by the google sheet import process
|
package/lib/LimitedPartner.js
CHANGED
|
@@ -209,6 +209,20 @@ module.exports = function(mongoose, config) {
|
|
|
209
209
|
fundMatch[transaction.type] += transaction.amount;
|
|
210
210
|
|
|
211
211
|
});
|
|
212
|
+
|
|
213
|
+
// and then make all the values absolute
|
|
214
|
+
_.each(fundsInvested, function(fund) {
|
|
215
|
+
fund.commitment = Math.abs(fund.commitment);
|
|
216
|
+
fund.contribution = Math.abs(fund.contribution);
|
|
217
|
+
fund.distribution = Math.abs(fund.distribution);
|
|
218
|
+
fund.fee = Math.abs(fund.fee);
|
|
219
|
+
fund.expense = Math.abs(fund.expense);
|
|
220
|
+
fund.carry = Math.abs(fund.carry);
|
|
221
|
+
fund.income = Math.abs(fund.income);
|
|
222
|
+
fund.realized = Math.abs(fund.realized);
|
|
223
|
+
fund.unrealized = Math.abs(fund.unrealized);
|
|
224
|
+
fund.balance = Math.abs(fund.balance);
|
|
225
|
+
});
|
|
212
226
|
|
|
213
227
|
return fundsInvested;
|
|
214
228
|
|