@bluedot-innovation/models 2.0.7-alpha.5 → 2.0.7-alpha.6

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/Beacon.js CHANGED
@@ -49,9 +49,8 @@ function validateMajorMinor (v) {
49
49
  return v >= 1 && v <= 65535
50
50
  }
51
51
 
52
- function validateBeaconType (v, cb) {
52
+ function validateBeaconType (v, magicCallback) {
53
53
  'use strict'
54
- let magicCallback = cb
55
54
  const beaconType = v
56
55
  const minor = this.minor
57
56
  const major = this.major
@@ -18,8 +18,7 @@ BearingFilterSchema.add({
18
18
  {type: String, required: true}
19
19
  })
20
20
 
21
- function validateAngles (toAngle, cb) {
22
- let magicCallback = cb
21
+ function validateAngles (toAngle, magicCallback) {
23
22
  let fromAngle = this.fromAngle
24
23
 
25
24
  if (!toAngle && toAngle !== 0) {
@@ -4,7 +4,7 @@ let uuidv4 = require('uuid/v4')
4
4
  let schema = {
5
5
  _id: {type: String, default: uuidv4},
6
6
  startDate: {type: Date},
7
- endDate: {type: Date, validate: validateDateRange}
7
+ endDate: {type: Date, validate: {isAsync: true, validator: validateDateRange}}
8
8
  }
9
9
  let CalendarDateRangeFilterSchema = new mongoose.Schema(
10
10
  schema,
@@ -16,8 +16,7 @@ SpeedFilterSchema.add({
16
16
  type: {type: String, required: true}
17
17
  })
18
18
 
19
- function validateMaxSpeed (v, cb) {
20
- let magicCallback = cb
19
+ function validateMaxSpeed (v, magicCallback) {
21
20
  let minSpeed = this.minimumSpeed
22
21
  let maxSpeed = v
23
22
  let speedDifference = maxSpeed - minSpeed
@@ -13,8 +13,7 @@ TimeOfDayRangeFilterSchema.add({
13
13
  {type: String, required: true}
14
14
  })
15
15
 
16
- function validateTime (toTime, cb) {
17
- let magicCallback = cb
16
+ function validateTime (toTime, magicCallback) {
18
17
  let fromTime = this.fromTime
19
18
 
20
19
  if (fromTime === toTime) {
@@ -29,8 +29,7 @@ URLActionSchema.add({
29
29
  {type: String, required: true}
30
30
  })
31
31
 
32
- function validateURL (url, cb) {
33
- let magicCallback = cb
32
+ function validateURL (url, magicCallback) {
34
33
  let urlRegex = new RegExp('^(http[s]?:\\/\\/(www\\.)?|ftp:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\.@:%_+~#=]+)+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?')
35
34
  if (!urlRegex.test(url)) {
36
35
  return magicCallback(false, `${url} is not a valid URL`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "2.0.7-alpha.5",
3
+ "version": "2.0.7-alpha.6",
4
4
  "description": "",
5
5
  "main": "Models.js",
6
6
  "scripts": {