@dhyasama/totem-models 1.21.1 → 1.22.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.
Files changed (3) hide show
  1. package/lib/Round.js +16 -4
  2. package/package.json +1 -1
  3. package/.npmignore +0 -14
package/lib/Round.js CHANGED
@@ -513,7 +513,8 @@ module.exports = function(mongoose, config) {
513
513
  var self = this;
514
514
 
515
515
  var query = self.find({ 'vehicles.fund': fundId });
516
- query.select('vehicles');
516
+ query.select('organization roundName vehicles');
517
+ query.populate('organization', 'name logoUrl');
517
518
 
518
519
  if (config.CUSTOMER_ID == 'GLOBAL_PROCESS') {
519
520
  query.populate('vehicles.investments');
@@ -530,10 +531,21 @@ module.exports = function(mongoose, config) {
530
531
  if (err) return cb(err, null);
531
532
  if (!rounds) return cb(null, []);
532
533
 
533
- var vehicles = _.flatten(_.pluck(rounds, 'vehicles'));
534
- var investments = _.flatten(_.pluck(vehicles, 'investments'));
534
+ var fundInvestments = [];
535
+
536
+ _.each(rounds, function(round) {
537
+ _.each(round.vehicles, function(vehicle) {
538
+ if(vehicle.fund == fundId) {
539
+ _.each(vehicle.investments, function(investment) {
540
+ investment.organization = round.organization;
541
+ investment.roundName = round.roundName;
542
+ fundInvestments.push(investment);
543
+ });
544
+ }
545
+ });
546
+ });
535
547
 
536
- return cb(null, investments);
548
+ return cb(null, fundInvestments);
537
549
 
538
550
  });
539
551
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "1.21.1",
3
+ "version": "1.22.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",
package/.npmignore DELETED
@@ -1,14 +0,0 @@
1
- lib-cov
2
- *.seed
3
- *.log
4
- *.csv
5
- *.dat
6
- *.out
7
- *.pid
8
- *.gz
9
-
10
- npm-debug.log
11
- node_modules
12
-
13
- .DS_Store
14
- .idea