@dhyasama/totem-models 11.103.0 → 11.105.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.
Files changed (2) hide show
  1. package/lib/Meeting.js +8 -5
  2. package/package.json +1 -1
package/lib/Meeting.js CHANGED
@@ -66,6 +66,7 @@ module.exports = function(mongoose, config) {
66
66
  if (!mongoose.Types.ObjectId.isValid(options.CUSTOMER_ID)) { return cb(new Error('options.CUSTOMER_ID is not a valid ObjectId'), null); }
67
67
 
68
68
  let query = self.findOne({ '_id': id, customer: options.CUSTOMER_ID });
69
+ if (options.populate === true) { query.populate('people'); }
69
70
  query.exec(cb);
70
71
 
71
72
  };
@@ -81,6 +82,7 @@ module.exports = function(mongoose, config) {
81
82
  if (!mongoose.Types.ObjectId.isValid(options.CUSTOMER_ID)) { return cb(new Error('options.CUSTOMER_ID is not a valid ObjectId'), null); }
82
83
 
83
84
  let query = self.findOne({ 'eventId': eventId, customer: options.CUSTOMER_ID });
85
+ if (options.populate === true) { query.populate('people'); }
84
86
  query.exec(cb);
85
87
 
86
88
  };
@@ -96,6 +98,7 @@ module.exports = function(mongoose, config) {
96
98
  if (!mongoose.Types.ObjectId.isValid(options.CUSTOMER_ID)) { return cb(new Error('options.CUSTOMER_ID is not a valid ObjectId'), null); }
97
99
 
98
100
  let query = self.findOne({ 'uniqueId': uniqueId, customer: options.CUSTOMER_ID });
101
+ if (options.populate === true) { query.populate('people'); }
99
102
  query.exec(cb);
100
103
 
101
104
  };
@@ -112,6 +115,7 @@ module.exports = function(mongoose, config) {
112
115
  if (!mongoose.Types.ObjectId.isValid(options.CUSTOMER_ID)) { return cb(new Error('options.CUSTOMER_ID is not a valid ObjectId'), null); }
113
116
 
114
117
  let query = self.find({ customer: options.CUSTOMER_ID, startOn: { $gte: since, $lte: until } });
118
+ if (options.populate === true) { query.populate('people'); }
115
119
  query.exec(cb);
116
120
 
117
121
  };
@@ -128,11 +132,12 @@ module.exports = function(mongoose, config) {
128
132
 
129
133
  let query = self.find({ customer: options.CUSTOMER_ID });
130
134
  query.where({ 'people': { $in : personIds } });
135
+ if (options.populate === true) { query.populate('people'); }
131
136
  query.exec(cb);
132
137
 
133
138
  };
134
139
 
135
- Meeting.statics.getMostRecent = function getMostRecent(customerId, personIds, timestamp, cb) {
140
+ Meeting.statics.getMostRecent = function getMostRecent(customerId, personIds, cb) {
136
141
 
137
142
  // Gets the most recent meeting with a customer across a list of people
138
143
  // Typically used to get the last meeting the firm had with an org
@@ -155,12 +160,10 @@ module.exports = function(mongoose, config) {
155
160
  // only meetings that have already started
156
161
  query.where('startOn').lte(new Date());
157
162
 
158
- // Optionally limit to meetings newer than timestamp (useful for seeing if anything since a previous event)
159
- if (timestamp) query.where('startOn').gt(timestamp);
160
-
161
163
  query.sort({ 'startOn': -1 });
162
164
  query.limit(1);
163
-
165
+
166
+ if (options.populate === true) { query.populate('people'); }
164
167
  query.exec(cb);
165
168
 
166
169
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "11.103.0",
3
+ "version": "11.105.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",