@bluedot-innovation/models 2.0.18-alpha.1 → 2.0.19-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 CHANGED
@@ -1,3 +1,6 @@
1
+ ## 2.0.19
2
+ - Mask `State`, `creationTime`, `lastUpdateTime`, `geofeatures.geometry`, `secret` from API responses
3
+
1
4
  ## 2.0.18
2
5
  - `password` on `user` model no longer required. We will rely on cognito to throw an error
3
6
 
@@ -1,5 +1,5 @@
1
1
  module.exports = {
2
- requiredFields: ['username', 'password', 'firstName', 'lastName', 'isAdmin', 'accountId'],
2
+ requiredFields: ['username', 'firstName', 'lastName', 'isAdmin', 'accountId'],
3
3
  customValidators: [
4
4
  {name: 'phoneNumber', invalidInputs: ['409203492039284232034398']},
5
5
  {name: 'creationTime', invalidInputs: ['21/07/2017', 'thursday']},
package/models/Zone.js CHANGED
@@ -23,6 +23,14 @@ let uuidv4 = require('uuid/v4')
23
23
  let patcher = require('mongoose-json-patch')
24
24
  let helpers = require('../helpers')
25
25
 
26
+ const mongooseHidden = require('mongoose-hidden')({hidden: {
27
+ _id: false,
28
+ state: true,
29
+ creationTime: true,
30
+ lastUpdateTime: true,
31
+ __v: true
32
+ }})
33
+
26
34
  // ////// //
27
35
  // Schema //
28
36
  // ////// //
@@ -71,6 +79,7 @@ let zoneSchema = new Schema({
71
79
 
72
80
  // TODO: Test patcher and include for other schemas if required
73
81
  zoneSchema.plugin(patcher)
82
+ zoneSchema.plugin(mongooseHidden)
74
83
 
75
84
  zoneSchema.path('actions').discriminator('url', new Schema(urlActionSchema))
76
85
  zoneSchema.path('actions').discriminator('message', new Schema(messageActionSchema))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "2.0.18-alpha.1",
3
+ "version": "2.0.19-alpha.1",
4
4
  "description": "",
5
5
  "main": "Models.js",
6
6
  "scripts": {
@@ -34,6 +34,7 @@
34
34
  "lodash.clonedeep": "4.5.0",
35
35
  "mongoose": "^4.13.9",
36
36
  "mongoose-error-helper": "0.0.2",
37
+ "mongoose-hidden": "^1.5.3",
37
38
  "mongoose-json-patch": "^1.1.1",
38
39
  "uuid": "^3.1.0"
39
40
  }