@bluedot-innovation/models 10.12.1 → 10.12.3
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.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 10.12.3
|
|
2
|
+
- Allow a Push notification campaign has no zones when campaign status is draft.
|
|
3
|
+
|
|
4
|
+
## 10.12.2
|
|
5
|
+
- Fix APNs environment enum: change 'sandbox' to 'development' to match Apple's APNs environment values
|
|
6
|
+
|
|
1
7
|
## 10.12.1
|
|
2
8
|
- Add Push Notification Campaign schemas (Campaign, CampaignNotification, CampaignZone)
|
|
3
9
|
- Add Push Configuration schemas (PushConfiguration, ApnsConfiguration, FcmConfiguration)
|
|
@@ -1196,6 +1196,13 @@ describe('Project', () => {
|
|
|
1196
1196
|
assert.notExists(res)
|
|
1197
1197
|
}
|
|
1198
1198
|
})
|
|
1199
|
+
it('should allow empty zones when campaign status is draft', async () => {
|
|
1200
|
+
project.campaigns[0].status = 'draft'
|
|
1201
|
+
project.campaigns[0].zones = []
|
|
1202
|
+
let Project = new ProjectModel(project)
|
|
1203
|
+
const res = await Project.validate()
|
|
1204
|
+
assert.notExists(res)
|
|
1205
|
+
})
|
|
1199
1206
|
})
|
|
1200
1207
|
|
|
1201
1208
|
describe('Invalid Campaigns', () => {
|
|
@@ -1361,8 +1368,8 @@ describe('Project', () => {
|
|
|
1361
1368
|
assert.notExists(res)
|
|
1362
1369
|
})
|
|
1363
1370
|
|
|
1364
|
-
it('should validate APNs with
|
|
1365
|
-
project.push.apns.environment = '
|
|
1371
|
+
it('should validate APNs with development environment', async () => {
|
|
1372
|
+
project.push.apns.environment = 'development'
|
|
1366
1373
|
let Project = new ProjectModel(project)
|
|
1367
1374
|
const res = await Project.validate()
|
|
1368
1375
|
assert.notExists(res)
|
package/package.json
CHANGED
package/schemas/Campaign.js
CHANGED
|
@@ -22,7 +22,10 @@ let CampaignSchema = new mongoose.Schema({
|
|
|
22
22
|
required: [true, 'campaign zones are required'],
|
|
23
23
|
validate: {
|
|
24
24
|
validator: function(zones) {
|
|
25
|
-
|
|
25
|
+
if (this.status === 'active' || this.status === 'paused') {
|
|
26
|
+
return zones && zones.length > 0
|
|
27
|
+
}
|
|
28
|
+
return true
|
|
26
29
|
},
|
|
27
30
|
msg: 'campaign must have at least one zone'
|
|
28
31
|
}
|