@dhyasama/totem-models 9.75.0 → 9.78.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
|
|
51
|
-
LimitedPartnerCampaign.statics.
|
|
50
|
+
// Scheduled but not sent
|
|
51
|
+
LimitedPartnerCampaign.statics.getUpcoming = function getUpcoming(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
|
|
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
|
-
//
|
|
94
|
-
LimitedPartnerCampaign.statics.
|
|
94
|
+
// Scheduled and sent
|
|
95
|
+
LimitedPartnerCampaign.statics.getHistorical = function getHistorical(customerId, options, cb) {
|
|
95
96
|
|
|
96
97
|
const self = this;
|
|
97
98
|
|