@bluedot-innovation/models 2.0.19-alpha.10 → 2.0.19-alpha.11

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/models/Zone.js CHANGED
@@ -22,14 +22,7 @@ let percentageCrossedFilterSchema = require('./PercentageCrossedFilter').percent
22
22
  let uuidv4 = require('uuid/v4')
23
23
  let patcher = require('mongoose-json-patch')
24
24
  let helpers = require('../helpers')
25
-
26
- const mongooseHidden = require('mongoose-hidden')({defaultHidden: {
27
- state: true,
28
- creationTime: true,
29
- lastUpdateTime: true,
30
- __v: true,
31
- secret: true
32
- }})
25
+ const mongooseHidden = require('../utils/mongooseHidden')
33
26
 
34
27
  // ////// //
35
28
  // Schema //
@@ -77,6 +70,10 @@ let zoneSchema = new Schema({
77
70
  accountId: {type: String, required: true, validate: {isAsync: false, validator: helpers.validateUUIDv4, msg: 'default error message'}}
78
71
  }, {collection: 'zone'})
79
72
 
73
+ // TODO: Test patcher and include for other schemas if required
74
+ zoneSchema.plugin(patcher)
75
+ zoneSchema.plugin(mongooseHidden)
76
+
80
77
  zoneSchema.path('actions').discriminator('url', new Schema(urlActionSchema))
81
78
  zoneSchema.path('actions').discriminator('message', new Schema(messageActionSchema))
82
79
 
@@ -86,18 +83,12 @@ zoneSchema.path('filters').discriminator('percentageCrossed', new Schema(percent
86
83
  zoneSchema.path('filters').discriminator('speed', new Schema(speedFilterSchema))
87
84
  zoneSchema.path('filters').discriminator('timeOfDayRange', new Schema(timeOfDayRangeFilterSchema))
88
85
 
89
-
86
+ zoneSchema.path('geofeatures').discriminator('beacon', new Schema(beaconSchema))
90
87
  zoneSchema.path('geofeatures').discriminator('circle', new Schema(circleSchema).plugin(mongooseHidden))
91
88
  zoneSchema.path('geofeatures').discriminator('polygon', new Schema(polygonSchema))
92
89
  zoneSchema.path('geofeatures').discriminator('polyline', new Schema(polylineSchema))
93
90
  zoneSchema.path('geofeatures').discriminator('boundingBox', new Schema(boundingBoxSchema))
94
91
 
95
- // TODO: Test patcher and include for other schemas if required
96
- zoneSchema.plugin(patcher)
97
- zoneSchema.plugin(mongooseHidden)
98
- // console.log("zoneSchema.path('geofeatures')", zoneSchema.path('geofeatures'))
99
- console.log("zoneSchema.path('geofeatures')", zoneSchema.path('geofeatures'))
100
-
101
92
  // optional mongoose
102
93
  const model = (mongooseInstance) => {
103
94
  let Zone
@@ -6,11 +6,10 @@ const MultiLineStringGeometry = require('../../schemas/MultiLineStringGeometry')
6
6
  const mongooseHidden = require('../../utils/mongooseHidden')
7
7
 
8
8
  const schema = {
9
- type: {type: String, required: true},
10
9
  _id: {type: String, default: uuidv4},
11
10
  geometry: {type: MultiLineStringGeometry},
12
- name: {type: String, required: [true, 'name is required.']},
13
- vertices: {type: [Point], required: [true, 'vertices is required.']},
11
+ name: {type: String, required: [true, 'name is required. ']},
12
+ vertices: {type: [Point], required: [true, 'vertices is required. ']},
14
13
  creationTime: {type: Date, default: Date.now},
15
14
  lastUpdateTime: {type: Date, default: Date.now},
16
15
  state: {type: String, default: StateEnum.active, select: false}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "2.0.19-alpha.10",
3
+ "version": "2.0.19-alpha.11",
4
4
  "description": "",
5
5
  "main": "Models.js",
6
6
  "scripts": {