@dhyasama/totem-models 6.6.3 → 6.7.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/Interaction.js +17 -0
- package/lib/Organization.js +20 -2
- package/package.json +1 -1
package/lib/Interaction.js
CHANGED
|
@@ -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;
|
package/lib/Organization.js
CHANGED
|
@@ -223,6 +223,13 @@ module.exports = function(mongoose, config) {
|
|
|
223
223
|
// showOnFilter controls whether values are extracted and used in filtering options on list page
|
|
224
224
|
// showOnList controls if the field will be on deal list page
|
|
225
225
|
|
|
226
|
+
action: {
|
|
227
|
+
order: { type: Number, default: 99 },
|
|
228
|
+
colspan: { type: Number, default: 1 },
|
|
229
|
+
showOnFilter: { type: Boolean, default: true },
|
|
230
|
+
showOnList: { type: Boolean, default: true }
|
|
231
|
+
},
|
|
232
|
+
|
|
226
233
|
fundraise: {
|
|
227
234
|
order: { type: Number, default: 99 },
|
|
228
235
|
colspan: { type: Number, default: 1 },
|
|
@@ -249,7 +256,7 @@ module.exports = function(mongoose, config) {
|
|
|
249
256
|
colspan: { type: Number, default: 1 },
|
|
250
257
|
showOnFilter: { type: Boolean, default: true },
|
|
251
258
|
showOnList: { type: Boolean, default: true }
|
|
252
|
-
}
|
|
259
|
+
}
|
|
253
260
|
|
|
254
261
|
},
|
|
255
262
|
|
|
@@ -523,6 +530,17 @@ module.exports = function(mongoose, config) {
|
|
|
523
530
|
var result = [];
|
|
524
531
|
|
|
525
532
|
// Add standard fields
|
|
533
|
+
if (standardFields.action.showOnList) {
|
|
534
|
+
result.push({
|
|
535
|
+
name: 'Action',
|
|
536
|
+
type: 'Text',
|
|
537
|
+
isStandard: true,
|
|
538
|
+
order: standardFields.action.order * 10,
|
|
539
|
+
colspan: standardFields.action.colspan || 1,
|
|
540
|
+
showOnFilter: standardFields.action.showOnFilter === true ? true : false
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
|
|
526
544
|
if (standardFields.fundraise.showOnList) {
|
|
527
545
|
result.push({
|
|
528
546
|
name: 'Fundraise Amount',
|
|
@@ -543,7 +561,7 @@ module.exports = function(mongoose, config) {
|
|
|
543
561
|
|
|
544
562
|
if (standardFields.sources.showOnList) {
|
|
545
563
|
result.push({
|
|
546
|
-
name: '
|
|
564
|
+
name: 'Sources',
|
|
547
565
|
type: 'Reference',
|
|
548
566
|
isStandard: true,
|
|
549
567
|
order: standardFields.sources.order * 10,
|