@dhyasama/totem-models 10.14.0 → 10.14.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.
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ const _ = require("underscore");
4
+ const helpers = require("@dhyasama/totem-models/helpers");
3
5
  module.exports = function(mongoose, config) {
4
6
 
5
7
  let
@@ -185,14 +187,14 @@ module.exports = function(mongoose, config) {
185
187
  });
186
188
 
187
189
  LimitedPartner.virtual('fundsInvested').get(function () {
188
-
190
+
189
191
  var self = this;
190
192
  var fundsInvested = [];
191
-
193
+
192
194
  _.each(self.transactions, function(transaction) {
193
-
195
+
194
196
  var fundMatch = _.find(fundsInvested, function(fund) { return fund._id === transaction.fund._id; });
195
-
197
+
196
198
  if(!fundMatch) {
197
199
  fundsInvested.push({
198
200
  _id: transaction.fund._id,
@@ -829,20 +831,13 @@ module.exports = function(mongoose, config) {
829
831
  index: 'default',
830
832
  compound: {
831
833
  should: [
832
- {
833
- autocomplete: {
834
- query: value,
835
- path: 'name',
836
- fuzzy: {
837
- maxEdits: options.maxEdits,
838
- maxExpansions: options.maxExpansions
839
- }
840
- }
841
- },
842
834
  {
843
835
  text: {
844
836
  query: value,
845
- path: 'name',
837
+ path: [
838
+ 'name',
839
+ 'stakeholders'
840
+ ],
846
841
  fuzzy: {
847
842
  maxEdits: options.maxEdits,
848
843
  maxExpansions: options.maxExpansions
@@ -273,7 +273,7 @@ module.exports = function(mongoose, config) {
273
273
  condition: { type: String, enum: [null, 'equals', 'doesNotEqual', 'contains', 'doesNotContain', 'lessThan', 'greaterThan', 'isEmpty', 'isNotEmpty'] },
274
274
  values: [{ type: String, trim: true }]
275
275
  }],
276
- sort: {
276
+ sort: {
277
277
  by: { type: String, trim: true },
278
278
  reverse: { type: Boolean, default: false }
279
279
  },
@@ -506,7 +506,7 @@ module.exports = function(mongoose, config) {
506
506
  condition: { type: String, enum: [null, 'equals', 'doesNotEqual', 'contains', 'doesNotContain', 'lessThan', 'greaterThan', 'isEmpty', 'isNotEmpty'] },
507
507
  values: [{ type: String, trim: true }]
508
508
  }],
509
- sort: {
509
+ sort: {
510
510
  by: { type: String, trim: true },
511
511
  reverse: { type: Boolean, default: false }
512
512
  },
@@ -571,7 +571,7 @@ module.exports = function(mongoose, config) {
571
571
  condition: { type: String, enum: [null, 'equals', 'doesNotEqual', 'contains', 'doesNotContain', 'lessThan', 'greaterThan', 'isEmpty', 'isNotEmpty'] },
572
572
  values: [{ type: String, trim: true }]
573
573
  }],
574
- sort: {
574
+ sort: {
575
575
  by: { type: String, trim: true },
576
576
  reverse: { type: Boolean, default: false }
577
577
  },
@@ -691,10 +691,8 @@ module.exports = function(mongoose, config) {
691
691
 
692
692
  var self = this;
693
693
 
694
- if (!self.customer) return [];
695
-
696
694
  // Backwards schema compatibility
697
- else if (!self.customer.deals) return [];
695
+ if (!self.customer.deals) return [];
698
696
 
699
697
  // Deals aren't on for customer
700
698
  else if (!self.customer.deals.active) return [];
@@ -819,8 +817,8 @@ module.exports = function(mongoose, config) {
819
817
  Organization.virtual('operating.closed.on').get(function () {
820
818
 
821
819
  const self = this;
822
- const publicData = self.operating && self.operating.closed && self.operating.closed.public || {};
823
- const privateData = self.operating && self.operating.closed && self.operating.closed.private || [];
820
+ const publicData = self.operating.closed.public || {};
821
+ const privateData = self.operating.closed.private || [];
824
822
 
825
823
  if (publicData.closedOn) return publicData.closedOn;
826
824
  else if (privateData.length >= 1) {
@@ -834,8 +832,8 @@ module.exports = function(mongoose, config) {
834
832
  Organization.virtual('operating.closed.hasZeroUnrealizedValue').get(function () {
835
833
 
836
834
  const self = this;
837
- const publicData = self.operating && self.operating.closed && self.operating.closed.public || {};
838
- const privateData = self.operating && self.operating.closed && self.operating.closed.private || [];
835
+ const publicData = self.operating.closed.public || {};
836
+ const privateData = self.operating.closed.private || [];
839
837
 
840
838
  if (publicData.closedOn) return false;
841
839
  else if (privateData.length >= 1) {
@@ -849,8 +847,8 @@ module.exports = function(mongoose, config) {
849
847
  Organization.virtual('operating.acquired.amount').get(function () {
850
848
 
851
849
  const self = this;
852
- const publicData = self.operating && self.operating.acquired && self.operating.acquired.public || {};
853
- const privateData = self.operating && self.operating.acquired && self.operating.acquired.private || [];
850
+ const publicData = self.operating.acquired.public || {};
851
+ const privateData = self.operating.acquired.private || [];
854
852
 
855
853
  if (publicData.amount) return publicData.amount;
856
854
  else if (privateData.length >= 1) {
@@ -864,8 +862,8 @@ module.exports = function(mongoose, config) {
864
862
  Organization.virtual('operating.acquired.by').get(function () {
865
863
 
866
864
  const self = this;
867
- const publicData = self.operating && self.operating.acquired && self.operating.acquired.public || {};
868
- const privateData = self.operating && self.operating.acquired && self.operating.acquired.private || [];
865
+ const publicData = self.operating.acquired.public || {};
866
+ const privateData = self.operating.acquired.private || [];
869
867
 
870
868
  if (publicData.by) return publicData.by;
871
869
  else if (privateData.length >= 1) {
@@ -879,8 +877,8 @@ module.exports = function(mongoose, config) {
879
877
  Organization.virtual('operating.acquired.on').get(function () {
880
878
 
881
879
  const self = this;
882
- const publicData = self.operating && self.operating.acquired && self.operating.acquired.public || {};
883
- const privateData = self.operating && self.operating.acquired && self.operating.acquired.private || [];
880
+ const publicData = self.operating.acquired.public || {};
881
+ const privateData = self.operating.acquired.private || [];
884
882
 
885
883
  if (publicData.acquiredOn) return publicData.acquiredOn;
886
884
  else if (privateData.length >= 1) {
@@ -894,8 +892,8 @@ module.exports = function(mongoose, config) {
894
892
  Organization.virtual('operating.merged.with').get(function () {
895
893
 
896
894
  const self = this;
897
- const publicData = self.operating && self.operating.merged && self.operating.merged.public || {};
898
- const privateData = self.operating && self.operating.merged && self.operating.merged.private || [];
895
+ const publicData = self.operating.merged.public || {};
896
+ const privateData = self.operating.merged.private || [];
899
897
 
900
898
  if (publicData.with) return publicData.with;
901
899
  else if (privateData.length >= 1) {
@@ -909,8 +907,8 @@ module.exports = function(mongoose, config) {
909
907
  Organization.virtual('operating.merged.on').get(function () {
910
908
 
911
909
  const self = this;
912
- const publicData = self.operating && self.operating.merged && self.operating.merged.public || {};
913
- const privateData = self.operating && self.operating.merged && self.operating.merged.private || [];
910
+ const publicData = self.operating.merged.public || {};
911
+ const privateData = self.operating.merged.private || [];
914
912
 
915
913
  if (publicData.mergedOn) return publicData.mergedOn;
916
914
  else if (privateData.length >= 1) {
@@ -933,7 +931,7 @@ module.exports = function(mongoose, config) {
933
931
  else return 'Active';
934
932
 
935
933
  });
936
-
934
+
937
935
  Organization.virtual('websites').get(function () {
938
936
 
939
937
  var self = this;
@@ -1272,11 +1270,11 @@ module.exports = function(mongoose, config) {
1272
1270
 
1273
1271
  self
1274
1272
  .find({ $or:
1275
- [
1276
- { 'people.person': personId },
1277
- { 'chairs.first': personId },
1278
- { 'chairs.second': personId }
1279
- ],
1273
+ [
1274
+ { 'people.person': personId },
1275
+ { 'chairs.first': personId },
1276
+ { 'chairs.second': personId }
1277
+ ],
1280
1278
  'deleted': { $ne: true }
1281
1279
  })
1282
1280
  .select('-sources -customer')
@@ -1432,24 +1430,24 @@ module.exports = function(mongoose, config) {
1432
1430
 
1433
1431
  self
1434
1432
  .find({ $or:
1435
- [
1436
- { 'social.facebook': {$in: facebookRegexes }},
1437
- { 'social.linkedin': {$in: linkedinRegexes }},
1438
- { 'social.twitter': {$in: twitterRegexes }},
1439
- { 'crunchbase.url': {$in: crunchbaseRegexes }}
1440
- ],
1433
+ [
1434
+ { 'social.facebook': {$in: facebookRegexes }},
1435
+ { 'social.linkedin': {$in: linkedinRegexes }},
1436
+ { 'social.twitter': {$in: twitterRegexes }},
1437
+ { 'crunchbase.url': {$in: crunchbaseRegexes }}
1438
+ ],
1441
1439
  'deleted': { $ne: true }
1442
1440
  }).exec(function(err, orgs) {
1443
1441
 
1444
- if (err) { return cb(err, null); }
1442
+ if (err) { return cb(err, null); }
1445
1443
 
1446
- orgs = _.map(orgs, function(org) {
1447
- return helpers.cleanOrg(org, options.CUSTOMER_ID);
1448
- });
1444
+ orgs = _.map(orgs, function(org) {
1445
+ return helpers.cleanOrg(org, options.CUSTOMER_ID);
1446
+ });
1449
1447
 
1450
- return cb(null, orgs);
1448
+ return cb(null, orgs);
1451
1449
 
1452
- });
1450
+ });
1453
1451
 
1454
1452
  };
1455
1453
 
@@ -1471,9 +1469,9 @@ module.exports = function(mongoose, config) {
1471
1469
  self
1472
1470
  .find(
1473
1471
  { $or: [
1474
- { 'operating.acquired.private.by': orgid, 'operating.acquired.private.customer': options.CUSTOMER_ID, 'deleted': { $ne: true } },
1475
- { 'operating.acquired.public.by': orgid, 'deleted': { $ne: true } },
1476
- ]}
1472
+ { 'operating.acquired.private.by': orgid, 'operating.acquired.private.customer': options.CUSTOMER_ID, 'deleted': { $ne: true } },
1473
+ { 'operating.acquired.public.by': orgid, 'deleted': { $ne: true } },
1474
+ ]}
1477
1475
  )
1478
1476
  .select('name logoUrl')
1479
1477
  .exec(cb);
@@ -1587,10 +1585,10 @@ module.exports = function(mongoose, config) {
1587
1585
 
1588
1586
  self
1589
1587
  .find({ $or:
1590
- [
1591
- { 'chairs.first': personId },
1592
- { 'chairs.second': personId }
1593
- ],
1588
+ [
1589
+ { 'chairs.first': personId },
1590
+ { 'chairs.second': personId }
1591
+ ],
1594
1592
  'deleted': { $ne: true }
1595
1593
  })
1596
1594
  .exec(function(err, orgs) {
@@ -1676,16 +1674,16 @@ module.exports = function(mongoose, config) {
1676
1674
 
1677
1675
  query.exec(function(err, orgs) {
1678
1676
 
1679
- if (err) { return cb(err, null); }
1680
- else if (!orgs) { return cb(null, []); }
1677
+ if (err) { return cb(err, null); }
1678
+ else if (!orgs) { return cb(null, []); }
1681
1679
 
1682
- orgs = _.map(orgs, function(org) {
1683
- return helpers.cleanOrg(org, options.CUSTOMER_ID);
1684
- });
1680
+ orgs = _.map(orgs, function(org) {
1681
+ return helpers.cleanOrg(org, options.CUSTOMER_ID);
1682
+ });
1685
1683
 
1686
- return cb(null, orgs);
1684
+ return cb(null, orgs);
1687
1685
 
1688
- });
1686
+ });
1689
1687
 
1690
1688
  };
1691
1689
 
@@ -1757,50 +1755,50 @@ module.exports = function(mongoose, config) {
1757
1755
  // get the org requested
1758
1756
  query.exec(function(err, org) {
1759
1757
 
1760
- if (err) { return cb(err, null); }
1761
- if (!org) { return cb(null, null); }
1762
-
1763
- // get the customer requesting org
1764
- self.findById(options.CUSTOMER_ID, function(err, customer) {
1758
+ if (err) { return cb(err, null); }
1759
+ if (!org) { return cb(null, null); }
1765
1760
 
1766
- if (err) { return cb(err, null); }
1767
- if (!customer) { return cb(null, null); }
1761
+ // get the customer requesting org
1762
+ self.findById(options.CUSTOMER_ID, function(err, customer) {
1768
1763
 
1769
- let current = [];
1770
- let past = [];
1771
- let all = [];
1764
+ if (err) { return cb(err, null); }
1765
+ if (!customer) { return cb(null, null); }
1772
1766
 
1773
- // combined list of sources from each person at org
1774
- let orgSources = helpers.getPeopleSources(_.pluck(org.people, 'person'));
1767
+ let current = [];
1768
+ let past = [];
1769
+ let all = [];
1775
1770
 
1776
- // loop through customer's people and categorize sources
1777
- _.each(customer.people, function(p) {
1771
+ // combined list of sources from each person at org
1772
+ let orgSources = helpers.getPeopleSources(_.pluck(org.people, 'person'));
1778
1773
 
1779
- var source = _.find(orgSources, function(os) {
1780
- if (!os || !os.person || !os.person._id) return false;
1781
- return os.person._id.toString() === p.person.toString();
1782
- });
1774
+ // loop through customer's people and categorize sources
1775
+ _.each(customer.people, function(p) {
1783
1776
 
1784
- if (!source) return;
1777
+ var source = _.find(orgSources, function(os) {
1778
+ if (!os || !os.person || !os.person._id) return false;
1779
+ return os.person._id.toString() === p.person.toString();
1780
+ });
1785
1781
 
1786
- if (p.current) current.push(source);
1787
- if (!p.current) past.push(source);
1788
- all.push(source);
1782
+ if (!source) return;
1789
1783
 
1790
- });
1784
+ if (p.current) current.push(source);
1785
+ if (!p.current) past.push(source);
1786
+ all.push(source);
1791
1787
 
1792
- // todo - fix sorting
1793
- // return categorized sources
1794
- return cb(null, {
1795
- all: all, //helpers.sortPeopleSources(all, options.CUSTOMER_ID),
1796
- current: current, //helpers.sortPeopleSources(current, options.CUSTOMER_ID),
1797
- past: past //helpers.sortPeopleSources(past, options.CUSTOMER_ID)
1798
- });
1788
+ });
1799
1789
 
1790
+ // todo - fix sorting
1791
+ // return categorized sources
1792
+ return cb(null, {
1793
+ all: all, //helpers.sortPeopleSources(all, options.CUSTOMER_ID),
1794
+ current: current, //helpers.sortPeopleSources(current, options.CUSTOMER_ID),
1795
+ past: past //helpers.sortPeopleSources(past, options.CUSTOMER_ID)
1800
1796
  });
1801
1797
 
1802
1798
  });
1803
1799
 
1800
+ });
1801
+
1804
1802
  };
1805
1803
 
1806
1804
  Organization.statics.modify = function(filter, update, cb) {
@@ -2095,56 +2093,22 @@ module.exports = function(mongoose, config) {
2095
2093
  index: 'default',
2096
2094
  compound: {
2097
2095
  should: [
2098
- {
2099
- autocomplete: {
2100
- query: value,
2101
- path: 'name',
2102
- fuzzy: {
2103
- maxEdits: options.maxEdits,
2104
- maxExpansions: options.maxExpansions
2105
- }
2106
- }
2107
- },
2108
2096
  {
2109
2097
  text: {
2110
2098
  query: value,
2111
- path: 'name',
2099
+ path: [
2100
+ 'name',
2101
+ 'aliases',
2102
+ 'website',
2103
+ 'websiteAliases',
2104
+ 'stakeholders'
2105
+ ],
2112
2106
  fuzzy: {
2113
2107
  maxEdits: options.maxEdits,
2114
2108
  maxExpansions: options.maxExpansions
2115
2109
  },
2116
2110
  score: { boost: { value: 3 } }
2117
2111
  }
2118
- },
2119
- {
2120
- autocomplete: {
2121
- query: value,
2122
- path: 'aliases',
2123
- fuzzy: {
2124
- maxEdits: options.maxEdits,
2125
- maxExpansions: options.maxExpansions
2126
- }
2127
- }
2128
- },
2129
- {
2130
- autocomplete: {
2131
- query: value,
2132
- path: 'website',
2133
- fuzzy: {
2134
- maxEdits: options.maxEdits,
2135
- maxExpansions: options.maxExpansions
2136
- }
2137
- }
2138
- },
2139
- {
2140
- autocomplete: {
2141
- query: value,
2142
- path: 'websiteAliases',
2143
- fuzzy: {
2144
- maxEdits: options.maxEdits,
2145
- maxExpansions: options.maxExpansions
2146
- }
2147
- }
2148
2112
  }
2149
2113
  ],
2150
2114
  must: [
package/lib/Person.js CHANGED
@@ -1,8 +1,7 @@
1
- "use strict";
1
+ "use strict";
2
2
 
3
3
  const _ = require("underscore");
4
-
5
- module.exports = function(mongoose, config) {
4
+ module.exports = function(mongoose, config) {
6
5
 
7
6
  let
8
7
 
@@ -146,7 +145,7 @@ const _ = require("underscore");
146
145
  Person.virtual('name.full').get(function () {
147
146
  var name = '';
148
147
  if(this.name.first) name += this.name.first;
149
- if(this.name.first && this.name.last) name += ' ';
148
+ if(this.name.first && this.name.last) name += ' ';
150
149
  if(this.name.last) name += this.name.last;
151
150
  return name;
152
151
  });
@@ -179,7 +178,7 @@ const _ = require("underscore");
179
178
 
180
179
  Person.methods.addMerged = function(id) {
181
180
  if (this.merged.indexOf(id) == -1) {
182
- this.merged = this.merged.concat([id]);
181
+ this.merged = this.merged.concat([id]);
183
182
  return true;
184
183
  }
185
184
  else {
@@ -396,12 +395,12 @@ const _ = require("underscore");
396
395
 
397
396
  self
398
397
  .find({ $or:
399
- [
400
- { 'social.facebook': {$in: facebookRegexes }},
401
- { 'social.linkedin': {$in: linkedinRegexes }},
402
- { 'social.twitter': {$in: twitterRegexes }},
403
- { 'crunchbase.url': {$in: crunchbaseRegexes }}
404
- ],
398
+ [
399
+ { 'social.facebook': {$in: facebookRegexes }},
400
+ { 'social.linkedin': {$in: linkedinRegexes }},
401
+ { 'social.twitter': {$in: twitterRegexes }},
402
+ { 'crunchbase.url': {$in: crunchbaseRegexes }}
403
+ ],
405
404
  'deleted': { $ne: true }
406
405
  }).exec(cb);
407
406
 
@@ -665,47 +664,6 @@ const _ = require("underscore");
665
664
 
666
665
  };
667
666
 
668
- Person.statics.atlasSearch = function (query, options, cb) {
669
-
670
- const self = this;
671
-
672
- const defaultOptions = {
673
- limit: 100
674
- };
675
-
676
- // combine provided and default options
677
- options = _.defaults(options || {}, defaultOptions);
678
-
679
- self.aggregate([
680
- {
681
- '$search': {
682
- 'index': 'default',
683
- 'text': {
684
- 'query': query,
685
- 'path': {
686
- 'wildcard': '*'
687
- }
688
- }
689
- }
690
- }, {
691
- '$match': {
692
- 'deleted': false
693
- }
694
- }, {
695
- $limit: options.limit,
696
- }, {
697
- "$project": {
698
- "_id": 1,
699
- "fullName": 1,
700
- "name": 1,
701
- "avatarUrl": 1,
702
- "score": { "$meta": "searchScore" }
703
- }
704
- }
705
- ], cb);
706
-
707
- };
708
-
709
667
  // search for people based on fields provided
710
668
  // Data format, everything is optional
711
669
  //{
@@ -743,7 +701,7 @@ const _ = require("underscore");
743
701
  delete query['$and'];
744
702
  }
745
703
 
746
- // "and" is only used for name, which is one more thing to "or" so move it to "or"
704
+ // "and" is only used for name, which is one more thing to "or" so move it to "or"
747
705
  // note that changes may be needed if "and" is used for other things as well
748
706
  else {
749
707
  query['$or'].push({ '$and': query['$and'] });
@@ -1044,121 +1002,66 @@ const _ = require("underscore");
1044
1002
 
1045
1003
  Person.statics.search2 = function (query, options, cb) {
1046
1004
 
1047
- const self = this;
1048
-
1049
- const defaultOptions = {
1050
- limit: 10,
1051
- maxEdits: 1,
1052
- maxExpansions: 100
1053
- };
1054
-
1055
- // combine provided and default options
1056
- options = _.defaults(options || {}, defaultOptions);
1057
-
1058
- self.aggregate([
1059
- {
1060
- "$search": {
1061
- index: 'default',
1062
- compound: {
1063
- should: [
1064
- {
1065
- autocomplete: {
1066
- query: query,
1067
- path: 'name.first',
1068
- fuzzy: {
1069
- maxEdits: options.maxEdits,
1070
- maxExpansions: options.maxExpansions
1071
- }
1072
- }
1073
- },
1074
- {
1075
- text: {
1076
- query: query,
1077
- path: 'name.first',
1078
- fuzzy: {
1079
- maxEdits: options.maxEdits,
1080
- maxExpansions: options.maxExpansions
1081
- }
1082
- }
1083
- },
1084
- {
1085
- autocomplete: {
1086
- query: query,
1087
- path: 'name.last',
1088
- fuzzy: {
1089
- maxEdits: options.maxEdits,
1090
- maxExpansions: options.maxExpansions
1091
- }
1092
- }
1093
- },
1094
- {
1095
- text: {
1096
- query: query,
1097
- path: 'name.last',
1098
- fuzzy: {
1099
- maxEdits: options.maxEdits,
1100
- maxExpansions: options.maxExpansions
1101
- }
1102
- }
1103
- },
1104
- {
1105
- autocomplete: {
1106
- query: query,
1107
- path: 'fullName',
1108
- fuzzy: {
1109
- maxEdits: options.maxEdits,
1110
- maxExpansions: options.maxExpansions
1111
- },
1112
- }
1113
- },
1114
- {
1115
- text: {
1116
- query: query,
1117
- path: 'fullName',
1118
- fuzzy: {
1119
- maxEdits: options.maxEdits,
1120
- maxExpansions: options.maxExpansions
1121
- },
1122
- score: { boost: { value: 3 } }
1123
- }
1124
- },
1125
- {
1126
- autocomplete: {
1127
- query: query,
1128
- path: 'aliases',
1129
- fuzzy: {
1130
- maxEdits: options.maxEdits,
1131
- maxExpansions: options.maxExpansions
1132
- }
1133
- }
1134
- }
1135
- ],
1136
- must: [
1137
- {
1138
- equals: {
1139
- path: 'deleted',
1140
- value: false
1141
- }
1142
- }
1143
- ],
1144
- minimumShouldMatch: 1
1145
- }
1146
- }
1147
- }, {
1148
- $limit: options.limit,
1149
- }, {
1150
- "$project": {
1151
- "_id": 1,
1152
- "fullName": 1,
1153
- "name": 1,
1154
- "avatarUrl": 1,
1155
- "sources": 1,
1156
- "score": { "$meta": "searchScore" }
1157
- }
1158
- }
1159
- ], cb);
1160
-
1161
- };
1005
+ const self = this;
1006
+
1007
+ const defaultOptions = {
1008
+ limit: 10,
1009
+ maxEdits: 1,
1010
+ maxExpansions: 100
1011
+ };
1012
+
1013
+ // combine provided and default options
1014
+ options = _.defaults(options || {}, defaultOptions);
1015
+
1016
+ self.aggregate([
1017
+ {
1018
+ "$search": {
1019
+ index: 'default',
1020
+ compound: {
1021
+ should: [
1022
+ {
1023
+ text: {
1024
+ query: query,
1025
+ path: [
1026
+ 'name.first',
1027
+ 'name.last',
1028
+ 'fullName',
1029
+ 'aliases',
1030
+ 'stakeholders'
1031
+ ],
1032
+ fuzzy: {
1033
+ maxEdits: options.maxEdits,
1034
+ maxExpansions: options.maxExpansions
1035
+ }
1036
+ }
1037
+ }
1038
+ ],
1039
+ must: [
1040
+ {
1041
+ equals: {
1042
+ path: 'deleted',
1043
+ value: false
1044
+ }
1045
+ }
1046
+ ],
1047
+ minimumShouldMatch: 1
1048
+ }
1049
+ }
1050
+ }, {
1051
+ $limit: options.limit,
1052
+ }, {
1053
+ "$project": {
1054
+ "_id": 1,
1055
+ "fullName": 1,
1056
+ "name": 1,
1057
+ "avatarUrl": 1,
1058
+ "sources": 1,
1059
+ "score": { "$meta": "searchScore" }
1060
+ }
1061
+ }
1062
+ ], cb);
1063
+
1064
+ };
1162
1065
 
1163
1066
  Person.statics.searchByEmail = function(email, cb) {
1164
1067
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "10.14.0",
3
+ "version": "10.14.1",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",