@dhyasama/totem-models 10.21.4 → 10.22.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.
package/lib/CapTable.js CHANGED
@@ -433,13 +433,9 @@ module.exports = function(mongoose, config) {
433
433
  compound: {
434
434
  should: [
435
435
  {
436
- text: {
436
+ autocomplete: {
437
437
  query: value,
438
- path: path,
439
- fuzzy: {
440
- maxEdits: options.maxEdits,
441
- maxExpansions: options.maxExpansions
442
- }
438
+ path: path
443
439
  }
444
440
  }
445
441
  ],
@@ -452,6 +448,9 @@ module.exports = function(mongoose, config) {
452
448
  }
453
449
  ],
454
450
  minimumShouldMatch: 1
451
+ },
452
+ highlight: {
453
+ path: path
455
454
  }
456
455
  }
457
456
  },
@@ -482,7 +481,8 @@ module.exports = function(mongoose, config) {
482
481
  name: 1,
483
482
  logoUrl: 1,
484
483
  orgId: 1,
485
- score: { $meta: "searchScore" }
484
+ score: { $meta: "searchScore" },
485
+ highlights: { $meta: "searchHighlights" }
486
486
  }
487
487
  }
488
488
  ]).exec(cb);
package/lib/Deal.js CHANGED
@@ -54,6 +54,8 @@ module.exports = function(mongoose, config) {
54
54
  description: { type: String, trim: true, required: true }
55
55
  }],
56
56
 
57
+ lastUpdated: { type: Date, default: Date.now },
58
+
57
59
  customFields: { type: Schema.Types.Mixed },
58
60
 
59
61
  latestInteraction: { type: Schema.ObjectId, ref: 'Interaction', required: false },
@@ -369,8 +371,12 @@ module.exports = function(mongoose, config) {
369
371
 
370
372
  deal.history = deal.history || [];
371
373
 
374
+ const timestamp = new Date();
375
+
376
+ deal.lastUpdated = timestamp;
377
+
372
378
  deal.history.push({
373
- timestamp: new Date(),
379
+ timestamp: timestamp,
374
380
  account: options.account || null,
375
381
  stage: deal.stage,
376
382
  description: description
package/lib/Person.js CHANGED
@@ -1012,14 +1012,6 @@ module.exports = function(mongoose, config) {
1012
1012
  // combine provided and default options
1013
1013
  options = _.defaults(options || {}, defaultOptions);
1014
1014
 
1015
- const path = [
1016
- 'name.first',
1017
- 'name.last',
1018
- 'fullName',
1019
- 'aliases',
1020
- 'contact.email.email'
1021
- ];
1022
-
1023
1015
  self.aggregate([
1024
1016
  {
1025
1017
  "$search": {
@@ -1029,7 +1021,31 @@ module.exports = function(mongoose, config) {
1029
1021
  {
1030
1022
  text: {
1031
1023
  query: query,
1032
- path: path
1024
+ path: [
1025
+ 'name.first',
1026
+ 'name.last',
1027
+ 'fullName',
1028
+ 'aliases',
1029
+ 'contact.email.email'
1030
+ ]
1031
+ }
1032
+ },
1033
+ {
1034
+ autocomplete: {
1035
+ query: query,
1036
+ path: 'name.first'
1037
+ }
1038
+ },
1039
+ {
1040
+ autocomplete: {
1041
+ query: query,
1042
+ path: 'name.last'
1043
+ }
1044
+ },
1045
+ {
1046
+ autocomplete: {
1047
+ query: query,
1048
+ path: 'fullName'
1033
1049
  }
1034
1050
  }
1035
1051
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "10.21.4",
3
+ "version": "10.22.1",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",