@bluedot-innovation/models 7.5.5 → 7.5.7

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
+ ## 7.5.7
2
+ - Add Olo integration
3
+
4
+ ## 7.5.6
5
+ - Remove TMP models
6
+
1
7
  ## 7.5.5
2
8
  - Remove url requirement from mobivity webhook body
3
9
 
package/Models.js CHANGED
@@ -28,11 +28,6 @@ Models.TravelPath = require('./models/conditions/TravelPath').Model
28
28
  Models.Speed = require('./models/conditions/Speed').Model
29
29
  Models.TravelDirection = require('./models/conditions/TravelDirection').Model
30
30
 
31
- // Test Management Portal
32
- Models.TestDevice = require('./models/TestDevice').Model
33
- Models.TestDeviceCluster = require('./models/TestDeviceCluster').Model
34
- Models.TestInstance = require('./models/TestInstance').Model
35
- Models.TestScenario = require('./models/TestScenario').Model
36
31
  // Added V1 Application model to get Remote Config details for Test Management Portal.
37
32
  // This model can be removed once we start using V2 models.
38
33
  Models.Application = require('./models/Application').Model
@@ -50,6 +50,10 @@
50
50
  "androidSecretKey": "eZqphc1Vh2dqaIQEvz4APNbErZkW_AaaRmwE8BCmYpHZFc3n_ZKajTLgJgFqLNNN",
51
51
  "iosApiKey": "us1-a5e6eefe90fe704aba0a7d2daa00baaa",
52
52
  "iosSecretKey": "fZqphc1Vh2dqaIQEvz4APNbErZkW_AaaRmwE8BCmYpHZFc3n_ZKajTLgJgFqLNNN"
53
+ },
54
+ "olo": {
55
+ "sharedSecret": "jhFGJHKJhkHIjklJ",
56
+ "nowReadyEnabled": true
53
57
  }
54
58
  },
55
59
  "tempo": {
@@ -509,6 +509,18 @@ describe('Project', () => {
509
509
  })
510
510
  })
511
511
  })
512
+
513
+ describe("olo integration validation", () => {
514
+ it('should throw an error when sharedSecret is missing', (done) => {
515
+ delete project.integrations.olo.sharedSecret
516
+ let Project = new ProjectModel(project)
517
+ Project.validate((err, res) => {
518
+ assert.exists(err)
519
+ assert.match(err.message, /`sharedSecret` is required/)
520
+ done()
521
+ })
522
+ })
523
+ })
512
524
  })
513
525
 
514
526
  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": "7.5.5",
3
+ "version": "7.5.7",
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",
@@ -1,5 +1,5 @@
1
1
  let mongoose = require("mongoose");
2
-
2
+ const oloIntegrationSchema = require('./OloIntegration')
3
3
 
4
4
 
5
5
  const MParticleSchema = new mongoose.Schema({
@@ -46,9 +46,9 @@ const IntegrationSchema = new mongoose.Schema({
46
46
  validator:androidPairValidator,
47
47
  msg: 'both androidSecretKey and androidApiKey are required'
48
48
  }
49
- ],
50
- required: true
51
- }
49
+ ]
50
+ },
51
+ olo: { type: oloIntegrationSchema }
52
52
  },{ _id : false });
