@bluedot-innovation/models 7.5.7 → 7.5.8

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
+ ## 7.5.8
2
+ - Add CEMD Persistencce feature
3
+
1
4
  ## 7.5.7
2
5
  - Add Olo integration
3
6
 
@@ -21,6 +21,12 @@
21
21
  },
22
22
  "insights": {
23
23
  "enabled": true
24
+ },
25
+ "cemdPersistence": {
26
+ "whitelistedFields": [
27
+ "hs_field1",
28
+ "hs_field2"
29
+ ]
24
30
  }
25
31
  },
26
32
  "integrations": {
@@ -39,6 +39,28 @@ testCase('Account', () => {
39
39
  done()
40
40
  })
41
41
  })
42
+
43
+ it('Should valid the account when CEMD whitelistedFields is null', (done) => {
44
+ account = JSON.parse(JSON.stringify(account))
45
+ account.features.cemdPersistence.whitelistedFields = null
46
+ const Account = new AccountModel(account)
47
+ Account.validate((err, res) => {
48
+ assert.notExists(res)
49
+ assert(err === null, 'err equals null')
50
+ done()
51
+ })
52
+ })
53
+
54
+ it('Should valid the account when CEMD whitelistedFields is undefined', (done) => {
55
+ account = JSON.parse(JSON.stringify(account))
56
+ delete account.features.cemdPersistence.whitelistedFields
57
+ const Account = new AccountModel(account)
58
+ Account.validate((err, res) => {
59
+ assert.notExists(res)
60
+ assert(err === null, 'err equals null')
61
+ done()
62
+ })
63
+ })
42
64
  })
43
65
 
44
66
  testCase('Invalid Account', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "7.5.7",
3
+ "version": "7.5.8",
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
+ let mongoose = require('mongoose')
2
+
3
+ let AccountCemdPersistenceSchema = new mongoose.Schema({
4
+ whitelistedFields: {type: [String]}
5
+ }, {
6
+ _id: false
7
+ })
8
+
9
+ module.exports = AccountCemdPersistenceSchema
@@ -2,12 +2,14 @@ let mongoose = require('mongoose')
2
2
  let AccountTempoSchema = require('./AccountTempo')
3
3
  let AccountBasicFeatureSchema = require('./AccountBasicFeature')
4
4
  let AccountScreensSchema = require('./AccountScreens')
5
+ let AccountCemdPersistenceSchema = require('./AccountCemdPersistence')
5
6
 
6
7
  let AccountFeaturesSchema = new mongoose.Schema({
7
8
  tempo: AccountTempoSchema,
8
9
  realTimeDashboard: AccountBasicFeatureSchema,
9
10
  screens: AccountScreensSchema,
10
- insights: AccountBasicFeatureSchema
11
+ insights: AccountBasicFeatureSchema,
12
+ cemdPersistence: AccountCemdPersistenceSchema
11
13
  }, {
12
14
  _id: false
13
15
  })