@dhyasama/totem-models 10.30.0 → 10.32.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.
package/lib/Deal.js CHANGED
@@ -609,7 +609,6 @@ module.exports = function(mongoose, config) {
609
609
  Deal.set('usePushEach', true);
610
610
  Deal.set('toJSON', { virtuals: true });
611
611
  Deal.set('autoIndex', false);
612
- Deal.set('usePushEach', true);
613
612
  Deal.on('index', function(err) { console.log('error building deal indexes: ' + err); });
614
613
 
615
614
  const deepPopulate = require('mongoose-deep-populate')(mongoose);
@@ -23,7 +23,10 @@ module.exports = function(mongoose, config) {
23
23
  external: [{ type: Schema.ObjectId, ref: 'Person', index: true }] // everyone else
24
24
  },
25
25
  notes: [ { type: Schema.ObjectId, ref: 'Note' } ],
26
- documents: [ { type: Schema.ObjectId, ref: 'Document' } ]
26
+ documents: [ { type: Schema.ObjectId, ref: 'Document' } ],
27
+
28
+ // handy for querying data that was updated on a recent pull
29
+ updatedOn: { type: Date, default: Date.now }
27
30
 
28
31
  });
29
32
 
@@ -279,7 +279,12 @@ module.exports = function(mongoose, config) {
279
279
  key: { type: String, trim: true },
280
280
  label: { type: String, trim: true },
281
281
  total: { type: String, enum: [null, 'total', 'average', 'count'] },
282
- width: { type: Number, default: 150 }
282
+ width: { type: Number, default: 150 },
283
+ filters: [{
284
+ key: { type: String, trim: true },
285
+ condition: { type: String, enum: [null, 'equals', 'doesNotEqual', 'contains', 'doesNotContain', 'lessThan', 'greaterThan', 'isEmpty', 'isNotEmpty'] },
286
+ values: [{ type: String, trim: true }]
287
+ }]
283
288
  }],
284
289
  view: { type: String, trim: true }
285
290
  }]
@@ -449,7 +454,12 @@ module.exports = function(mongoose, config) {
449
454
  key: { type: String, trim: true },
450
455
  label: { type: String, trim: true },
451
456
  total: { type: String, enum: [null, 'total', 'average', 'count'] },
452
- width: { type: Number, default: 150 }
457
+ width: { type: Number, default: 150 },
458
+ filters: [{
459
+ key: { type: String, trim: true },
460
+ condition: { type: String, enum: [null, 'equals', 'doesNotEqual', 'contains', 'doesNotContain', 'lessThan', 'greaterThan', 'isEmpty', 'isNotEmpty'] },
461
+ values: [{ type: String, trim: true }]
462
+ }]
453
463
  }],
454
464
  view: { type: String, trim: true }
455
465
  }]
@@ -512,7 +522,12 @@ module.exports = function(mongoose, config) {
512
522
  key: { type: String, trim: true },
513
523
  label: { type: String, trim: true },
514
524
  total: { type: String, enum: [null, 'total', 'average', 'count'] },
515
- width: { type: Number, default: 150 }
525
+ width: { type: Number, default: 150 },
526
+ filters: [{
527
+ key: { type: String, trim: true },
528
+ condition: { type: String, enum: [null, 'equals', 'doesNotEqual', 'contains', 'doesNotContain', 'lessThan', 'greaterThan', 'isEmpty', 'isNotEmpty'] },
529
+ values: [{ type: String, trim: true }]
530
+ }]
516
531
  }],
517
532
  view: { type: String, trim: true }
518
533
  }]
@@ -577,7 +592,12 @@ module.exports = function(mongoose, config) {
577
592
  key: { type: String, trim: true },
578
593
  label: { type: String, trim: true },
579
594
  total: { type: String, enum: [null, 'total', 'average', 'count'] },
580
- width: { type: Number, default: 150 }
595
+ width: { type: Number, default: 150 },
596
+ filters: [{
597
+ key: { type: String, trim: true },
598
+ condition: { type: String, enum: [null, 'equals', 'doesNotEqual', 'contains', 'doesNotContain', 'lessThan', 'greaterThan', 'isEmpty', 'isNotEmpty'] },
599
+ values: [{ type: String, trim: true }]
600
+ }]
581
601
  }],
582
602
  view: { type: String, trim: true }
583
603
  }]
@@ -610,7 +630,21 @@ module.exports = function(mongoose, config) {
610
630
  }],
611
631
 
612
632
  // the stakeholders names we match to on cap tables
613
- stakeholders: [{ type: String, unique: true, partialFilterExpression : { type :"string" }, trim: true }]
633
+ stakeholders: [{ type: String, unique: true, partialFilterExpression : { type :"string" }, trim: true }],
634
+
635
+ lastCalendarEvent: [{
636
+ _id: false,
637
+ interaction: { type: Schema.ObjectId, ref: 'Interaction' },
638
+ customer: { type: Schema.ObjectId, ref: 'Organization' },
639
+ timestamp: { type: Date }
640
+ }],
641
+
642
+ lastEmail: [{
643
+ _id: false,
644
+ message: { type: Schema.ObjectId, ref: 'Message' },
645
+ customer: { type: Schema.ObjectId, ref: 'Organization' },
646
+ timestamp: { type: Date }
647
+ }]
614
648
 
615
649
  });
616
650
 
package/lib/Person.js CHANGED
@@ -135,7 +135,21 @@ module.exports = function(mongoose, config) {
135
135
  doNotDisplay: { type: Boolean, default: false },
136
136
 
137
137
  // the stakeholders names we match to on cap tables
138
- stakeholders: [{ type: String, unique: true, partialFilterExpression : { type :"string" }, trim: true }]
138
+ stakeholders: [{ type: String, unique: true, partialFilterExpression : { type :"string" }, trim: true }],
139
+
140
+ lastCalendarEvent: [{
141
+ _id: false,
142
+ interaction: { type: Schema.ObjectId, ref: 'Interaction' },
143
+ customer: { type: Schema.ObjectId, ref: 'Organization' },
144
+ timestamp: { type: Date }
145
+ }],
146
+
147
+ lastEmail: [{
148
+ _id: false,
149
+ message: { type: Schema.ObjectId, ref: 'Message' },
150
+ customer: { type: Schema.ObjectId, ref: 'Organization' },
151
+ timestamp: { type: Date }
152
+ }]
139
153
 
140
154
  });
141
155
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "10.30.0",
3
+ "version": "10.32.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",
@@ -28,9 +28,9 @@
28
28
  "validator": "^13.7.0"
29
29
  },
30
30
  "devDependencies": {
31
- "mocha": "^10.1.0",
31
+ "mocha": "^10.2.0",
32
32
  "mocha-mongoose": "^1.2.0",
33
- "mongoose": "^5.13.15",
33
+ "mongoose": "^5.13.17",
34
34
  "should": "^11.1.1"
35
35
  }
36
36
  }