@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 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('vehicles.investments')
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('vehicles.investments')
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('vehicles.investments')
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "1.16.0",
3
+ "version": "1.17.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",