@dhyasama/totem-models 6.20.0 → 6.20.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.
Files changed (2) hide show
  1. package/lib/Deal.js +23 -1
  2. package/package.json +1 -1
package/lib/Deal.js CHANGED
@@ -162,7 +162,29 @@ module.exports = function(mongoose, config) {
162
162
  Deal.statics.getByIds = function (ids, cb) {
163
163
  this
164
164
  .find({customer: config.CUSTOMER_ID, '_id': { $in : ids } })
165
- .exec(cb);
165
+ .populate('organization', 'name description logoUrl website websiteAliases chairs')
166
+ .populate('messages')
167
+ .populate('source.person', 'name avatarUrl title')
168
+ .populate('referrer.person', 'name avatarUrl title')
169
+ .exec(function(err, deals) {
170
+
171
+ if (err) return cb(err, null);
172
+ else if (!deals || deals.length == 0) return cb(null, []);
173
+
174
+ var calls = [];
175
+
176
+ _.each(deals, function(deal) {
177
+ var func = function(callback) {
178
+ deal.deepPopulate('organization.chairs.first', {
179
+ populate: { 'organization.chairs.first': { select: 'name avatarUrl title doNotDisplay' } }
180
+ }, callback);
181
+ };
182
+ calls.push(func);
183
+ });
184
+
185
+ async.parallel(calls, cb);
186
+
187
+ });
166
188
  };
167
189
 
168
190
  // Get all deals belonging to a customer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "6.20.0",
3
+ "version": "6.20.1",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",