@dhyasama/totem-models 1.15.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
@@ -694,6 +694,7 @@ module.exports = function(mongoose, config) {
694
694
  };
695
695
 
696
696
  Organization.statics.getAcquistions = function getAcquistions(orgid, cb) {
697
+ // todo - logic to check public and private
697
698
  var self = this;
698
699
  self
699
700
  .find({
package/lib/Round.js CHANGED
@@ -452,6 +452,10 @@ module.exports = function(mongoose, config) {
452
452
  .populate('organization', 'name logoUrl')
453
453
  .populate('people.person', 'name avatarUrl')
454
454
  .populate('vehicles.fund')
455
+ .populate({
456
+ path: 'vehicles.investments',
457
+ match: { customer: config.CUSTOMER_ID }
458
+ })
455
459
  .exec(function(err, rounds) {
456
460
 
457
461
  if (err) return cb(err, null);
@@ -531,7 +535,10 @@ module.exports = function(mongoose, config) {
531
535
  .select('organization vehicles preMoneyValuation')
532
536
  .populate('organization', 'name logoUrl description contact industries status ipo closed acquired operating')
533
537
  .populate('vehicles.fund')
534
- .populate('vehicles.investments')
538
+ .populate({
539
+ path: 'vehicles.investments',
540
+ match: { customer: config.CUSTOMER_ID }
541
+ })
535
542
  .exec(function(err, rounds) {
536
543
 
537
544
  if (err) return cb(err, null);
@@ -558,7 +565,10 @@ module.exports = function(mongoose, config) {
558
565
  .select('organization vehicles preMoneyValuation')
559
566
  .populate('organization', 'name logoUrl description contact industries status ipo closed acquired operating')
560
567
  .populate('vehicles.fund')
561
- .populate('vehicles.investments')
568
+ .populate({
569
+ path: 'vehicles.investments',
570
+ match: { customer: config.CUSTOMER_ID }
571
+ })
562
572
  .exec(function(err, rounds) {
563
573
 
564
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.15.0",
3
+ "version": "1.17.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",