@bluedot-innovation/models 9.0.2 → 9.0.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,6 @@
1
+ ## 9.0.3
2
+ - Add Doordash integraion to Project model
3
+
1
4
  ## 9.0.2
2
5
  - Add structure 2.0 for geo-trigger webhook
3
6
 
@@ -105,6 +105,9 @@
105
105
  "tempo": true,
106
106
  "wave": true,
107
107
  "hello": true
108
+ },
109
+ "doordash": {
110
+ "authorizationToken": "1986d1de-85ea-4339-93a2-6442d44a31f6"
108
111
  }
109
112
  },
110
113
  "tempo": {
@@ -998,6 +998,18 @@ describe('Project', () => {
998
998
  })
999
999
  })
1000
1000
  })
1001
+
1002
+ describe("Doordash integration validation", () => {
1003
+ it('should throw an error when authorizationToken is missing', (done) => {
1004
+ delete project.integrations.doordash.authorizationToken
1005
+ let Project = new ProjectModel(project)
1006
+ Project.validate((err, res) => {
1007
+ assert.exists(err)
1008
+ assert.match(err.message, /`authorizationToken` is required/)
1009
+ done()
1010
+ })
1011
+ })
1012
+ })
1001
1013
  })
1002
1014
 
1003
1015
  describe('should throw an error when any of the values of the array contains a falsy value', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "9.0.2",
3
+ "version": "9.0.3",
4
4
  "main": "Models.js",
5
5
  "scripts": {
6
6
  "lint": "./node_modules/.bin/eslint -c .eslintrc.js ./models/*.js ./__tests__/**/*.js ./__tests__/**/**/*.js ./schemas/*.js",
@@ -0,0 +1,9 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ let DoordashIntegrationSchema = new mongoose.Schema({
4
+ authorizationToken: {type: String, required: true}
5
+ }, {
6
+ _id: false
7
+ })
8
+
9
+ module.exports = DoordashIntegrationSchema
@@ -7,7 +7,8 @@ const flipdishIntegrationSchema = require('./FlipdishIntegration')
7
7
  const projectAttentiveIntegrationSchema = require('./ProjectAttentiveIntegration')
8
8
  const incentivioIntegrationSchema = require('./IncentivioIntegration')
9
9
  const mparticleIntegrationSchema = require('./MparticleIntegration')
10
- const klaviyoIntegrationSchema = require('./KlaviyoIntegration');
10
+ const klaviyoIntegrationSchema = require('./KlaviyoIntegration')
11
+ const doordashIntegrationSchema = require('./DoordashIntegration')
11
12
 
12
13
  function mParticleValidator(value) {
13
14
  const { androidApiKey, iosApiKey, webApiKey } = value;
@@ -23,7 +24,8 @@ const IntegrationSchema = new mongoose.Schema({
23
24
  flipdish: { type: flipdishIntegrationSchema },
24
25
  attentive: { type: projectAttentiveIntegrationSchema },
25
26
  incentivio: { type: incentivioIntegrationSchema },
26
- klaviyo: { type: klaviyoIntegrationSchema }
27
+ klaviyo: { type: klaviyoIntegrationSchema },
28
+ doordash: { type: doordashIntegrationSchema }
27
29
  },{ _id : false });
28
30
 
29
31
  module.exports = IntegrationSchema