@dhyasama/totem-models 1.16.0 → 1.17.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/Investment.js +20 -0
- package/lib/Round.js +12 -4
- package/package.json +1 -1
package/lib/Investment.js
CHANGED
|
@@ -77,6 +77,26 @@ module.exports = function(mongoose, config) {
|
|
|
77
77
|
|
|
78
78
|
|
|
79
79
|
|
|
80
|
+
///////////////////////////////////////////////////////////////////////////////////////
|
|
81
|
+
// VIRTUALS
|
|
82
|
+
// Properties that are not persisted to the database
|
|
83
|
+
///////////////////////////////////////////////////////////////////////////////////////
|
|
84
|
+
|
|
85
|
+
Investment.virtual('month').get(function () {
|
|
86
|
+
var self = this;
|
|
87
|
+
var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
88
|
+
if (!self.investmentDate) return 'Unknown';
|
|
89
|
+
else return monthNames[self.investmentDate.getMonth()];
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
Investment.virtual('year').get(function () {
|
|
93
|
+
var self = this;
|
|
94
|
+
if (!self.investmentDate) return 'Unknown';
|
|
95
|
+
else return self.investmentDate.getFullYear();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
80
100
|
//////////////////////////////////////////////////////
|
|
81
101
|
// STATICS
|
|
82
102
|
// Statics operate on the entire collection
|
package/lib/Round.js
CHANGED
|
@@ -408,7 +408,6 @@ module.exports = function(mongoose, config) {
|
|
|
408
408
|
.populate('organization', 'name logoUrl')
|
|
409
409
|
.populate('people.person', 'name avatarUrl title')
|
|
410
410
|
.populate('vehicles.fund', 'name shortName')
|
|
411
|
-
.populate('vehicles.investments')
|
|
412
411
|
.populate({
|
|
413
412
|
path: 'vehicles.investments',
|
|
414
413
|
match: { customer: config.CUSTOMER_ID }
|
|
@@ -453,7 +452,10 @@ module.exports = function(mongoose, config) {
|
|
|
453
452
|
.populate('organization', 'name logoUrl')
|
|
454
453
|
.populate('people.person', 'name avatarUrl')
|
|
455
454
|
.populate('vehicles.fund')
|
|
456
|
-
.populate(
|
|
455
|
+
.populate({
|
|
456
|
+
path: 'vehicles.investments',
|
|
457
|
+
match: { customer: config.CUSTOMER_ID }
|
|
458
|
+
})
|
|
457
459
|
.exec(function(err, rounds) {
|
|
458
460
|
|
|
459
461
|
if (err) return cb(err, null);
|
|
@@ -533,7 +535,10 @@ module.exports = function(mongoose, config) {
|
|
|
533
535
|
.select('organization vehicles preMoneyValuation')
|
|
534
536
|
.populate('organization', 'name logoUrl description contact industries status ipo closed acquired operating')
|
|
535
537
|
.populate('vehicles.fund')
|
|
536
|
-
.populate(
|
|
538
|
+
.populate({
|
|
539
|
+
path: 'vehicles.investments',
|
|
540
|
+
match: { customer: config.CUSTOMER_ID }
|
|
541
|
+
})
|
|
537
542
|
.exec(function(err, rounds) {
|
|
538
543
|
|
|
539
544
|
if (err) return cb(err, null);
|
|
@@ -560,7 +565,10 @@ module.exports = function(mongoose, config) {
|
|
|
560
565
|
.select('organization vehicles preMoneyValuation')
|
|
561
566
|
.populate('organization', 'name logoUrl description contact industries status ipo closed acquired operating')
|
|
562
567
|
.populate('vehicles.fund')
|
|
563
|
-
.populate(
|
|
568
|
+
.populate({
|
|
569
|
+
path: 'vehicles.investments',
|
|
570
|
+
match: { customer: config.CUSTOMER_ID }
|
|
571
|
+
})
|
|
564
572
|
.exec(function(err, rounds) {
|
|
565
573
|
|
|
566
574
|
if (err) return cb(err, null);
|