@bluedot-innovation/models 2.0.0-beta.9 → 2.0.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/.gitlab-ci.yml CHANGED
@@ -40,4 +40,4 @@ publish:
40
40
  - /^(?!.*(master)$).*$/
41
41
  script:
42
42
  - echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}'>.npmrc
43
- - npm publish
43
+ - npm publish
package/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ ## 2.0.1
2
+ - Beacon model: guid -> id
3
+
4
+ ## 2.0.0-beta.14
5
+ - Beacon model: Removed console.debug breaking lambda execution
6
+
7
+ ## 2.0.0-beta.13
8
+ - Beacon model: Added accountId
9
+ - Zone model: Added beacons
10
+
11
+ ## 2.0.0-beta.12
12
+ - User model: `emailAddress` changed to `email`
@@ -8,5 +8,6 @@
8
8
  "major": 10000,
9
9
  "minor": 56466,
10
10
  "txPower": -77,
11
- "macAddress": "01:17:c5:31:84:19"
12
- }
11
+ "macAddress": "01:17:c5:31:84:19",
12
+ "accountId": "90a2ed18-86be-48e7-948b-393b8b679ef6"
13
+ }
@@ -2,7 +2,7 @@ let mongoose = require('mongoose')
2
2
 
3
3
  mongoose.Promise = global.Promise
4
4
 
5
- let BeaconModel = require('../../../Models').Beacon(mongoose)
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')
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "_id" : "bf93ddd2-e7e9-4a89-9bcb-0b2164c17e45",
3
- "appplicationId" : "fd150b63-08dc-4114-aaf9-359cef30def6",
3
+ "applicationId" : "fd150b63-08dc-4114-aaf9-359cef30def6",
4
4
  "customerId" : "f944c7e9-63cc-4c0a-8ad3-acf3c30415fc",
5
5
  "iosCount" : 9,
6
6
  "androidCount" : 0,
@@ -36,11 +36,11 @@ testCase('RuleRequestAggregation', () => {
36
36
  done()
37
37
  })
38
38
  })
39
- assertions('should not accept a invalid appplicationId', (done) => {
40
- ruleRequestAggregation.appplicationId = 'invalid-applicationId'
39
+ assertions('should not accept a invalid applicationId', (done) => {
40
+ ruleRequestAggregation.applicationId = 'invalid-applicationId'
41
41
  let RuleRequestAggregation = new RuleRequestAggregationModel(ruleRequestAggregation)
42
42
  RuleRequestAggregation.validate((err, res) => {
43
- assert.exists(err, 'invalid aplicationId')
43
+ assert.exists(err, 'invalid applicationId')
44
44
  assert.isObject(err)
45
45
  done()
46
46
  })
@@ -1,6 +1,6 @@
1
1
  module.exports = {
2
2
  username: 'test@bluedot.io',
3
- emailAddress: 'test@bluedot.io',
3
+ email: 'test@bluedot.io',
4
4
  password: 'jfmamjasond',
5
5
  firstName: 'John',
6
6
  lastName: 'Citizen',
@@ -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
@@ -4,7 +4,7 @@ let Point = require('../schemas/Point')
4
4
  let uuidv4 = require('uuid/v4')
5
5
 
6
6
  let schema = {
7
- guid: {type: String, default: uuidv4},
7
+ _id: {type: String, default: uuidv4},
8
8
  name: {type: String, required: [true, 'name is required. ']},
9
9
  longitude: {
10
10
  type: Number,
@@ -34,19 +34,17 @@ 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
- let BeaconSchema = new mongoose.Schema(schema)
41
-
42
- BeaconSchema.add({
43
- type:
44
- {type: String, required: true}
45
- })
43
+ let BeaconSchema = new mongoose.Schema(schema, {collection: 'beacon'})
46
44
 
47
45
  // mongoose validator helper plugin
48
46
  BeaconSchema.post('validate', function (doc) {
49
- console.debug('Beacon Schema post validate hook')
47
+ // Beacon Schema post validate hook
50
48
  this.lastUpdateTime = Date.now()
51
49
  Object.assign(this.errors || {}, this.errors || {}, this.customErrors)
52
50
  })
@@ -9,7 +9,7 @@ const helpers = require('../helpers')
9
9
 
10
10
  const schema = {
11
11
  _id: { type: String, default: uuidv4 },
12
- appplicationId: {type: String, required: [true, 'applicationId is required'], validate: {isAsync: false, validator: helpers.validateUUIDv4, msg: 'invalid applicationId'}},
12
+ applicationId: {type: String, required: [true, 'applicationId is required'], validate: {isAsync: false, validator: helpers.validateUUIDv4, msg: 'invalid applicationId'}},
13
13
  customerId: {type: String, required: [true, 'customerId is required'], validate: {isAsync: false, validator: helpers.validateUUIDv4, msg: 'invalid customerId'}},
14
14
  iosCount: {type: Number, required: [true, 'iosCount is required'], min: 0},
15
15
  androidCount: {type: Number, required: [true, 'androidCount is required'], min: 0},
package/models/User.js CHANGED
@@ -12,9 +12,10 @@ let UserSchema = new mongoose.Schema({
12
12
  username: {
13
13
  type: String,
14
14
  required: true,
15
- maxlength: 100
15
+ maxlength: 100,
16
+ unique: true
16
17
  },
17
- emailAddress: {
18
+ email: {
18
19
  type: String,
19
20
  required: true,
20
21
  validate: {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "2.0.0-beta.9",
3
+ "version": "2.0.1",
4
4
  "description": "",
5
5
  "main": "Models.js",
6
6
  "scripts": {