@bluedot-innovation/models 6.2.5 → 6.2.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
+ ## 6.2.7
2
+ - Add `shouldSync` to Project
3
+
4
+ ## 6.2.6
5
+ - Add `features.realTimeDashboard` to Account
6
+
1
7
  ## 6.2.5
2
8
  - Add `tempo.isochroneBracketInterval` to Project
3
9
 
@@ -1,13 +1,19 @@
1
1
  {
2
+ "_id": "48e3876b-5be1-4dda-8490-8660ba6e01f7",
2
3
  "state": "ACTIVE",
3
4
  "lastUpdateTime": "2018-02-14T04:12:02.103Z",
4
5
  "creationTime": "2018-02-14T04:12:02.103Z",
5
6
  "name": "ABC Company",
6
7
  "createdBy": "b0824b76-ce73-4fcf-81f8-1b63edb1114e",
8
+ "customerApiKey": "55645af4-a8cb-468d-93fa-c15dacc949ca",
7
9
  "poiCredits": 23,
8
10
  "features": {
9
- "tags": true,
10
- "beacons": false
11
+ "tempo": {
12
+ "enabled": true
13
+ },
14
+ "realTimeDashboard": {
15
+ "enabled": true
16
+ }
11
17
  },
12
18
  "integrations": {
13
19
  "sfmc": {
@@ -26,6 +26,8 @@ testCase('Account', () => {
26
26
  assert(err === null, 'err equals null')
27
27
  done()
28
28
  })
29
+
30
+ assert.deepEqual(JSON.parse(JSON.stringify(Account)), account, "All values should be present in Account model")
29
31
  })
30
32
 
31
33
  assertions('should validate a valid account', (done) => {
@@ -12,6 +12,7 @@
12
12
  "securityToken" : "value"
13
13
  }
14
14
  }],
15
+ "shouldSync": false,
15
16
  "firebaseApiKey": "88888888-4444-4444-4444-121212121212",
16
17
  "apiKey": "88888888-4444-4444-4444-123412341234",
17
18
  "integrations":{
@@ -38,6 +38,17 @@ testCase('Project', () => {
38
38
  done()
39
39
  })
40
40
  })
41
+
42
+ assertions('should set the value of shouldSync to true when it is not defined', (done) => {
43
+ let project = JSON.parse(JSON.stringify(require('./project.remote.config.json')))
44
+ delete project.shouldSync
45
+ let Project = new ProjectModel(project)
46
+ assert.equal(Project.shouldSync, true, "shouldSync should be set to true")
47
+ Project.validate((err, res) => {
48
+ assert.notExists(err)
49
+ done()
50
+ })
51
+ })
41
52
  })
42
53
  testCase('Valid Project ', () => {
43
54
  assertions('should validate a valid project ', (done) => {
package/models/Project.js CHANGED
@@ -38,6 +38,7 @@ let ProjectSchema = new mongoose.Schema({
38
38
  lastUpdateTime: {type: Date, default: Date.now},
39
39
  lastSyncTime: {type: Date, default: Date.now},
40
40
  name: {type: String, required: [true, 'name is required']},
41
+ shouldSync: { type: Boolean, default: true },
41
42
  accountId: {type: String, required: true, validate: {isAsync: false, validator: helpers.validateUUIDv4, msg: 'default error message'}},
42
43
  webhooks: {type:[WebhookSchema], validate: webhooksValidators},
43
44
  configurationParameters: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "6.2.5",
3
+ "version": "6.2.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,8 +1,10 @@
1
1
  let mongoose = require('mongoose')
2
2
  let AccountTempoSchema = require('./AccountTempo')
3
+ let AccountRealTimeDashboardSchema = require('./AccountRealTimeDashboard')
3
4
 
4
5
  let AccountFeaturesSchema = new mongoose.Schema({
5
- tempo: AccountTempoSchema
6
+ tempo: AccountTempoSchema,
7
+ realTimeDashboard: AccountRealTimeDashboardSchema
6
8
  }, {
7
9
  _id: false
8
10
  })
@@ -0,0 +1,9 @@
1
+ let mongoose = require('mongoose')
2
+
3
+ let AccountRealTimeDashboardSchema = new mongoose.Schema({
4
+ enabled: {type: Boolean}
5
+ }, {
6
+ _id: false
7
+ })
8
+
9
+ module.exports = AccountRealTimeDashboardSchema