@dhyasama/totem-models 5.6.2 → 5.7.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/Message.js +16 -0
- package/package.json +1 -1
package/lib/Message.js
CHANGED
|
@@ -278,6 +278,22 @@ module.exports = function(mongoose, config) {
|
|
|
278
278
|
|
|
279
279
|
};
|
|
280
280
|
|
|
281
|
+
Message.statics.getUnprocessedPortfolio = function getUnprocessedPortfolio(customerId, cb) {
|
|
282
|
+
|
|
283
|
+
var self = this;
|
|
284
|
+
var query = self.find({
|
|
285
|
+
customer: customerId,
|
|
286
|
+
subtype: 'portfolio',
|
|
287
|
+
organization: { $exists: false }
|
|
288
|
+
});
|
|
289
|
+
query.populate({
|
|
290
|
+
path: 'documents',
|
|
291
|
+
match: { customer: customerId }
|
|
292
|
+
});
|
|
293
|
+
query.exec(cb);
|
|
294
|
+
|
|
295
|
+
};
|
|
296
|
+
|
|
281
297
|
Message.statics.upsert = function(message, cb) {
|
|
282
298
|
message.createdOn = new Date();
|
|
283
299
|
message.save(cb);
|