@dhyasama/totem-models 6.19.2 → 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 +28 -0
  2. package/package.json +1 -1
package/lib/Deal.js CHANGED
@@ -159,6 +159,34 @@ module.exports = function(mongoose, config) {
159
159
 
160
160
  };
161
161
 
162
+ Deal.statics.getByIds = function (ids, cb) {
163
+ this
164
+ .find({customer: config.CUSTOMER_ID, '_id': { $in : ids } })
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
+ });
188
+ };
189
+
162
190
  // Get all deals belonging to a customer
163
191
  Deal.statics.getForCustomer = function (customerId, options, cb) {
164
192
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "6.19.2",
3
+ "version": "6.20.1",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",