@bluedot-innovation/models 2.0.2-alpha.1 → 2.0.3-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 +4 -1
- package/models/Beacon.js +7 -6
- package/models/BoundingBox.js +1 -1
- package/models/Circle.js +1 -1
- package/models/Polygon.js +1 -1
- package/models/Polyline.js +1 -1
- package/models/Zone.js +1 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/models/Beacon.js
CHANGED
|
@@ -20,11 +20,6 @@ let schema = {
|
|
|
20
20
|
description: {type: String, default: ''},
|
|
21
21
|
lastUpdateTime: {type: Date},
|
|
22
22
|
state: {type: String, default: StateEnum.active},
|
|
23
|
-
major: {type: Number, validate: [{validator: validateMajorMinor, msg: 'Major needs to be within range(1-65535)'}]},
|
|
24
|
-
minor: {type: Number, validate: [{validator: validateMajorMinor, msg: 'Minor needs to be within range(1-65535)'}]},
|
|
25
|
-
txPower: {type: Number},
|
|
26
|
-
macAddress: {type: String},
|
|
27
|
-
proximityUUID: {type: String},
|
|
28
23
|
beaconType: {
|
|
29
24
|
type: String,
|
|
30
25
|
required: true,
|
|
@@ -38,7 +33,13 @@ let schema = {
|
|
|
38
33
|
proximity: {type: String, default: 'Far'},
|
|
39
34
|
accountId: {
|
|
40
35
|
type: String, required: true
|
|
41
|
-
}
|
|
36
|
+
},
|
|
37
|
+
// These must be unique
|
|
38
|
+
major: {type: Number, validate: [{validator: validateMajorMinor, msg: 'Major needs to be within range(1-65535)'}]},
|
|
39
|
+
minor: {type: Number, validate: [{validator: validateMajorMinor, msg: 'Minor needs to be within range(1-65535)'}]},
|
|
40
|
+
txPower: {type: Number},
|
|
41
|
+
macAddress: {type: String},
|
|
42
|
+
proximityUUID: {type: String}
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
let BeaconSchema = new mongoose.Schema(schema, {collection: 'beacon'})
|
package/models/BoundingBox.js
CHANGED
|
@@ -4,7 +4,7 @@ let uuidv4 = require('uuid/v4')
|
|
|
4
4
|
let Point = require('../schemas/Point')
|
|
5
5
|
|
|
6
6
|
const schema = {
|
|
7
|
-
|
|
7
|
+
_id: {type: String, default: uuidv4},
|
|
8
8
|
name: {type: String, required: [true, 'name is required. ']},
|
|
9
9
|
color: String,
|
|
10
10
|
northEast: {type: Point, required: [true, 'northEast is required. ']},
|
package/models/Circle.js
CHANGED
|
@@ -4,7 +4,7 @@ let Point = require('../schemas/Point')
|
|
|
4
4
|
let uuidv4 = require('uuid/v4')
|
|
5
5
|
|
|
6
6
|
let schema = {
|
|
7
|
-
|
|
7
|
+
_id: {type: String, default: uuidv4},
|
|
8
8
|
name: {type: String, required: [true, 'name is required. ']},
|
|
9
9
|
color: String,
|
|
10
10
|
radius: {type: Number, required: [true, 'radius is required. '], min: 5},
|
package/models/Polygon.js
CHANGED
|
@@ -4,7 +4,7 @@ let Point = require('../schemas/Point')
|
|
|
4
4
|
let uuidv4 = require('uuid/v4')
|
|
5
5
|
|
|
6
6
|
const schema = {
|
|
7
|
-
|
|
7
|
+
_id: {type: String, default: uuidv4},
|
|
8
8
|
name: {type: String, required: [true, 'name is required. ']},
|
|
9
9
|
color: String,
|
|
10
10
|
vertices: {type: [Point], required: [true, 'vertices is required. ']},
|
package/models/Polyline.js
CHANGED
|
@@ -4,7 +4,7 @@ let Point = require('../schemas/Point')
|
|
|
4
4
|
let uuidv4 = require('uuid/v4')
|
|
5
5
|
|
|
6
6
|
const schema = {
|
|
7
|
-
|
|
7
|
+
_id: {type: String, default: uuidv4},
|
|
8
8
|
name: {type: String, required: [true, 'name is required. ']},
|
|
9
9
|
vertices: {type: [Point], required: [true, 'vertices is required. ']},
|
|
10
10
|
creationTime: {type: Date, default: Date.now},
|
package/models/Zone.js
CHANGED
|
@@ -58,10 +58,6 @@ let ZoneSchema = new Schema({
|
|
|
58
58
|
type: [geofeatureSchema],
|
|
59
59
|
required: true
|
|
60
60
|
},
|
|
61
|
-
beacons: {
|
|
62
|
-
type: [beaconSchema],
|
|
63
|
-
default: []
|
|
64
|
-
},
|
|
65
61
|
customData: [{type: Schema.Types.Mixed}],
|
|
66
62
|
description: {type: String, default: ''},
|
|
67
63
|
creationTime: {type: Date, required: [true, 'creationTime is required'], select: false},
|
|
@@ -82,8 +78,8 @@ ZoneSchema.path('filters').discriminator('percentageCrossed', new Schema(percent
|
|
|
82
78
|
ZoneSchema.path('filters').discriminator('speed', new Schema(speedFilterSchema))
|
|
83
79
|
ZoneSchema.path('filters').discriminator('timeOfDayRange', new Schema(timeOfDayRangeFilterSchema))
|
|
84
80
|
|
|
85
|
-
ZoneSchema.path('geofeatures').discriminator('circle', new Schema(circleSchema))
|
|
86
81
|
ZoneSchema.path('geofeatures').discriminator('beacon', new Schema(beaconSchema))
|
|
82
|
+
ZoneSchema.path('geofeatures').discriminator('circle', new Schema(circleSchema))
|
|
87
83
|
ZoneSchema.path('geofeatures').discriminator('polygon', new Schema(polygonSchema))
|
|
88
84
|
ZoneSchema.path('geofeatures').discriminator('polyline', new Schema(polylineSchema))
|
|
89
85
|
ZoneSchema.path('geofeatures').discriminator('boundingBox', new Schema(boundingBoxSchema))
|