@dhyasama/totem-models 9.67.0 → 9.68.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.
@@ -105,6 +105,14 @@ module.exports = function(mongoose, config) {
105
105
 
106
106
  };
107
107
 
108
+ LimitedPartnerCampaign.statics.markAsSentToQueue = function markAsSentToQueue(campaignIds, options, cb) {
109
+
110
+ const self = this;
111
+
112
+ self.updateMany({ id: { $in: campaignIds } }, { sentToQueue: true }, cb);
113
+
114
+ };
115
+
108
116
  LimitedPartnerCampaign.statics.remove = function remove(campaignId, customerId, options, cb) {
109
117
 
110
118
  const self = this;
@@ -67,6 +67,22 @@ module.exports = function(mongoose, config) {
67
67
 
68
68
  };
69
69
 
70
+ LimitedPartnerCommunication.statics.getByCampaigns = function getByCampaigns(campaignIds, options, cb) {
71
+
72
+ const self = this;
73
+
74
+ if (!cb) { throw new Error('cb is required'); }
75
+ if (!campaignId) { return cb(new Error('campaignId is required'), null); }
76
+ if (!mongoose.Types.ObjectId.isValid(campaignId)) { return cb(new Error('campaignId is not a valid ObjectId'), null); }
77
+
78
+ let query = self.find({
79
+ campaign: { $in: campaignIds }
80
+ });
81
+
82
+ query.exec(cb);
83
+
84
+ };
85
+
70
86
  // So we can put these on person pages
71
87
  LimitedPartnerCommunication.statics.getByEmail = function getByEmail(email, options, cb) {
72
88
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "9.67.0",
3
+ "version": "9.68.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",
@@ -17,11 +17,11 @@
17
17
  "dependencies": {
18
18
  "@dhyasama/totem-utilities": "^3.0.0",
19
19
  "algoliasearch": "^4.13.0",
20
- "async": "^2.6.3",
20
+ "async": "^2.6.4",
21
21
  "awesome-phonenumber": "^1.0.14",
22
22
  "bluebird": "^3.7.2",
23
23
  "escape-string-regexp": "^1.0.5",
24
- "moment": "^2.29.2",
24
+ "moment": "^2.29.3",
25
25
  "mongoose-deep-populate": "^3.2.0",
26
26
  "mongoose-filter-denormalize": "^0.2.1",
27
27
  "range_check": "^1.4.0",