@dhyasama/totem-models 8.8.6 → 8.9.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/lib/Deal.js +5 -55
- package/lib/Interaction.js +1 -1
- package/package.json +1 -1
package/lib/Deal.js
CHANGED
|
@@ -157,10 +157,7 @@ module.exports = function(mongoose, config) {
|
|
|
157
157
|
query.populate({ path: 'documents', match: { customer: options.CUSTOMER_ID } });
|
|
158
158
|
query.populate({ path: 'messages', match: { customer: options.CUSTOMER_ID } });
|
|
159
159
|
query.populate('organization', 'name description logoUrl website websiteAliases chairs contact');
|
|
160
|
-
query.populate('history.account', 'person');
|
|
161
160
|
query.populate('referrer.person', 'name avatarUrl title');
|
|
162
|
-
query.populate('source.person', 'name avatarUrl title');
|
|
163
|
-
|
|
164
161
|
query.exec(cb);
|
|
165
162
|
|
|
166
163
|
};
|
|
@@ -184,27 +181,7 @@ module.exports = function(mongoose, config) {
|
|
|
184
181
|
query.populate({ path: 'messages', match: { customer: options.CUSTOMER_ID } });
|
|
185
182
|
query.populate('organization', 'name description logoUrl website websiteAliases chairs contact');
|
|
186
183
|
query.populate('referrer.person', 'name avatarUrl title');
|
|
187
|
-
query.
|
|
188
|
-
|
|
189
|
-
query.exec(function(err, deals) {
|
|
190
|
-
|
|
191
|
-
if (err) return cb(err, null);
|
|
192
|
-
else if (!deals || deals.length === 0) return cb(null, []);
|
|
193
|
-
|
|
194
|
-
let calls = [];
|
|
195
|
-
|
|
196
|
-
_.each(deals, function(deal) {
|
|
197
|
-
let func = function(callback) {
|
|
198
|
-
deal.deepPopulate('organization.chairs.first', {
|
|
199
|
-
populate: { 'organization.chairs.first': { select: 'name avatarUrl title doNotDisplay' } }
|
|
200
|
-
}, callback);
|
|
201
|
-
};
|
|
202
|
-
calls.push(func);
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
async.parallel(calls, cb);
|
|
206
|
-
|
|
207
|
-
});
|
|
184
|
+
query.exec(cb);
|
|
208
185
|
|
|
209
186
|
};
|
|
210
187
|
|
|
@@ -235,26 +212,7 @@ module.exports = function(mongoose, config) {
|
|
|
235
212
|
.populate({ path: 'messages', match: { customer: customerId } })
|
|
236
213
|
.populate('organization', 'name description logoUrl website websiteAliases chairs contact')
|
|
237
214
|
.populate('referrer.person', 'name avatarUrl title')
|
|
238
|
-
|
|
239
|
-
.exec(function(err, deals) {
|
|
240
|
-
|
|
241
|
-
if (err) { return cb(err, null); }
|
|
242
|
-
else if (!deals || deals.length === 0) { return cb(null, []); }
|
|
243
|
-
|
|
244
|
-
let calls = [];
|
|
245
|
-
|
|
246
|
-
_.each(deals, function(deal) {
|
|
247
|
-
let func = function(callback) {
|
|
248
|
-
deal.deepPopulate('organization.chairs.first', {
|
|
249
|
-
populate: { 'organization.chairs.first': { select: 'name avatarUrl title doNotDisplay' } }
|
|
250
|
-
}, callback);
|
|
251
|
-
};
|
|
252
|
-
calls.push(func);
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
async.parallel(calls, cb);
|
|
256
|
-
|
|
257
|
-
});
|
|
215
|
+
.exec(cb);
|
|
258
216
|
|
|
259
217
|
};
|
|
260
218
|
|
|
@@ -274,8 +232,9 @@ module.exports = function(mongoose, config) {
|
|
|
274
232
|
'customer': options.CUSTOMER_ID
|
|
275
233
|
});
|
|
276
234
|
|
|
235
|
+
query.populate({ path: 'documents', match: { customer: options.CUSTOMER_ID } });
|
|
236
|
+
query.populate({ path: 'messages', match: { customer: options.CUSTOMER_ID } });
|
|
277
237
|
query.populate('organization', 'name description logoUrl website websiteAliases');
|
|
278
|
-
|
|
279
238
|
query.exec(cb);
|
|
280
239
|
|
|
281
240
|
};
|
|
@@ -301,16 +260,7 @@ module.exports = function(mongoose, config) {
|
|
|
301
260
|
query.populate({ path: 'messages', match: { customer: options.CUSTOMER_ID } });
|
|
302
261
|
query.populate('organization', 'name logoUrl website websiteAliases');
|
|
303
262
|
query.populate('referrer.person', 'name avatarUrl title');
|
|
304
|
-
query.
|
|
305
|
-
|
|
306
|
-
query.exec(function(err, deal) {
|
|
307
|
-
if (deal && deal.history) {
|
|
308
|
-
deal.deepPopulate('history.account.person', {
|
|
309
|
-
populate: { 'history.account.person': { select: 'name avatarUrl title doNotDisplay' } }
|
|
310
|
-
}, cb);
|
|
311
|
-
}
|
|
312
|
-
else cb(err, deal);
|
|
313
|
-
});
|
|
263
|
+
query.exec(cb);
|
|
314
264
|
|
|
315
265
|
};
|
|
316
266
|
|
package/lib/Interaction.js
CHANGED
|
@@ -30,7 +30,7 @@ module.exports = function(mongoose, config) {
|
|
|
30
30
|
|
|
31
31
|
Interaction.statics.addNote = function(interactionId, creatorPersonId, text, isPrivate, customerId, cb) {
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Note.createForModel({
|
|
34
34
|
createdBy: creatorPersonId,
|
|
35
35
|
text: text,
|
|
36
36
|
isPrivate: isPrivate,
|