@dhyasama/totem-models 8.9.0 → 8.11.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/index.js +0 -7
- package/lib/LimitedPartner.js +11 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -10,13 +10,6 @@ var bootstrap = function(mongoose, config) {
|
|
|
10
10
|
// use bluebird promises globally within mongoose
|
|
11
11
|
mongoose.Promise = require('bluebird');
|
|
12
12
|
|
|
13
|
-
// Validate config
|
|
14
|
-
var configHas_LPS_ENABLED = typeof config['LPS_ENABLED'] != 'undefined';
|
|
15
|
-
if (!configHas_LPS_ENABLED) throw new Error('Config is missing LPS_ENABLED setting');
|
|
16
|
-
|
|
17
|
-
var configHas_CUSTOMER_ID = typeof config['CUSTOMER_ID'] != 'undefined';
|
|
18
|
-
if (!configHas_CUSTOMER_ID) throw new Error('Config is missing CUSTOMER_ID setting');
|
|
19
|
-
|
|
20
13
|
// todo - find a solution to load without worrying about order
|
|
21
14
|
|
|
22
15
|
// deal must be loaded before organization
|
package/lib/LimitedPartner.js
CHANGED
|
@@ -391,13 +391,21 @@ module.exports = function(mongoose, config) {
|
|
|
391
391
|
const self = this;
|
|
392
392
|
|
|
393
393
|
if (!cb) { throw new Error('cb is required'); }
|
|
394
|
-
if (!
|
|
394
|
+
if (!options) { return cb(new Error('options is required'), null); }
|
|
395
|
+
if (!options.CUSTOMER_ID) { return cb(new Error('options.CUSTOMER_ID is required'), null); }
|
|
396
|
+
if (!mongoose.Types.ObjectId.isValid(options.CUSTOMER_ID)) { return cb(new Error('options.CUSTOMER_ID is not a valid ObjectId'), null); }
|
|
395
397
|
|
|
396
398
|
options = helpers.getDefaultOptions(options);
|
|
397
399
|
|
|
398
|
-
|
|
400
|
+
let query;
|
|
401
|
+
|
|
402
|
+
if (!options.isWorkerProcess) {
|
|
403
|
+
return cb(null, []);
|
|
404
|
+
}
|
|
399
405
|
|
|
400
|
-
|
|
406
|
+
else {
|
|
407
|
+
query = self.findOne({'name': lpName, customer: options.CUSTOMER_ID }, self.getReadFilterKeys(options.role));
|
|
408
|
+
}
|
|
401
409
|
|
|
402
410
|
query.populate('transactions.fund');
|
|
403
411
|
query.exec(cb);
|