@dhyasama/totem-models 8.0.0 → 8.0.2
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/Fund.js +8 -1
- package/lib/Organization.js +2 -1
- package/lib/Person.js +27 -1
- package/package.json +3 -6
- package/package-lock.json +0 -1927
package/lib/Fund.js
CHANGED
|
@@ -71,9 +71,16 @@ module.exports = function(mongoose, config) {
|
|
|
71
71
|
///////////////////////////////////////
|
|
72
72
|
|
|
73
73
|
Fund.statics.findBySlugs = function findBySlugs(slugs, cb) {
|
|
74
|
-
|
|
74
|
+
|
|
75
|
+
const self = this;
|
|
76
|
+
|
|
77
|
+
if (!cb) { throw new Error('cb is required'); }
|
|
78
|
+
if (!slugs) { return cb(new Error('slug must be provided'), null); }
|
|
79
|
+
|
|
80
|
+
self
|
|
75
81
|
.find({ 'slug': { $in : slugs }})
|
|
76
82
|
.exec(cb);
|
|
83
|
+
|
|
77
84
|
};
|
|
78
85
|
|
|
79
86
|
Fund.statics.getById = function getById(id, cb) {
|
package/lib/Organization.js
CHANGED
|
@@ -1377,7 +1377,8 @@ module.exports = function(mongoose, config) {
|
|
|
1377
1377
|
|
|
1378
1378
|
if (err) { return cb(err, null); }
|
|
1379
1379
|
|
|
1380
|
-
return cb(null,
|
|
1380
|
+
if (options.isWorkerProcess) { return cb(null, result); }
|
|
1381
|
+
else { return cb(null, helpers.cleanOrg(result, options.CUSTOMER_ID)); }
|
|
1381
1382
|
|
|
1382
1383
|
});
|
|
1383
1384
|
|
package/lib/Person.js
CHANGED
|
@@ -320,6 +320,30 @@ module.exports = function(mongoose, config) {
|
|
|
320
320
|
|
|
321
321
|
};
|
|
322
322
|
|
|
323
|
+
Person.statics.findBySlug = function (slug, cb) {
|
|
324
|
+
|
|
325
|
+
const self = this;
|
|
326
|
+
|
|
327
|
+
if (!cb) { throw new Error('cb is required'); }
|
|
328
|
+
if (!slug) { return cb(new Error('slug must be provided'), null); }
|
|
329
|
+
|
|
330
|
+
self
|
|
331
|
+
.findOne({ slug: new RegExp(slug, 'i'), 'deleted': { $ne: true } })
|
|
332
|
+
.exec(cb);
|
|
333
|
+
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
Person.statics.findBySlugs = function findBySlugs(slugs, cb) {
|
|
337
|
+
|
|
338
|
+
const self = this;
|
|
339
|
+
|
|
340
|
+
if (!cb) { throw new Error('cb is required'); }
|
|
341
|
+
if (!slugs) { return cb(new Error('slug must be provided'), null); }
|
|
342
|
+
|
|
343
|
+
self.find({ 'slug': { $in : slugs } }).exec(cb);
|
|
344
|
+
|
|
345
|
+
};
|
|
346
|
+
|
|
323
347
|
Person.statics.findBySocial = function findBySocial(value, cb) {
|
|
324
348
|
|
|
325
349
|
// Extract stand-alone username and append it to our standardized domains
|
|
@@ -356,6 +380,8 @@ module.exports = function(mongoose, config) {
|
|
|
356
380
|
if (!options.CUSTOMER_ID) { return cb(new Error('options.CUSTOMER_ID is required'), null); }
|
|
357
381
|
if (!mongoose.Types.ObjectId.isValid(options.CUSTOMER_ID)) { return cb(new Error('options.CUSTOMER_ID is not a valid ObjectId'), null); }
|
|
358
382
|
|
|
383
|
+
options = helpers.getDefaultOptions(options);
|
|
384
|
+
|
|
359
385
|
self
|
|
360
386
|
.findById(id)
|
|
361
387
|
.select('-previous')
|
|
@@ -366,7 +392,7 @@ module.exports = function(mongoose, config) {
|
|
|
366
392
|
if (err) return cb(err, null);
|
|
367
393
|
else if (!person) return cb(null, null);
|
|
368
394
|
|
|
369
|
-
person = helpers.cleanPerson(person, options.CUSTOMER_ID);
|
|
395
|
+
if (!options.isWorkerProcess) { person = helpers.cleanPerson(person, options.CUSTOMER_ID); }
|
|
370
396
|
|
|
371
397
|
person.sources = _.sortBy(person.sources, function(source) {
|
|
372
398
|
return source.interactions.calendar + source.interactions.email;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhyasama/totem-models",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.2",
|
|
4
4
|
"author": "Jason Reynolds",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"description": "Models for Totem platform",
|
|
@@ -12,9 +12,7 @@
|
|
|
12
12
|
"registry": "https://registry.npmjs.org/"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@dhyasama/ffvc-crypto": "^1.0.3",
|
|
16
15
|
"@dhyasama/ffvc-geoip": "^1.0.0",
|
|
17
|
-
"@dhyasama/ffvc-s3": "^1.1.0",
|
|
18
16
|
"@dhyasama/ffvc-utilities": "^2.7.5",
|
|
19
17
|
"async": "^2.6.3",
|
|
20
18
|
"awesome-phonenumber": "^1.0.14",
|
|
@@ -23,16 +21,15 @@
|
|
|
23
21
|
"moment": "^2.24.0",
|
|
24
22
|
"mongoose-deep-populate": "^3.0.0",
|
|
25
23
|
"mongoose-filter-denormalize": "^0.2.1",
|
|
26
|
-
"
|
|
24
|
+
"range_check": "^1.4.0",
|
|
27
25
|
"underscore": "~1.5.0",
|
|
28
26
|
"validator": "^5.4.0"
|
|
29
27
|
},
|
|
30
28
|
"devDependencies": {
|
|
31
29
|
"mocha": "^5.2.0",
|
|
32
30
|
"mocha-mongoose": "^1.2.0",
|
|
33
|
-
"mongoose": "
|
|
31
|
+
"mongoose": "^4.5.10",
|
|
34
32
|
"nock": "^7.2.2",
|
|
35
|
-
"rewire": "^3.0.2",
|
|
36
33
|
"should": "^11.1.1"
|
|
37
34
|
}
|
|
38
35
|
}
|