53
53
  function apiKeyValidator(value){
54
54
  // check if the value is a non-empty string
@@ -0,0 +1,10 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ let OloIntegrationSchema = new mongoose.Schema({
4
+ sharedSecret: {type: String, required: true},
5
+ nowReadyEnabled: {type: Boolean, default: false}
6
+ }, {
7
+ _id: false
8
+ })
9
+
10
+ module.exports = OloIntegrationSchema
@@ -1,42 +0,0 @@
1
- /**
2
- * Created by Andrew on 01/03/2017.
3
- * Copyright : Bluedot Innovations.
4
- * Owner :
5
- */
6
- let mongoose = require('mongoose')
7
- let StateEnum = require('@bluedot-innovation/enums').StateEnum
8
-
9
- let TestDeviceSchema = new mongoose.Schema({
10
- name: String,
11
- identifier: String,
12
- os: String,
13
- osVersion: String,
14
- hostToken: String,
15
- batteryToken: String,
16
- model: String,
17
- trackingDevice: {type: Boolean, default: false},
18
- creationTime: {type: Date, default: Date.now},
19
- lastUpdateTime: {type: Date, default: Date.now},
20
- serialNumber: String,
21
- mobileNumber: String,
22
- deviceType: String,
23
- state: {type: String, default: StateEnum.ACTIVE},
24
- comments: String,
25
- imei: String,
26
- udid: String
27
- },
28
- { collection: 'testDevice'})
29
-
30
- // optional mongoose
31
- let model = (mongooseInstance) => {
32
- let TestDevice
33
- if (mongooseInstance) {
34
- TestDevice = mongooseInstance.model('TestDevice', TestDeviceSchema)
35
- } else {
36
- TestDevice = mongoose.model('TestDevice', TestDeviceSchema)
37
- }
38
-
39
- return TestDevice
40
- }
41
-
42
- module.exports = { Model: model, Schema: TestDeviceSchema }
@@ -1,32 +0,0 @@
1
- /**
2
- * Created by Andrew on 02/03/2017.
3
- * Copyright : Bluedot Innovation.
4
- */
5
- let mongoose = require('mongoose')
6
- let StateEnum = require('@bluedot-innovation/enums').StateEnum
7
-
8
- let TestDeviceClusterSchema = new mongoose.Schema(
9
- {
10
- name: String,
11
- devices: [],
12
- creationTime: {type: Date, default: Date.now},
13
- lastUpdateTime: {type: Date, default: Date.now},
14
- comments: String,
15
- state: {type: String, default: StateEnum.ACTIVE}
16
- },
17
- { collection: 'testDeviceCluster' }
18
- )
19
-
20
- // optional mongoose
21
- let model = (mongooseInstance) => {
22
- let TestDeviceCluster
23
- if (mongooseInstance) {
24
- TestDeviceCluster = mongooseInstance.model('TestDeviceCluster', TestDeviceClusterSchema)
25
- } else {
26
- TestDeviceCluster = mongoose.model('TestDeviceCluster', TestDeviceClusterSchema)
27
- }
28
-
29
- return TestDeviceCluster
30
- }
31
-
32
- module.exports = { Model: model, Schema: TestDeviceClusterSchema }
@@ -1,60 +0,0 @@
1
- /**
2
- * Created by Andrew on 02/03/2017.
3
- * Copyright : Bluedot Innovation.
4
- */
5
- let mongoose = require('mongoose')
6
- let StateEnum = require('@bluedot-innovation/enums').StateEnum
7
- let TestStatusEnum = require('@bluedot-innovation/enums').TestStatusEnum
8
-
9
- const Schema = mongoose.Schema
10
- let Scenario = require('./TestScenario').Schema
11
-
12
- let TestInstanceSchema = new mongoose.Schema(
13
- {
14
- name: String,
15
- scenarioId: String,
16
- devices: {},
17
- clusters: {type: Array, default: []},
18
- mode: String,
19
- startTime: Date,
20
- endTime: Date,
21
- duration: Number,
22
- endPoint: String,
23
- trackedLocations: {type: Array, default: []},
24
- creationTime: {type: Date, default: Date.now},
25
- lastUpdateTime: {type: Date, default: Date.now},
26
- state: {type: String, default: StateEnum.ACTIVE},
27
- status: {type: String, default: TestStatusEnum.PLANNED},
28
- isValid: {type: Boolean, default: true},
29
- comments: String,
30
- isProduction: Boolean,
31
- enableBackgroundLocationIndicator: {type: Boolean, default: false},
32
- enableForegroundService: {type: Boolean, default: true},
33
- sdkVersion: String,
34
- sdkBuildNumber: String,
35
- platform: String,
36
- appVersion: String,
37
- buildType: String,
38
- locationPermission: String,
39
- roundNumber: Number,
40
- useCaseType: String,
41
- groupOfDevices: String,
42
- configurationParameters:{type: Schema.Types.Mixed, default: null},
43
- scenario: Scenario
44
- },
45
- { collection: 'testInstance' }
46
- )
47
-
48
- // optional mongoose
49
- let model = (mongooseInstance) => {
50
- let TestInstance
51
- if (mongooseInstance) {
52
- TestInstance = mongooseInstance.model('TestInstance', TestInstanceSchema)
53
- } else {
54
- TestInstance = mongoose.model('TestInstance', TestInstanceSchema)
55
- }
56
-
57
- return TestInstance
58
- }
59
-
60
- module.exports = { Model: model, Schema: TestInstanceSchema }
@@ -1,40 +0,0 @@
1
- /**
2
- * Created by Andrew on 02/03/2017.
3
- * Copyright : Bluedot Innovations.
4
- * Owner :
5
- */
6
- let mongoose = require('mongoose')
7
- let StateEnum = require('@bluedot-innovation/enums').StateEnum
8
-
9
- let TestScenarioSchema = new mongoose.Schema(
10
- {
11
- name: String,
12
- apiKey: String,
13
- customerApiKey: String,
14
- email: String,
15
- creationTime: {type: Date, default: Date.now},
16
- lastUpdateTime: {type: Date, default: Date.now},
17
- state: {type: String, default: StateEnum.ACTIVE},
18
- numberZones: String,
19
- comments: String,
20
- environment: String,
21
- accountId: String,
22
- projectId: String,
23
- zones: []
24
- },
25
- { collection: 'testScenario' }
26
- )
27
-
28
- // optional mongoose
29
- let model = (mongooseInstance) => {
30
- let TestScenario
31
- if (mongooseInstance) {
32
- TestScenario = mongooseInstance.model('TestScenario', TestScenarioSchema)
33
- } else {
34
- TestScenario = mongoose.model('TestScenario', TestScenarioSchema)
35
- }
36
-
37
- return TestScenario
38
- }
39
-
40
- module.exports = { Model: model, Schema: TestScenarioSchema }