@dhyasama/totem-models 9.74.0 → 9.77.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.
@@ -47,8 +47,8 @@ module.exports = function(mongoose, config) {
47
47
 
48
48
  };
49
49
 
50
- // Scheduled but not sent and now isn't the time
51
- LimitedPartnerCampaign.statics.getFuture = function getFuture(customerId, options, cb) {
50
+ // Scheduled but not sent
51
+ LimitedPartnerCampaign.statics.getScheduled = function getScheduled(customerId, options, cb) {
52
52
 
53
53
  const self = this;
54
54
  const now = new Date();
@@ -57,17 +57,18 @@ module.exports = function(mongoose, config) {
57
57
  if (!customerId) { return cb(new Error('customerId is required'), null); }
58
58
  if (!mongoose.Types.ObjectId.isValid(customerId)) { return cb(new Error('customerId is not a valid ObjectId'), null); }
59
59
 
60
+ // No need to check send on. If no sentEmailsToQueue then safe to assume sendOn is in the future.
61
+
60
62
  const query = self.find({
61
63
  customer: customerId,
62
- sentEmailsToQueue: false,
63
- sendOn: { $gte: now }
64
+ sentEmailsToQueue: false
64
65
  });
65
66
 
66
67
  query.exec(cb);
67
68
 
68
69
  };
69
70
 
70
- // Scheduled and not yet sent but now is the time
71
+ // Scheduled and ready to be sent
71
72
  // Note this doesn't use customer id because it's for the worker and we want all customers.
72
73
  LimitedPartnerCampaign.statics.getOutbound = function getOutbound(options, cb) {
73
74
 
@@ -90,8 +91,8 @@ module.exports = function(mongoose, config) {
90
91
 
91
92
  };
92
93
 
93
- // Already sent
94
- LimitedPartnerCampaign.statics.getPrevious = function getPrevious(customerId, options, cb) {
94
+ // Scheduled and sent
95
+ LimitedPartnerCampaign.statics.getHistorical = function getHistorical(customerId, options, cb) {
95
96
 
96
97
  const self = this;
97
98
 
@@ -321,16 +321,16 @@ module.exports = function(mongoose, config) {
321
321
 
322
322
  active: { type: Boolean, default: false },
323
323
 
324
- query: {
325
- stages: { type: String, trim: true, default: 'active' },
326
- timeframe: { type: String, enum: ['Past Week', 'Past Month', 'Past 3 Months', 'Past 6 Months', 'Past Year', 'All Time'], default: 'Past Month' },
327
- },
328
-
329
324
  statuses: [{
330
325
  name: { type: String, trim: true },
331
326
  active: { type: Boolean, default: true }
332
327
  }],
333
328
 
329
+ query: {
330
+ statuses: { type: String, trim: true, default: 'active' },
331
+ timeframe: { type: String, enum: ['Past Week', 'Past Month', 'Past 3 Months', 'Past 6 Months', 'Past Year', 'All Time'], default: 'Past Month' },
332
+ },
333
+
334
334
  sourceTypes: { type: Array, default: ['Cold Inbound', 'Cold Outbound', 'Met at Event', 'Was Referred', 'Other'] },
335
335
  referrerTypes: { type: Array, default: ['Founder', 'Investor', 'Service Provider', 'Friends & Family', 'Limited Partner', 'Other'] },
336
336
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "9.74.0",
3
+ "version": "9.77.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",