@dhyasama/totem-models 1.20.2 → 1.21.1
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/.npmignore +14 -0
- package/lib/Person.js +13 -12
- package/lib/Round.js +44 -1
- package/package.json +1 -1
package/.npmignore
ADDED
package/lib/Person.js
CHANGED
|
@@ -772,6 +772,19 @@ module.exports = function(mongoose, config) {
|
|
|
772
772
|
|
|
773
773
|
};
|
|
774
774
|
|
|
775
|
+
Person.statics.getInteractedWith = function getInteractedWith(personId, cb) {
|
|
776
|
+
|
|
777
|
+
var self = this;
|
|
778
|
+
var query = self.find({
|
|
779
|
+
$or: [
|
|
780
|
+
{ 'calendarEventSummaries.attendees.internal': personId },
|
|
781
|
+
{ 'calendarEventSummaries.attendees.external': personId }
|
|
782
|
+
]
|
|
783
|
+
});
|
|
784
|
+
query.exec(cb);
|
|
785
|
+
|
|
786
|
+
};
|
|
787
|
+
|
|
775
788
|
Person.statics.getNotes = function getNotes(personId, cb) {
|
|
776
789
|
|
|
777
790
|
var self = this;
|
|
@@ -906,18 +919,6 @@ module.exports = function(mongoose, config) {
|
|
|
906
919
|
|
|
907
920
|
};
|
|
908
921
|
|
|
909
|
-
Person.statics.listAllUnverifiedPeople = function (cb) {
|
|
910
|
-
|
|
911
|
-
this
|
|
912
|
-
.find({'status.verified': false, 'deleted': {$ne: true}})
|
|
913
|
-
.sort({'_id': 1})
|
|
914
|
-
.limit(100)
|
|
915
|
-
.exec(function (err, people) {
|
|
916
|
-
cb(err, _.sortBy(people, function(person) { return person.name.full; }));
|
|
917
|
-
});
|
|
918
|
-
|
|
919
|
-
};
|
|
920
|
-
|
|
921
922
|
Person.statics.listAllFlaggedPeople = function (cb) {
|
|
922
923
|
|
|
923
924
|
this
|
package/lib/Round.js
CHANGED
|
@@ -131,6 +131,17 @@ module.exports = function(mongoose, config) {
|
|
|
131
131
|
|
|
132
132
|
_.each(grouped, function(rounds) {
|
|
133
133
|
|
|
134
|
+
var vehicles = _.flatten(_.pluck(rounds, 'vehicles'));
|
|
135
|
+
var funds = _.flatten(_.pluck(vehicles, 'fund'));
|
|
136
|
+
funds = _.map(funds, function(fund) {
|
|
137
|
+
return {
|
|
138
|
+
name: fund.name,
|
|
139
|
+
shortName: fund.shortName,
|
|
140
|
+
slug: fund.slug,
|
|
141
|
+
_id: fund._id
|
|
142
|
+
};
|
|
143
|
+
});
|
|
144
|
+
|
|
134
145
|
// construct the org
|
|
135
146
|
var org = {
|
|
136
147
|
_id: rounds[0].organization._id,
|
|
@@ -140,7 +151,8 @@ module.exports = function(mongoose, config) {
|
|
|
140
151
|
contact: rounds[0].organization.contact,
|
|
141
152
|
filters: rounds[0].organization.filters,
|
|
142
153
|
status: rounds[0].organization.status,
|
|
143
|
-
preMoneyValuation: rounds[0].preMoneyValuation
|
|
154
|
+
preMoneyValuation: rounds[0].preMoneyValuation,
|
|
155
|
+
funds: funds
|
|
144
156
|
};
|
|
145
157
|
|
|
146
158
|
org = calculateOrgPerformance(org, rounds);
|
|
@@ -496,6 +508,37 @@ module.exports = function(mongoose, config) {
|
|
|
496
508
|
|
|
497
509
|
};
|
|
498
510
|
|
|
511
|
+
Round.statics.getFundInvestments = function getFundInvestments(fundId, cb) {
|
|
512
|
+
|
|
513
|
+
var self = this;
|
|
514
|
+
|
|
515
|
+
var query = self.find({ 'vehicles.fund': fundId });
|
|
516
|
+
query.select('vehicles');
|
|
517
|
+
|
|
518
|
+
if (config.CUSTOMER_ID == 'GLOBAL_PROCESS') {
|
|
519
|
+
query.populate('vehicles.investments');
|
|
520
|
+
}
|
|
521
|
+
else {
|
|
522
|
+
query.populate({
|
|
523
|
+
path: 'vehicles.investments',
|
|
524
|
+
match: { customer: config.CUSTOMER_ID }
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
query.exec(function(err, rounds) {
|
|
529
|
+
|
|
530
|
+
if (err) return cb(err, null);
|
|
531
|
+
if (!rounds) return cb(null, []);
|
|
532
|
+
|
|
533
|
+
var vehicles = _.flatten(_.pluck(rounds, 'vehicles'));
|
|
534
|
+
var investments = _.flatten(_.pluck(vehicles, 'investments'));
|
|
535
|
+
|
|
536
|
+
return cb(null, investments);
|
|
537
|
+
|
|
538
|
+
});
|
|
539
|
+
|
|
540
|
+
};
|
|
541
|
+
|
|
499
542
|
Round.statics.getFundPerformance = function getFundPerformance(fundId, cb) {
|
|
500
543
|
|
|
501
544
|
var self = this;
|