@bluedot-innovation/models 10.0.0 → 10.1.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.
package/CHANGELOG.md
CHANGED
|
@@ -1034,6 +1034,19 @@ describe('Project', () => {
|
|
|
1034
1034
|
}
|
|
1035
1035
|
})
|
|
1036
1036
|
})
|
|
1037
|
+
|
|
1038
|
+
describe("Ubereats integration validation", () => {
|
|
1039
|
+
it('should throw an error when enabled is not boolean', async () => {
|
|
1040
|
+
project.integrations.uberEats.enabled = 'test'
|
|
1041
|
+
let Project = new ProjectModel(project)
|
|
1042
|
+
try {
|
|
1043
|
+
await Project.validate()
|
|
1044
|
+
} catch (err) {
|
|
1045
|
+
assert.exists(err, 'err object should exist')
|
|
1046
|
+
assert.match(err.message, /Cast to Boolean failed for value .*enabled/)
|
|
1047
|
+
}
|
|
1048
|
+
})
|
|
1049
|
+
})
|
|
1037
1050
|
})
|
|
1038
1051
|
|
|
1039
1052
|
describe('should throw an error when any of the values of the array contains a falsy value', () => {
|
package/package.json
CHANGED
package/schemas/Integration.js
CHANGED
|
@@ -9,6 +9,7 @@ const incentivioIntegrationSchema = require('./IncentivioIntegration')
|
|
|
9
9
|
const mparticleIntegrationSchema = require('./MparticleIntegration')
|
|
10
10
|
const klaviyoIntegrationSchema = require('./KlaviyoIntegration')
|
|
11
11
|
const doordashIntegrationSchema = require('./DoordashIntegration')
|
|
12
|
+
const ubereatsIntegrationSchema = require('./UberEatsIntegration')
|
|
12
13
|
|
|
13
14
|
function mParticleValidator(value) {
|
|
14
15
|
const { androidApiKey, iosApiKey, webApiKey } = value;
|
|
@@ -25,7 +26,8 @@ const IntegrationSchema = new mongoose.Schema({
|
|
|
25
26
|
attentive: { type: projectAttentiveIntegrationSchema },
|
|
26
27
|
incentivio: { type: incentivioIntegrationSchema },
|
|
27
28
|
klaviyo: { type: klaviyoIntegrationSchema },
|
|
28
|
-
doordash: { type: doordashIntegrationSchema }
|
|
29
|
+
doordash: { type: doordashIntegrationSchema },
|
|
30
|
+
uberEats: { type: ubereatsIntegrationSchema }
|
|
29
31
|
},{ _id : false });
|
|
30
32
|
|
|
31
33
|
module.exports = IntegrationSchema
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
let UberEatsIntegrationSchema = new mongoose.Schema({
|
|
4
|
+
enabled: {type: Boolean, required: true, default: false},
|
|
5
|
+
lastSyncedTime: {type: Date, default: Date.now, required: true}
|
|
6
|
+
}, {
|
|
7
|
+
_id: false
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
module.exports = UberEatsIntegrationSchema
|