@bluedot-innovation/models 2.0.4-alpha.3 → 2.0.5-alpha.1
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 +6 -0
- package/__tests__/zone/zone.data.json +5 -8
- package/models/Beacon.js +1 -12
- package/models/Zone.js +2 -1
- package/models/ZoneBeacon.js +13 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 2.0.5
|
|
2
|
+
- Beacon using a `location` property instead of `latitude` and `longitude` on the root
|
|
3
|
+
- ZoneBeacon model inheriting from Beacon, adds `proximity` and `type`
|
|
4
|
+
- Zone will use ZoneBeacon instead of Beacon model
|
|
5
|
+
- Removed `proximity` from Beacon
|
|
6
|
+
|
|
1
7
|
## 2.0.4
|
|
2
8
|
- customData no longer an array
|
|
3
9
|
- add accountId to zones
|
|
@@ -5,14 +5,11 @@
|
|
|
5
5
|
"lastUpdateTime": "2018-02-14T04:12:02.103Z",
|
|
6
6
|
"creationTime": "2018-02-14T04:12:02.103Z",
|
|
7
7
|
"projectId": "c7058934-f1e6-4176-8730-a0bd28e8e0a9",
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"name2": "A Custom action2"
|
|
14
|
-
}
|
|
15
|
-
],
|
|
8
|
+
"accountId": "23a01af0-232a-4518-9c0e-323fb773f5ef",
|
|
9
|
+
"customData": {
|
|
10
|
+
"name1": "A Custom action1",
|
|
11
|
+
"name2": "A Custom action2"
|
|
12
|
+
},
|
|
16
13
|
"actions": [
|
|
17
14
|
{
|
|
18
15
|
"type": "message",
|
package/models/Beacon.js
CHANGED
|
@@ -6,17 +6,7 @@ let patcher = require('mongoose-json-patch')
|
|
|
6
6
|
|
|
7
7
|
let schema = {
|
|
8
8
|
_id: {type: String, default: uuidv4},
|
|
9
|
-
name: {type: String, required: [true, 'name is required.
|
|
10
|
-
longitude: {
|
|
11
|
-
type: Number,
|
|
12
|
-
required: true,
|
|
13
|
-
validate: [{validator: validateLongitude, msg: 'Longitude is required (insert format here)'}]
|
|
14
|
-
},
|
|
15
|
-
latitude: {
|
|
16
|
-
type: Number,
|
|
17
|
-
required: true,
|
|
18
|
-
validate: [{validator: validateLatitude, msg: 'Latitude is required (insert format here)'}]
|
|
19
|
-
},
|
|
9
|
+
name: {type: String, required: [true, 'name is required.']},
|
|
20
10
|
description: {type: String, default: ''},
|
|
21
11
|
creationTime: {type: Date, default: Date.now},
|
|
22
12
|
lastUpdateTime: {type: Date, default: Date.now},
|
|
@@ -31,7 +21,6 @@ let schema = {
|
|
|
31
21
|
}
|
|
32
22
|
},
|
|
33
23
|
location: {type: Point},
|
|
34
|
-
proximity: {type: String, default: 'Far'},
|
|
35
24
|
accountId: {
|
|
36
25
|
type: String, required: true
|
|
37
26
|
},
|
package/models/Zone.js
CHANGED
|
@@ -13,7 +13,8 @@ let circleSchema = require('./Circle').circleSchema
|
|
|
13
13
|
let boundingBoxSchema = require('./BoundingBox').boundingBoxSchema
|
|
14
14
|
let polylineSchema = require('./Polyline').polylineSchema
|
|
15
15
|
let polygonSchema = require('./Polygon').polygonSchema
|
|
16
|
-
let beaconSchema = require('./Beacon').beaconSchema
|
|
16
|
+
// let beaconSchema = require('./Beacon').beaconSchema
|
|
17
|
+
let beaconSchema = require('./ZoneBeacon').Schema.obj
|
|
17
18
|
let speedFilterSchema = require('./SpeedFilter').speedFilterSchema
|
|
18
19
|
let bearingFilterSchema = require('./BearingFilter').bearingFilterSchema
|
|
19
20
|
let timeOfDayRangeFilterSchema = require('./TimeOfDayRangeFilter').timeOfDayRangeFilterSchema
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
let mongoose = require('mongoose')
|
|
2
|
+
let Beacon = require('./Beacon').Model()
|
|
3
|
+
|
|
4
|
+
var options = {discriminatorKey: 'type'}
|
|
5
|
+
|
|
6
|
+
const ZoneBeaconSchema = new mongoose.Schema({
|
|
7
|
+
proximity: {type: String, default: 'Far'},
|
|
8
|
+
type: {type: String, required: true}
|
|
9
|
+
}, options)
|
|
10
|
+
|
|
11
|
+
const ZoneBeacon = Beacon.discriminator('beacon', ZoneBeaconSchema)
|
|
12
|
+
|
|
13
|
+
module.exports = { Model: ZoneBeacon, Schema: ZoneBeaconSchema }
|