@dhyasama/totem-models 7.53.5 → 7.55.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 -2
  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;
@@ -279,7 +295,8 @@ module.exports = function(mongoose, config) {
279
295
  $elemMatch: {
280
296
  'notifications.company.sendTo': { $gt: [] },
281
297
  'notifications.company.reminders.sendOn': { $lte: now },
282
- 'notifications.company.reminders.sentOn': null
298
+ 'notifications.company.reminders.sentOn': null,
299
+ 'submittedOn': null
283
300
  }
284
301
  }
285
302
  });
@@ -301,8 +318,9 @@ module.exports = function(mongoose, config) {
301
318
  var hasRecipients = snapshot.notifications.company.sendTo.length > 0;
302
319
  var hasSendOnLessThanNow = sendOnLessThanNow;
303
320
  var hasNotBeenSentTo = sendOnLessThanNow && !sendOnLessThanNow.sentOn;
321
+ var hasNotBeenSubmitted = snapshot.submittedOn;
304
322
 
305
- return hasRecipients && hasSendOnLessThanNow && hasNotBeenSentTo;
323
+ return hasRecipients && hasSendOnLessThanNow && hasNotBeenSentTo && hasNotBeenSubmitted;
306
324
 
307
325
  });
308
326
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "7.53.5",
3
+ "version": "7.55.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",