@bluedot-innovation/models 7.0.3 → 7.0.5

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.0.4
2
+ - Re-added Circle radius to be > 5m
3
+
1
4
  ## 7.0.3
2
5
  - Reverted changes on 7.0.2 for renaming of doorbell premigration
3
6
  - Renamed doorbell trigger type to wave
@@ -17,6 +20,9 @@
17
20
  - BREAKING CHANGE - Moved zone destinationId to object root and removed tempo object from zone
18
21
  - Added 'doorbell' type to project webhooks
19
22
 
23
+ ## 6.2.12
24
+ - Re-added Circle radius to be > 5m
25
+
20
26
  ## 6.2.11
21
27
  - Replace `isAsync` validators with Mongoose 5.x validators
22
28
 
@@ -51,6 +51,18 @@ testCase('Circle', () => {
51
51
  })
52
52
 
53
53
  testCase('Invalid Circle', () => {
54
+ // BD2571
55
+ assertions('should not validate a Circle with radius <5 meters', (done) => {
56
+ circle.radius = 3
57
+ let Circle = new CircleModelBuiltInMongoose(circle)
58
+ Circle.validate((err, res) => {
59
+ assert.exists(err)
60
+ assert.isObject(err.errors)
61
+ assert.strictEqual(err.errors.radius.message, `radius [3m] must be greater than 5m`)
62
+ done()
63
+ })
64
+ })
65
+
54
66
  assertions('should not validate a Circle with no radius', (done) => {
55
67
  delete circle.radius
56
68
  let Circle = new CircleModel(circle)
@@ -10,7 +10,17 @@ let schema = {
10
10
  name: {type: String, required: [true, 'name is required. ']},
11
11
  color: String,
12
12
  accuracy: {type: String, enum: Object.values(ZoneEnum.fenceAccuracy)},
13
- radius: {type: Double, required: [true, 'radius is required. '], min: 5},
13
+ radius: {
14
+ type: Double,
15
+ required: [true, 'radius is required. '],
16
+ validate: {
17
+ validator: function(v) {
18
+ return (v >= 5) ;
19
+ },
20
+ message: props => `radius [${props.value}m] must be greater than 5m`
21
+ },
22
+
23
+ },
14
24
  center: {type: Point, required: [true, 'center is required. ']}
15
25
  }
16
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "7.0.3",
3
+ "version": "7.0.5",
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",