@dhyasama/totem-models 8.0.4 → 8.0.6
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/Organization.js +12 -5
- package/lib/Person.js +5 -2
- package/package.json +2 -2
package/lib/Organization.js
CHANGED
|
@@ -1116,8 +1116,13 @@ module.exports = function(mongoose, config) {
|
|
|
1116
1116
|
if (!cb) { throw new Error('cb is required'); }
|
|
1117
1117
|
if (!ids) { return cb(new Error('ids is required'), null); }
|
|
1118
1118
|
if (!options) { return cb(new Error('options is required'), null); }
|
|
1119
|
-
|
|
1120
|
-
|
|
1119
|
+
|
|
1120
|
+
options = helpers.getDefaultOptions(options);
|
|
1121
|
+
|
|
1122
|
+
if (!options.isWorkerProcess) {
|
|
1123
|
+
if (!options.CUSTOMER_ID) { return cb(new Error('options.CUSTOMER_ID is required'), null); }
|
|
1124
|
+
if (!mongoose.Types.ObjectId.isValid(options.CUSTOMER_ID)) { return cb(new Error('options.CUSTOMER_ID is not a valid ObjectId'), null); }
|
|
1125
|
+
}
|
|
1121
1126
|
|
|
1122
1127
|
self
|
|
1123
1128
|
.find({ '_id': { $in : ids }})
|
|
@@ -1126,9 +1131,11 @@ module.exports = function(mongoose, config) {
|
|
|
1126
1131
|
if (err) { return cb(err, null); }
|
|
1127
1132
|
else if (!orgs) { return cb(null, []); }
|
|
1128
1133
|
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1134
|
+
if (!options.isWorkerProcess) {
|
|
1135
|
+
orgs = _.map(orgs, function(org) {
|
|
1136
|
+
return helpers.cleanOrg(org, options.CUSTOMER_ID);
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1132
1139
|
|
|
1133
1140
|
return cb(null, orgs);
|
|
1134
1141
|
|
package/lib/Person.js
CHANGED
|
@@ -377,11 +377,14 @@ module.exports = function(mongoose, config) {
|
|
|
377
377
|
if (!id) { return cb(new Error('id is required'), null); }
|
|
378
378
|
if (!mongoose.Types.ObjectId.isValid(id)) { return cb(new Error('id is not a valid ObjectId'), null); }
|
|
379
379
|
if (!options) { return cb(new Error('options is required'), null); }
|
|
380
|
-
if (!options.CUSTOMER_ID) { return cb(new Error('options.CUSTOMER_ID is required'), null); }
|
|
381
|
-
if (!mongoose.Types.ObjectId.isValid(options.CUSTOMER_ID)) { return cb(new Error('options.CUSTOMER_ID is not a valid ObjectId'), null); }
|
|
382
380
|
|
|
383
381
|
options = helpers.getDefaultOptions(options);
|
|
384
382
|
|
|
383
|
+
if (!options.isWorkerProcess) {
|
|
384
|
+
if (!options.CUSTOMER_ID) { return cb(new Error('options.CUSTOMER_ID is required'), null); }
|
|
385
|
+
if (!mongoose.Types.ObjectId.isValid(options.CUSTOMER_ID)) { return cb(new Error('options.CUSTOMER_ID is not a valid ObjectId'), null); }
|
|
386
|
+
}
|
|
387
|
+
|
|
385
388
|
self
|
|
386
389
|
.findById(id)
|
|
387
390
|
.select('-previous')
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhyasama/totem-models",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.6",
|
|
4
4
|
"author": "Jason Reynolds",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"description": "Models for Totem platform",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"engines": {
|
|
9
|
-
"node": "12.
|
|
9
|
+
"node": ">=12.0.0"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"test": "NODE_ENV=test mocha -R spec -t 15000 --exit"
|