@bluedot-innovation/models 2.0.0-beta.12 → 2.0.0-beta.14
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 +7 -0
- package/__tests__/{geofeature/beacon → beacon}/beacon.data.json +3 -2
- package/__tests__/{geofeature/beacon → beacon}/beacon.spec.js +1 -1
- package/__tests__/zone/zone.data.json +3 -1
- package/models/Beacon.js +6 -4
- package/models/Zone.js +4 -0
- package/package.json +1 -1
- /package/__tests__/{geofeature/beacon → beacon}/beacon.rules.json +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,7 @@ let mongoose = require('mongoose')
|
|
|
2
2
|
|
|
3
3
|
mongoose.Promise = global.Promise
|
|
4
4
|
|
|
5
|
-
let BeaconModel = require('
|
|
5
|
+
let BeaconModel = require('../../Models').Beacon(mongoose)
|
|
6
6
|
let testCase = require('mocha').describe
|
|
7
7
|
let assertions = require('mocha').it
|
|
8
8
|
let chai = require('chai')
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"url": "https://www.google.com"
|
|
25
25
|
}
|
|
26
26
|
],
|
|
27
|
+
"beacons": [],
|
|
27
28
|
"filters": [
|
|
28
29
|
{
|
|
29
30
|
"type" : "calendarDateRange",
|
|
@@ -42,7 +43,8 @@
|
|
|
42
43
|
"phone": 123123123123,
|
|
43
44
|
"minor": 56466,
|
|
44
45
|
"txPower": -77,
|
|
45
|
-
"macAddress": "01:17:c5:31:84:19"
|
|
46
|
+
"macAddress": "01:17:c5:31:84:19",
|
|
47
|
+
"accountId": "90a2ed18-86be-48e7-948b-393b8b679ef6"
|
|
46
48
|
},{
|
|
47
49
|
"type": "circle",
|
|
48
50
|
"name": "Test Circle",
|
package/models/Beacon.js
CHANGED
|
@@ -34,19 +34,21 @@ let schema = {
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
location: {type: Point},
|
|
37
|
-
proximity: {type: String, default: 'Far'}
|
|
37
|
+
proximity: {type: String, default: 'Far'},
|
|
38
|
+
accountId: {
|
|
39
|
+
type: String, required: true
|
|
40
|
+
}
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
let BeaconSchema = new mongoose.Schema(schema)
|
|
41
44
|
|
|
42
45
|
BeaconSchema.add({
|
|
43
|
-
type:
|
|
44
|
-
{type: String, required: true}
|
|
46
|
+
type: {type: String, required: true}
|
|
45
47
|
})
|
|
46
48
|
|
|
47
49
|
// mongoose validator helper plugin
|
|
48
50
|
BeaconSchema.post('validate', function (doc) {
|
|
49
|
-
|
|
51
|
+
// Beacon Schema post validate hook
|
|
50
52
|
this.lastUpdateTime = Date.now()
|
|
51
53
|
Object.assign(this.errors || {}, this.errors || {}, this.customErrors)
|
|
52
54
|
})
|
package/models/Zone.js
CHANGED
|
@@ -58,6 +58,10 @@ let ZoneSchema = new Schema({
|
|
|
58
58
|
type: [geofeatureSchema],
|
|
59
59
|
required: true
|
|
60
60
|
},
|
|
61
|
+
beacons: {
|
|
62
|
+
type: [beaconSchema],
|
|
63
|
+
default: []
|
|
64
|
+
},
|
|
61
65
|
customData: [{type: Schema.Types.Mixed}],
|
|
62
66
|
description: {type: String, default: ''},
|
|
63
67
|
creationTime: {type: Date, required: [true, 'creationTime is required'], select: false},
|
package/package.json
CHANGED
|
File without changes
|