@dhyasama/totem-models 6.15.4 → 6.16.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/lib/LimitedPartner.js +34 -0
- package/package.json +1 -1
package/lib/LimitedPartner.js
CHANGED
|
@@ -429,6 +429,27 @@ module.exports = function(mongoose, config) {
|
|
|
429
429
|
|
|
430
430
|
};
|
|
431
431
|
|
|
432
|
+
LimitedPartner.statics.getByName = function(lpName, role, cb) {
|
|
433
|
+
|
|
434
|
+
var self = this;
|
|
435
|
+
var query;
|
|
436
|
+
|
|
437
|
+
var getLps = function() {
|
|
438
|
+
query.populate('fundsInvested.fund');
|
|
439
|
+
query.exec(cb);
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
if (CUSTOMER_ID == 'GLOBAL_PROCESS') {
|
|
443
|
+
query = self.find({'name': lpName}, this.getReadFilterKeys(role))
|
|
444
|
+
getLps();
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
query = self.find({'name': lpName, 'fundsInvested.fund': { $in : self.customerFunds }}, self.getReadFilterKeys(role));
|
|
448
|
+
getLps();
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
};
|
|
452
|
+
|
|
432
453
|
LimitedPartner.statics.getFlags = function getFlags(lpid, cb) {
|
|
433
454
|
|
|
434
455
|
var self = this;
|
|
@@ -692,6 +713,19 @@ module.exports = function(mongoose, config) {
|
|
|
692
713
|
return self.customerFunds;
|
|
693
714
|
};
|
|
694
715
|
|
|
716
|
+
LimitedPartner.statics.removeCustomerCommitments = function removeCustomerCommitments(customerId, cb) {
|
|
717
|
+
|
|
718
|
+
var self = this;
|
|
719
|
+
|
|
720
|
+
var query = self.update(
|
|
721
|
+
{ 'customer': customerId },
|
|
722
|
+
{ $set: { fundsInvested: [] } },
|
|
723
|
+
{ multi : true }
|
|
724
|
+
);
|
|
725
|
+
query.exec(cb);
|
|
726
|
+
|
|
727
|
+
};
|
|
728
|
+
|
|
695
729
|
LimitedPartner.statics.upsert = function(lp, username, role, cb) {
|
|
696
730
|
|
|
697
731
|
if (!lp) { return cb(new Error('lp is required'), null); }
|