@dhyasama/totem-models 6.6.2 → 6.7.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/.npmignore ADDED
@@ -0,0 +1,14 @@
1
+ lib-cov
2
+ *.seed
3
+ *.log
4
+ *.csv
5
+ *.dat
6
+ *.out
7
+ *.pid
8
+ *.gz
9
+
10
+ npm-debug.log
11
+ node_modules
12
+
13
+ .DS_Store
14
+ .idea
@@ -155,6 +155,23 @@ module.exports = function(mongoose, config) {
155
155
 
156
156
  };
157
157
 
158
+ Interaction.statics.getMostRecent = function getMostRecent(customerId, personIds, cb) {
159
+
160
+ // Gets the most recent interaction with a customer across a list of people
161
+ // Typically used to get the last interaction the firm had with an org
162
+ // So you'd pass in the id of the customer and a list of the people at an org and get back the most recent interaction
163
+
164
+ var self = this;
165
+
166
+ var query = self
167
+ .find({'totemCustomerId': customerId, 'attendees.external': { $in : personIds }})
168
+ .sort({'startTime': -1})
169
+ .limit(1);
170
+
171
+ query.exec(cb);
172
+
173
+ };
174
+
158
175
  Interaction.statics.getNotes = function getNotes(personIds, options, cb) {
159
176
 
160
177
  var self = this;
@@ -527,14 +527,14 @@ module.exports = function(mongoose, config) {
527
527
  result.push({
528
528
  name: 'Fundraise Amount',
529
529
  type: 'Number',
530
- isStandard: false,
530
+ isStandard: true,
531
531
  order: standardFields.fundraise.order * 10,
532
532
  colspan: standardFields.fundraise.colspan || 1,
533
533
  showOnFilter: standardFields.fundraise.showOnFilter === true ? true : false
534
534
  }, {
535
535
  name: 'Fundraise Valuation',
536
536
  type: 'Number',
537
- isStandard: false,
537
+ isStandard: true,
538
538
  order: standardFields.fundraise.order * 10 + 1,
539
539
  colspan: standardFields.fundraise.colspan || 1,
540
540
  showOnFilter: standardFields.fundraise.showOnFilter === true ? true : false
@@ -545,7 +545,7 @@ module.exports = function(mongoose, config) {
545
545
  result.push({
546
546
  name: 'Source',
547
547
  type: 'Reference',
548
- isStandard: false,
548
+ isStandard: true,
549
549
  order: standardFields.sources.order * 10,
550
550
  colspan: standardFields.sources.colspan || 1,
551
551
  showOnFilter: standardFields.sources.showOnFilter === true ? true : false
@@ -556,7 +556,7 @@ module.exports = function(mongoose, config) {
556
556
  result.push({
557
557
  name: 'Referrers',
558
558
  type: 'Reference',
559
- isStandard: false,
559
+ isStandard: true,
560
560
  order: standardFields.referrers.order * 10,
561
561
  colspan: standardFields.referrers.colspan || 1,
562
562
  showOnFilter: standardFields.referrers.showOnFilter === true ? true : false
@@ -569,7 +569,7 @@ module.exports = function(mongoose, config) {
569
569
  result.push({
570
570
  name: field.label,
571
571
  type: field.type,
572
- isStandard: true,
572
+ isStandard: false,
573
573
  key: field.key,
574
574
  options: field.options,
575
575
  order: field.display.order * 10,