@dhyasama/totem-models 9.17.0 → 9.19.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 +33 -7
  2. package/package.json +1 -1
package/lib/Financials.js CHANGED
@@ -63,11 +63,11 @@ module.exports = function(mongoose, config) {
63
63
 
64
64
  uuid: { type: String },
65
65
 
66
- managedServices: { type: Boolean, default: false }, // to be folded into review
66
+ managedServices: { type: Boolean, default: false }, // to be transformed into review
67
67
  review: { type: Boolean, default: false },
68
68
 
69
69
  // In Progress -> Delivered or Opened
70
- // Not Scheduled to be removed
70
+ // Not Scheduled -> Completed
71
71
  // Scheduled to be removed
72
72
  status: { type: String, enum: ['Delivered', 'Opened', 'Overdue', 'In Review', 'Completed', 'Archived', 'In Progress', 'Not Scheduled', 'Scheduled'] },
73
73
 
@@ -173,12 +173,13 @@ module.exports = function(mongoose, config) {
173
173
 
174
174
  company: {
175
175
 
176
- // to be nested under initial and reminders, and removed
176
+ // to be nested under initial/reminders and removed
177
177
  email: {
178
178
  subject: { type: String, trim: true },
179
179
  body: { type: String, trim: true }
180
180
  },
181
181
 
182
+ // to be nested under initial/reminders/rejections and removed
182
183
  sendTo: [{
183
184
  email: { type: String, trim: true },
184
185
  name: { type: String, trim: true }
@@ -194,6 +195,10 @@ module.exports = function(mongoose, config) {
194
195
  subject: { type: String, trim: true },
195
196
  body: { type: String, trim: true }
196
197
  },
198
+ sendTo: [{
199
+ email: { type: String, trim: true },
200
+ name: { type: String, trim: true }
201
+ }]
197
202
  },
198
203
 
199
204
  reminders: [{
@@ -205,15 +210,23 @@ module.exports = function(mongoose, config) {
205
210
  email: {
206
211
  subject: { type: String, trim: true },
207
212
  body: { type: String, trim: true }
208
- }
213
+ },
214
+ sendTo: [{
215
+ email: { type: String, trim: true },
216
+ name: { type: String, trim: true }
217
+ }]
209
218
  }],
210
219
 
211
220
  rejections: [{
212
- sendOn: { type: Date, required: false },
221
+ sendOn: { type: Date, required: false }, // to be removed
213
222
  sentOn: { type: Date, required: false },
214
- sentToQueue: { type: Boolean, default: false },
215
223
  postmarkMessageId: { type: String, trim: true },
216
- status: { type: String, enum: [null, 'Sent', 'Bounced', 'Delivered', 'Opened', 'Clicked']}
224
+ sentToQueue: { type: Boolean, default: false }, // to be removed?
225
+ status: { type: String, enum: [null, 'Sent', 'Bounced', 'Delivered', 'Opened', 'Clicked']},
226
+ sendTo: [{
227
+ email: { type: String, trim: true },
228
+ name: { type: String, trim: true }
229
+ }]
217
230
  }]
218
231
 
219
232
  },
@@ -732,6 +745,19 @@ module.exports = function(mongoose, config) {
732
745
 
733
746
  };
734
747
 
748
+ Financials.statics.getPassivelyOverdue = function getPassivelyOverdue(cb) {
749
+
750
+ const self = this;
751
+
752
+ const query = self.findOne({
753
+ 'snapshots.status': { $nin: ['Completed', 'Archived'] },
754
+ 'snapshots.dueOn': { $lte: new Date() }
755
+ });
756
+
757
+ query.exec(cb);
758
+
759
+ };
760
+
735
761
  Financials.statics.removeCustomerFinancials = function removeCustomerFinancials(customerId, cb) {
736
762
 
737
763
  // this is only used to wipe out financials created by the google sheet import process
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "9.17.0",
3
+ "version": "9.19.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",