@dhyasama/totem-models 7.53.4 → 7.54.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/Financials.js +20 -4
  2. package/package.json +1 -1
package/lib/Financials.js CHANGED
@@ -230,6 +230,22 @@ module.exports = function(mongoose, config) {
230
230
 
231
231
  };
232
232
 
233
+ Financials.statics.getByPostmarkMessageId = function getByPostmarkMessageId(postmarkMessageId, cb) {
234
+
235
+ var self = this;
236
+
237
+ var query = self.findOne({
238
+ $or: [
239
+ { 'snapshots.notifications.company.initial.postmarkMessageId': postmarkMessageId },
240
+ { 'snapshots.notifications.company.reminders.postmarkMessageId': postmarkMessageId },
241
+ { 'snapshots.notifications.company.rejections.postmarkMessageId': postmarkMessageId },
242
+ ]
243
+ });
244
+
245
+ query.exec(cb);
246
+
247
+ };
248
+
233
249
  Financials.statics.getInitialUUIDsToSend = function getInitialUUIDsToSend(cb) {
234
250
 
235
251
  var self = this;
@@ -299,8 +315,8 @@ module.exports = function(mongoose, config) {
299
315
  });
300
316
 
301
317
  var hasRecipients = snapshot.notifications.company.sendTo.length > 0;
302
- var hasSendOnLessThanNow = !_.isEmpty(sendOnLessThanNow);
303
- var hasNotBeenSentTo = !sendOnLessThanNow.sentOn;
318
+ var hasSendOnLessThanNow = sendOnLessThanNow;
319
+ var hasNotBeenSentTo = sendOnLessThanNow && !sendOnLessThanNow.sentOn;
304
320
 
305
321
  return hasRecipients && hasSendOnLessThanNow && hasNotBeenSentTo;
306
322
 
@@ -342,8 +358,8 @@ module.exports = function(mongoose, config) {
342
358
  });
343
359
 
344
360
  var hasRecipients = snapshot.notifications.company.sendTo.length > 0;
345
- var hasSendOnLessThanNow = !_.isEmpty(sendOnLessThanNow);
346
- var hasNotBeenSentTo = !sendOnLessThanNow.sentOn;
361
+ var hasSendOnLessThanNow = sendOnLessThanNow;
362
+ var hasNotBeenSentTo = sendOnLessThanNow && !sendOnLessThanNow.sentOn;
347
363
 
348
364
  return hasRecipients && hasSendOnLessThanNow && hasNotBeenSentTo;
349
365
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "7.53.4",
3
+ "version": "7.54.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",