@dhyasama/totem-models 8.9.0 → 8.10.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.
@@ -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 (!lpName) { return cb(new Error('lpName is required'), null); }
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
- if (!options.isWorkerProcess) { return cb(null, []); }
400
+ let query;
401
+
402
+ if (!options.isWorkerProcess) {
403
+ return cb(null, []);
404
+ }
399
405
 
400
- let query = self.findOne({'name': lpName}, this.getReadFilterKeys(options.role));
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "8.9.0",
3
+ "version": "8.10.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",