@bluedot-innovation/models 8.2.2 → 8.2.4
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 +6 -0
- package/__tests__/destination/destination.data.json +1 -2
- package/__tests__/destination/destination.spec.js +0 -58
- package/__tests__/project/project.data.json +8 -3
- package/__tests__/project/project.spec.js +73 -35
- package/helpers.js +1 -1
- package/models/Destination.js +1 -2
- package/package.json +1 -1
- package/schemas/Integration.js +6 -72
- package/schemas/MparticleIntegration.js +82 -0
- package/schemas/ProjectHello.js +2 -0
- package/utils/DbInitialiser/indexInitialiser.js +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -58,16 +58,6 @@ describe('Valid Destination ', () => {
|
|
|
58
58
|
done()
|
|
59
59
|
})
|
|
60
60
|
})
|
|
61
|
-
|
|
62
|
-
it('should validate a valid destination without helloSsoCode', (done) => {
|
|
63
|
-
delete destination.helloSsoCode
|
|
64
|
-
let Destination = new DestinationModel(destination)
|
|
65
|
-
Destination.validate((err, res) => {
|
|
66
|
-
assert.notExists(res)
|
|
67
|
-
assert(err === null, 'err equals null')
|
|
68
|
-
done()
|
|
69
|
-
})
|
|
70
|
-
})
|
|
71
61
|
})
|
|
72
62
|
|
|
73
63
|
describe('Invalid Destination ', () => {
|
|
@@ -198,52 +188,4 @@ describe('Invalid Destination ', () => {
|
|
|
198
188
|
done()
|
|
199
189
|
})
|
|
200
190
|
})
|
|
201
|
-
|
|
202
|
-
it("should throw an error if helloSsoCode is shorter than 12 characters", (done) => {
|
|
203
|
-
destination.helloSsoCode = "HGDUS69SD"
|
|
204
|
-
let Destination = new DestinationModel(destination)
|
|
205
|
-
Destination.validate((err, res) => {
|
|
206
|
-
assert.notExists(res)
|
|
207
|
-
assert.exists(err)
|
|
208
|
-
console.log(err.message)
|
|
209
|
-
assert.match(err.message, /Hello SSO code must be a 12 character capital alphanumeric text/)
|
|
210
|
-
done()
|
|
211
|
-
})
|
|
212
|
-
})
|
|
213
|
-
|
|
214
|
-
it("should throw an error if helloSsoCode is longer than 12 characters", (done) => {
|
|
215
|
-
destination.helloSsoCode = "HGDUS69SDASLDKJSFDHWUER7Y"
|
|
216
|
-
let Destination = new DestinationModel(destination)
|
|
217
|
-
Destination.validate((err, res) => {
|
|
218
|
-
assert.notExists(res)
|
|
219
|
-
assert.exists(err)
|
|
220
|
-
console.log(err.message)
|
|
221
|
-
assert.match(err.message, /Hello SSO code must be a 12 character capital alphanumeric text/)
|
|
222
|
-
done()
|
|
223
|
-
})
|
|
224
|
-
})
|
|
225
|
-
|
|
226
|
-
it("should throw an error if helloSsoCode include lowercase characters", (done) => {
|
|
227
|
-
destination.helloSsoCode = "3HgDUs69SD95"
|
|
228
|
-
let Destination = new DestinationModel(destination)
|
|
229
|
-
Destination.validate((err, res) => {
|
|
230
|
-
assert.notExists(res)
|
|
231
|
-
assert.exists(err)
|
|
232
|
-
console.log(err.message)
|
|
233
|
-
assert.match(err.message, /Hello SSO code must be a 12 character capital alphanumeric text/)
|
|
234
|
-
done()
|
|
235
|
-
})
|
|
236
|
-
})
|
|
237
|
-
|
|
238
|
-
it("should throw an error if helloSsoCode is empty", (done) => {
|
|
239
|
-
destination.helloSsoCode = ""
|
|
240
|
-
let Destination = new DestinationModel(destination)
|
|
241
|
-
Destination.validate((err, res) => {
|
|
242
|
-
assert.notExists(res)
|
|
243
|
-
assert.exists(err)
|
|
244
|
-
console.log(err.message)
|
|
245
|
-
assert.match(err.message, /Hello SSO code must be a 12 character capital alphanumeric text/)
|
|
246
|
-
done()
|
|
247
|
-
})
|
|
248
|
-
})
|
|
249
191
|
})
|
|
@@ -47,9 +47,13 @@
|
|
|
47
47
|
"integrations":{
|
|
48
48
|
"mparticle": {
|
|
49
49
|
"androidApiKey": "us1-c5e6eefe90fe704aba0a7d2daa00baaa",
|
|
50
|
-
"androidSecretKey": "eZqphc1Vh2dqaIQEvz4APNbErZkW_AaaRmwE8BCmYpHZFc3n_ZKajTLgJgFqLNNN",
|
|
51
50
|
"iosApiKey": "us1-a5e6eefe90fe704aba0a7d2daa00baaa",
|
|
52
|
-
"
|
|
51
|
+
"webApiKey": "us1-a5e6eefe90fe704aba0a7d2daa00baaa",
|
|
52
|
+
"trigger": true,
|
|
53
|
+
"tempo": true,
|
|
54
|
+
"wave": true,
|
|
55
|
+
"hello": true,
|
|
56
|
+
"environment": "production"
|
|
53
57
|
},
|
|
54
58
|
"olo": {
|
|
55
59
|
"sharedSecret": "jhFGJHKJhkHIjklJ",
|
|
@@ -87,6 +91,7 @@
|
|
|
87
91
|
"isochroneBracketInterval": [60, 120, 300]
|
|
88
92
|
},
|
|
89
93
|
"hello": {
|
|
90
|
-
"registrationTtl": 86400
|
|
94
|
+
"registrationTtl": 86400,
|
|
95
|
+
"ssoLinkingCode": "HGDUS69SDJJ0"
|
|
91
96
|
}
|
|
92
97
|
}
|
|
@@ -113,6 +113,16 @@ describe('Project', () => {
|
|
|
113
113
|
done()
|
|
114
114
|
})
|
|
115
115
|
})
|
|
116
|
+
|
|
117
|
+
it('should validate a valid project without ssoLinkingCode', (done) => {
|
|
118
|
+
delete project.hello.ssoLinkingCode
|
|
119
|
+
let Project = new ProjectModel(project)
|
|
120
|
+
Project.validate((err, res) => {
|
|
121
|
+
assert.notExists(res)
|
|
122
|
+
assert(err === null, 'err equals null')
|
|
123
|
+
done()
|
|
124
|
+
})
|
|
125
|
+
})
|
|
116
126
|
})
|
|
117
127
|
testCase('Valid Project ', () => {
|
|
118
128
|
assertions('should validate a valid project ', (done) => {
|
|
@@ -147,16 +157,7 @@ describe('Project', () => {
|
|
|
147
157
|
done()
|
|
148
158
|
})
|
|
149
159
|
})
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
project.integrations.mparticle.iosSecretKey = ''
|
|
153
|
-
let Project = new ProjectModel(project)
|
|
154
|
-
Project.validate((err, res) => {
|
|
155
|
-
assert.exists(err)
|
|
156
|
-
assert.match(err.message, /iosSecretKey should be a non-empty string/)
|
|
157
|
-
done()
|
|
158
|
-
})
|
|
159
|
-
})
|
|
160
|
+
|
|
160
161
|
assertions('should throw an error if the mparticle integration misses all keys ', (done) => {
|
|
161
162
|
|
|
162
163
|
project.integrations.mparticle = {}
|
|
@@ -164,64 +165,55 @@ describe('Project', () => {
|
|
|
164
165
|
let Project = new ProjectModel(project)
|
|
165
166
|
Project.validate((err, res) => {
|
|
166
167
|
assert.exists(err)
|
|
167
|
-
assert.match(err.message, /
|
|
168
|
+
assert.match(err.message, /At least one of Android, iOS or Web keys need to be provided/)
|
|
168
169
|
done()
|
|
169
170
|
})
|
|
170
171
|
})
|
|
171
|
-
|
|
172
|
+
|
|
173
|
+
assertions('should throw an error if trigger is selected but no android or ios keys provided', (done) => {
|
|
172
174
|
|
|
173
|
-
delete project.integrations.mparticle.iosApiKey
|
|
174
175
|
delete project.integrations.mparticle.androidApiKey
|
|
176
|
+
delete project.integrations.mparticle.iosApiKey
|
|
175
177
|
|
|
176
178
|
let Project = new ProjectModel(project)
|
|
177
179
|
Project.validate((err, res) => {
|
|
178
180
|
assert.exists(err)
|
|
179
|
-
assert.match(err.message, /
|
|
181
|
+
assert.match(err.message, /Either Android or iOS keys need to be provided/)
|
|
180
182
|
done()
|
|
181
183
|
})
|
|
182
184
|
})
|
|
183
|
-
assertions('should throw an error if
|
|
185
|
+
assertions('should throw an error if tempo is selected but no android or ios keys provided', (done) => {
|
|
184
186
|
|
|
185
|
-
delete project.integrations.mparticle.
|
|
186
|
-
delete project.integrations.mparticle.
|
|
187
|
+
delete project.integrations.mparticle.androidApiKey
|
|
188
|
+
delete project.integrations.mparticle.iosApiKey
|
|
187
189
|
|
|
188
190
|
let Project = new ProjectModel(project)
|
|
189
191
|
Project.validate((err, res) => {
|
|
190
192
|
assert.exists(err)
|
|
191
|
-
assert.match(err.message, /
|
|
193
|
+
assert.match(err.message, /Either Android or iOS keys need to be provided/)
|
|
192
194
|
done()
|
|
193
195
|
})
|
|
194
196
|
})
|
|
195
|
-
assertions('should throw an error if the mparticle integration has valid android key pair, but no Ios secret ', (done) => {
|
|
196
197
|
|
|
197
|
-
|
|
198
|
+
assertions('should throw an error if wave is selected but no web keys provided', (done) => {
|
|
198
199
|
|
|
199
|
-
|
|
200
|
-
Project.validate((err, res) => {
|
|
201
|
-
assert.exists(err)
|
|
202
|
-
assert.match(err.message, /both iosSecretKey and iosApiKey are required/)
|
|
203
|
-
done()
|
|
204
|
-
})
|
|
205
|
-
})
|
|
206
|
-
assertions('should throw an error if the mparticle integration has valid Ios key pair, but no android secret ', (done) => {
|
|
207
|
-
|
|
208
|
-
delete project.integrations.mparticle.androidSecretKey
|
|
200
|
+
delete project.integrations.mparticle.webApiKey
|
|
209
201
|
|
|
210
202
|
let Project = new ProjectModel(project)
|
|
211
203
|
Project.validate((err, res) => {
|
|
212
204
|
assert.exists(err)
|
|
213
|
-
assert.match(err.message, /
|
|
205
|
+
assert.match(err.message, /Web keys need to be provided/)
|
|
214
206
|
done()
|
|
215
207
|
})
|
|
216
208
|
})
|
|
217
|
-
assertions('should
|
|
209
|
+
assertions('should throw an error if hello is selected but no web keys provided', (done) => {
|
|
218
210
|
|
|
219
|
-
delete project.integrations.mparticle.
|
|
220
|
-
delete project.integrations.mparticle.androidSecretKey
|
|
211
|
+
delete project.integrations.mparticle.webApiKey
|
|
221
212
|
|
|
222
213
|
let Project = new ProjectModel(project)
|
|
223
214
|
Project.validate((err, res) => {
|
|
224
|
-
assert.
|
|
215
|
+
assert.exists(err)
|
|
216
|
+
assert.match(err.message, /Web keys need to be provided/)
|
|
225
217
|
done()
|
|
226
218
|
})
|
|
227
219
|
})
|
|
@@ -643,6 +635,52 @@ describe('Project', () => {
|
|
|
643
635
|
})
|
|
644
636
|
})
|
|
645
637
|
|
|
638
|
+
describe("SSO linking code validation", () => {
|
|
639
|
+
it("should throw an error if ssoLinkingCode is shorter than 12 characters", (done) => {
|
|
640
|
+
project.hello.ssoLinkingCode = "HGDUS69SD"
|
|
641
|
+
let Project = new ProjectModel(project)
|
|
642
|
+
Project.validate((err, res) => {
|
|
643
|
+
assert.notExists(res)
|
|
644
|
+
assert.exists(err)
|
|
645
|
+
assert.match(err.message, /SSO linking code must be a 12 character capital alphanumeric text/)
|
|
646
|
+
done()
|
|
647
|
+
})
|
|
648
|
+
})
|
|
649
|
+
|
|
650
|
+
it("should throw an error if ssoLinkingCode is longer than 12 characters", (done) => {
|
|
651
|
+
project.hello.ssoLinkingCode = "HGDUS69SDASLDKJSFDHWUER7Y"
|
|
652
|
+
let Project = new ProjectModel(project)
|
|
653
|
+
Project.validate((err, res) => {
|
|
654
|
+
assert.notExists(res)
|
|
655
|
+
assert.exists(err)
|
|
656
|
+
assert.match(err.message, /SSO linking code must be a 12 character capital alphanumeric text/)
|
|
657
|
+
done()
|
|
658
|
+
})
|
|
659
|
+
})
|
|
660
|
+
|
|
661
|
+
it("should throw an error if ssoLinkingCode include lowercase characters", (done) => {
|
|
662
|
+
project.hello.ssoLinkingCode = "3HgDUs69SD95"
|
|
663
|
+
let Project = new ProjectModel(project)
|
|
664
|
+
Project.validate((err, res) => {
|
|
665
|
+
assert.notExists(res)
|
|
666
|
+
assert.exists(err)
|
|
667
|
+
assert.match(err.message, /SSO linking code must be a 12 character capital alphanumeric text/)
|
|
668
|
+
done()
|
|
669
|
+
})
|
|
670
|
+
})
|
|
671
|
+
|
|
672
|
+
it("should throw an error if ssoLinkingCode is empty", (done) => {
|
|
673
|
+
project.hello.ssoLinkingCode = ""
|
|
674
|
+
let Project = new ProjectModel(project)
|
|
675
|
+
Project.validate((err, res) => {
|
|
676
|
+
assert.notExists(res)
|
|
677
|
+
assert.exists(err)
|
|
678
|
+
assert.match(err.message, /SSO linking code must be a 12 character capital alphanumeric text/)
|
|
679
|
+
done()
|
|
680
|
+
})
|
|
681
|
+
})
|
|
682
|
+
})
|
|
683
|
+
|
|
646
684
|
})
|
|
647
685
|
|
|
648
686
|
describe('should throw an error when any of the values of the array contains a falsy value', () => {
|
package/helpers.js
CHANGED
|
@@ -247,7 +247,7 @@ helpers.validateLongitude = function(longitude){
|
|
|
247
247
|
return longitude >= -180 && longitude <= 180
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
helpers.
|
|
250
|
+
helpers.validateSsoLinkingCode = function(code){
|
|
251
251
|
const expression = '^[A-Z0-9]{12}$'
|
|
252
252
|
const regex = new RegExp(expression)
|
|
253
253
|
return regex.test(code)
|
package/models/Destination.js
CHANGED
|
@@ -17,8 +17,7 @@ const DestinationSchema = new mongoose.Schema({
|
|
|
17
17
|
projectId: {type: String, required: true, validate: {validator: helpers.validateUUIDv4, msg: 'Invalid projectId'}},
|
|
18
18
|
creationTime: {type: Date, default: Date.now},
|
|
19
19
|
lastUpdateTime: {type: Date, default: Date.now},
|
|
20
|
-
waitTime: { type: WaitTime }
|
|
21
|
-
helloSsoCode: {type: String, validate: {validator: helpers.validateHelloSsoCode, msg: 'Hello SSO code must be a 12 character capital alphanumeric text'}}
|
|
20
|
+
waitTime: { type: WaitTime }
|
|
22
21
|
}, {collection: 'destination'})
|
|
23
22
|
|
|
24
23
|
DestinationSchema.plugin(patcher)
|
package/package.json
CHANGED
package/schemas/Integration.js
CHANGED
|
@@ -6,54 +6,15 @@ const bbotIntegrationSchema = require('./BbotIntegration')
|
|
|
6
6
|
const flipdishIntegrationSchema = require('./FlipdishIntegration')
|
|
7
7
|
const projectAttentiveIntegrationSchema = require('./ProjectAttentiveIntegration')
|
|
8
8
|
const incentivioIntegrationSchema = require('./IncentivioIntegration')
|
|
9
|
+
const mparticleIntegrationSchema = require('./MparticleIntegration')
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
androidApiKey
|
|
13
|
-
|
|
14
|
-
validate:{
|
|
15
|
-
validator:apiKeyValidator,
|
|
16
|
-
msg:'androidApiKey should be a non-empty string, found ${VALUE}'
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
androidSecretKey: {
|
|
20
|
-
type: String,
|
|
21
|
-
validate:{
|
|
22
|
-
validator:apiKeyValidator,
|
|
23
|
-
msg:'androidSecretKey should be a non-empty string, found ${VALUE}'
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
iosApiKey:{
|
|
27
|
-
type:String,
|
|
28
|
-
validate:{
|
|
29
|
-
validator:apiKeyValidator,
|
|
30
|
-
msg:'iosApiKey should be a non-empty string, found ${VALUE}'
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
iosSecretKey:{
|
|
34
|
-
type:String,
|
|
35
|
-
validate:{
|
|
36
|
-
validator:apiKeyValidator,
|
|
37
|
-
msg:'iosSecretKey should be a non-empty string, found ${VALUE}'
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
},{ _id : false })
|
|
11
|
+
function mParticleValidator(value) {
|
|
12
|
+
const { androidApiKey, iosApiKey, webApiKey } = value;
|
|
13
|
+
return (!!androidApiKey || !!iosApiKey || !!webApiKey)
|
|
14
|
+
}
|
|
41
15
|
|
|
42
16
|
const IntegrationSchema = new mongoose.Schema({
|
|
43
|
-
mparticle: {
|
|
44
|
-
type: MParticleSchema,
|
|
45
|
-
validate: [{
|
|
46
|
-
validator: mParticleValidator,
|
|
47
|
-
msg: 'either of the two field combinations is mandatory: androidApiKey & androidSecretKey OR iosApiKey & iosSecretKey'
|
|
48
|
-
},{
|
|
49
|
-
validator:iOSPairValidator,
|
|
50
|
-
msg: 'both iosSecretKey and iosApiKey are required'
|
|
51
|
-
},{
|
|
52
|
-
validator:androidPairValidator,
|
|
53
|
-
msg: 'both androidSecretKey and androidApiKey are required'
|
|
54
|
-
}
|
|
55
|
-
]
|
|
56
|
-
},
|
|
17
|
+
mparticle: { type: mparticleIntegrationSchema, validate:{ validator: mParticleValidator, msg:'At least one of Android, iOS or Web keys need to be provided'} },
|
|
57
18
|
olo: { type: oloIntegrationSchema },
|
|
58
19
|
segment: { type: segmentIntegrationSchema },
|
|
59
20
|
oneSignal: { type: oneSignalIntegrationSchema },
|
|
@@ -62,32 +23,5 @@ const IntegrationSchema = new mongoose.Schema({
|
|
|
62
23
|
attentive: { type: projectAttentiveIntegrationSchema },
|
|
63
24
|
incentivio: { type: incentivioIntegrationSchema }
|
|
64
25
|
},{ _id : false });
|
|
65
|
-
function apiKeyValidator(value){
|
|
66
|
-
// check if the value is a non-empty string
|
|
67
|
-
return !(typeof value !=='string' || value.trim() === '')
|
|
68
|
-
}
|
|
69
|
-
function iOSPairValidator(value){
|
|
70
|
-
const {iosApiKey,iosSecretKey} = value
|
|
71
|
-
const isIOSApiKeyProvided = (iosApiKey !== undefined)
|
|
72
|
-
const isIOSSecretProvided = (iosSecretKey !== undefined)
|
|
73
|
-
|
|
74
|
-
return isIOSApiKeyProvided === isIOSSecretProvided
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function androidPairValidator(value){
|
|
78
|
-
const {androidApiKey,androidSecretKey} = value
|
|
79
|
-
const isAndroidApiKeyProvided = (androidApiKey !== undefined)
|
|
80
|
-
const isAndroidSecretProvided = (androidSecretKey !== undefined)
|
|
81
|
-
|
|
82
|
-
return isAndroidApiKeyProvided === isAndroidSecretProvided
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function mParticleValidator(value) {
|
|
86
|
-
const { androidApiKey,androidSecretKey, iosApiKey,iosSecretKey } = value;
|
|
87
|
-
const isAndroidPairProvided = ((androidApiKey !== undefined)&&(androidSecretKey !==undefined))
|
|
88
|
-
const isIosPairProvided = ((iosApiKey !== undefined)&&(iosSecretKey !==undefined))
|
|
89
|
-
|
|
90
|
-
return isIosPairProvided || isAndroidPairProvided;
|
|
91
|
-
}
|
|
92
26
|
|
|
93
27
|
module.exports = IntegrationSchema
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
function apiKeyValidator(value){
|
|
4
|
+
// check if the value is a non-empty string
|
|
5
|
+
return !(typeof value !=='string' || value.trim() === '')
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function mobileValidator() {
|
|
9
|
+
if (!this.androidApiKey && !this.iosApiKey) {
|
|
10
|
+
return false
|
|
11
|
+
} else {
|
|
12
|
+
return true
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function webValidator() {
|
|
17
|
+
if (!this.webApiKey) {
|
|
18
|
+
return false
|
|
19
|
+
} else {
|
|
20
|
+
return true
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//TODO: remove androidSecretKey & iosSecretKey after mparticle BD-5008 released
|
|
25
|
+
let MparticleIntegrationSchema = new mongoose.Schema({
|
|
26
|
+
androidApiKey: {
|
|
27
|
+
type: String,
|
|
28
|
+
validate:{
|
|
29
|
+
validator:apiKeyValidator,
|
|
30
|
+
msg:'androidApiKey should be a non-empty string, found ${VALUE}'
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
androidSecretKey: { type: String },
|
|
34
|
+
iosApiKey:{
|
|
35
|
+
type:String,
|
|
36
|
+
validate:{
|
|
37
|
+
validator:apiKeyValidator,
|
|
38
|
+
msg:'iosApiKey should be a non-empty string, found ${VALUE}'
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
iosSecretKey:{ type:String },
|
|
42
|
+
webApiKey:{
|
|
43
|
+
type:String,
|
|
44
|
+
validate:{
|
|
45
|
+
validator:apiKeyValidator,
|
|
46
|
+
msg:'iosApiKey should be a non-empty string, found ${VALUE}'
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
trigger: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
validate:{
|
|
52
|
+
validator:mobileValidator,
|
|
53
|
+
msg:'Either Android or iOS keys need to be provided'
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
tempo: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
validate:{
|
|
59
|
+
validator:mobileValidator,
|
|
60
|
+
msg:'Either Android or iOS keys need to be provided'
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
wave: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
validate:{
|
|
66
|
+
validator:webValidator,
|
|
67
|
+
msg:'Web keys need to be provided'
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
hello: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
validate:{
|
|
73
|
+
validator:webValidator,
|
|
74
|
+
msg:'Web keys need to be provided'
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
environment: { type: String, default: "production" }
|
|
78
|
+
}, {
|
|
79
|
+
_id: false
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
module.exports = MparticleIntegrationSchema
|
package/schemas/ProjectHello.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
let mongoose = require('mongoose')
|
|
2
|
+
const helpers = require('../helpers')
|
|
2
3
|
|
|
3
4
|
let ProjectHelloSchema = new mongoose.Schema({
|
|
4
5
|
registrationTtl: {type: Number, validate: { validator: Number.isInteger, msg: 'hello.registrationTtl should be an integer number' }},
|
|
6
|
+
ssoLinkingCode: {type: String, validate: {validator: helpers.validateSsoLinkingCode, msg: 'SSO linking code must be a 12 character capital alphanumeric text'}}
|
|
5
7
|
}, {
|
|
6
8
|
_id: false
|
|
7
9
|
})
|
|
@@ -53,16 +53,18 @@ const indexes = {
|
|
|
53
53
|
options: {
|
|
54
54
|
name: "geometry_index"
|
|
55
55
|
}
|
|
56
|
-
}
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
project: [
|
|
57
59
|
{
|
|
58
60
|
fields: {
|
|
59
|
-
|
|
61
|
+
ssoLinkingCode: 1
|
|
60
62
|
},
|
|
61
63
|
options: {
|
|
62
|
-
name: "
|
|
64
|
+
name: "ssoLinkingCode_index",
|
|
63
65
|
unique: true,
|
|
64
66
|
partialFilterExpression: {
|
|
65
|
-
|
|
67
|
+
ssoLinkingCode: { $type: "string" }
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
}
|