@bluedot-innovation/models 1.0.26-alpha → 2.0.0-alpha.10

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.
Files changed (120) hide show
  1. package/.eslintrc.js +6 -0
  2. package/.gitlab-ci.yml +43 -0
  3. package/.nyc_output/.gitkeep +0 -0
  4. package/Models.js +8 -8
  5. package/README.MD +36 -0
  6. package/__tests__/action/message/messageAction.data.json +5 -0
  7. package/__tests__/action/message/messageAction.rules.json +3 -0
  8. package/__tests__/action/message/messageAction.spec.js +61 -0
  9. package/__tests__/action/url/urlAction.data.json +4 -0
  10. package/__tests__/action/url/urlAction.rules.json +3 -0
  11. package/__tests__/action/url/urlAction.spec.js +62 -0
  12. package/__tests__/dailyStats/checkDailyStats.js +30 -0
  13. package/__tests__/filter/beacon/beaconFilter.data.json +1 -0
  14. package/__tests__/filter/beacon/beaconFilter.rules.json +3 -0
  15. package/__tests__/filter/beacon/beaconFilter.spec.js +1 -0
  16. package/__tests__/filter/bearing/bearingFilter.data.json +5 -0
  17. package/__tests__/filter/bearing/bearingFilter.rules.json +3 -0
  18. package/__tests__/filter/bearing/bearingFilter.spec.js +95 -0
  19. package/__tests__/filter/calendarDateRange/calendarDateRangeFilter.data.json +5 -0
  20. package/__tests__/filter/calendarDateRange/calendarDateRangeFilter.rules.json +3 -0
  21. package/__tests__/filter/calendarDateRange/calendarDateRangeFilter.spec.js +62 -0
  22. package/__tests__/filter/percentageCrossed/percentageCrossedFilter.data.json +5 -0
  23. package/__tests__/filter/percentageCrossed/percentageCrossedFilter.rules.json +3 -0
  24. package/__tests__/filter/percentageCrossed/percentageCrossedFilter.spec.js +62 -0
  25. package/__tests__/filter/speed/speedFilter.data.json +5 -0
  26. package/__tests__/filter/speed/speedFilter.rules.json +3 -0
  27. package/__tests__/filter/speed/speedFilter.spec.js +73 -0
  28. package/__tests__/filter/timeOfDayRange/timeOfDayRange.data.json +5 -0
  29. package/__tests__/filter/timeOfDayRange/timeOfDayRange.rules.json +3 -0
  30. package/__tests__/filter/timeOfDayRange/timeOfDayRange.spec.js +73 -0
  31. package/__tests__/geofeature/beacon/beacon.data.json +12 -0
  32. package/__tests__/geofeature/beacon/beacon.rules.json +13 -0
  33. package/__tests__/geofeature/beacon/beacon.spec.js +95 -0
  34. package/__tests__/geofeature/boundingBox/boundingBox.data.json +12 -0
  35. package/__tests__/geofeature/boundingBox/boundingBox.rules.json +3 -0
  36. package/__tests__/geofeature/boundingBox/boundingBox.spec.js +61 -0
  37. package/__tests__/geofeature/circle/circle.data.json +9 -0
  38. package/__tests__/geofeature/circle/circle.rules.json +3 -0
  39. package/__tests__/geofeature/circle/circle.spec.js +62 -0
  40. package/__tests__/geofeature/polygon/polygon.data.json +46 -0
  41. package/__tests__/geofeature/polygon/polygon.rules.json +3 -0
  42. package/__tests__/geofeature/polygon/polygon.spec.js +61 -0
  43. package/__tests__/geofeature/polyline/polyline.data.json +46 -0
  44. package/__tests__/geofeature/polyline/polyline.rules.json +3 -0
  45. package/__tests__/geofeature/polyline/polyline.spec.js +61 -0
  46. package/__tests__/zone/zone.action.spec.js +50 -0
  47. package/__tests__/zone/zone.data.json +154 -0
  48. package/__tests__/zone/zone.filter.spec.js +50 -0
  49. package/__tests__/zone/zone.geofeatures.spec.js +64 -0
  50. package/__tests__/zone/zone.spec.js +98 -0
  51. package/models/AdminPortalUser.js +10 -11
  52. package/models/AdminUser.js +6 -5
  53. package/models/Application.js +31 -30
  54. package/models/Beacon.js +102 -32
  55. package/models/BeaconFilter.js +30 -12
  56. package/models/BearingFilter.js +56 -17
  57. package/models/BoundingBox.js +36 -14
  58. package/models/CalendarDateRangeFilter.js +41 -0
  59. package/models/Circle.js +37 -19
  60. package/models/Contract.js +37 -38
  61. package/models/Customer.js +31 -31
  62. package/models/CustomerLogin.js +9 -10
  63. package/models/DBEvent.js +13 -14
  64. package/models/DailyStats.js +7 -7
  65. package/models/DeviceRulesRequest.js +27 -28
  66. package/models/Fence.js +12 -13
  67. package/models/GeoFence.js +12 -14
  68. package/models/Geofeature.js +16 -18
  69. package/models/MessageAction.js +32 -25
  70. package/models/NotificationLogEntry.js +7 -8
  71. package/models/POILocation.js +6 -7
  72. package/models/POILookup.js +8 -9
  73. package/models/POIResult.js +7 -8
  74. package/models/PartnerCustomer.js +12 -13
  75. package/models/PartnerPasswordReset.js +8 -9
  76. package/models/PartnerUser.js +10 -11
  77. package/models/Partners.js +11 -12
  78. package/models/PercentageCrossedFilter.js +30 -16
  79. package/models/Polygon.js +34 -15
  80. package/models/Polyline.js +35 -15
  81. package/models/RuleRequestAggregation.js +14 -17
  82. package/models/SimpleCheckInZone.js +21 -21
  83. package/models/SingleUseToken.js +7 -8
  84. package/models/SpeedFilter.js +43 -16
  85. package/models/TestDevice.js +11 -12
  86. package/models/TestDeviceCluster.js +9 -10
  87. package/models/TestInstance.js +9 -10
  88. package/models/TestScenario.js +9 -10
  89. package/models/TimeOfDayRange.js +16 -16
  90. package/models/TimeOfDayRangeFilter.js +39 -16
  91. package/models/UrlAction.js +51 -0
  92. package/models/Zone.js +97 -0
  93. package/models/ZoneUIState.js +18 -18
  94. package/package.json +25 -4
  95. package/schemas/Point.js +13 -0
  96. package/NodeModels.iml +0 -9
  97. package/models/ApplicationNotificationAction.js +0 -30
  98. package/models/ApplicationUsage.js +0 -11
  99. package/models/ConfigurationParameters.js +0 -20
  100. package/models/DateRangeFilter.js +0 -20
  101. package/models/FormattedBeacon.js +0 -16
  102. package/models/FormattedCircle.js +0 -12
  103. package/models/FormattedConditions.js +0 -11
  104. package/models/FormattedDateRange.js +0 -11
  105. package/models/FormattedPercentageCrossed.js +0 -12
  106. package/models/FormattedPoint.js +0 -10
  107. package/models/FormattedPolygon.js +0 -11
  108. package/models/FormattedPolyline.js +0 -11
  109. package/models/FormattedRectangle.js +0 -12
  110. package/models/FormattedTimeActive.js +0 -17
  111. package/models/FormattedZone.js +0 -28
  112. package/models/MonthlyStats.js +0 -28
  113. package/models/Point.js +0 -20
  114. package/models/PropertyMapping.js +0 -17
  115. package/models/Reference.js +0 -19
  116. package/models/SequenceFilter.js +0 -18
  117. package/models/SoundAction.js +0 -28
  118. package/models/URLAction.js +0 -31
  119. package/models/VibrationAction.js +0 -28
  120. package/models/property.js +0 -25
@@ -1,19 +1,58 @@
1
- /**
2
- * Created by Andrew on 30/01/2017.
3
- * Copyright : Bluedot Innovations.
4
- */
5
-
6
- var mongoose = require('mongoose');
7
-
8
- var BearingFilter = mongoose.model('BearingFilter', mongoose.Schema({
9
- guid: {type: String},
10
- _class : {type: String, default:"au.com.bluedot.application.spring.filter.action.BearingFilter"},
11
- fromAngle : Number,
12
- toAngle : Number,
13
- type : {type: String, default:"bearingFilter"}
14
- },
1
+ let mongoose = require('mongoose')
2
+ let uuidv4 = require('uuid/v4')
3
+
4
+ const schema = {
5
+ guid: {type: String, default: uuidv4},
6
+ fromAngle: {type: Number, required: [true, 'fromAngle is required. '], min: 0, max: 359},
7
+ toAngle: {type: Number, required: true, min: 0, max: 359, validate: {validator: validateAngles, msg: 'default error message'}}
8
+ }
9
+
10
+ const BearingFilterSchema = new mongoose.Schema(
11
+ schema,
15
12
  {
16
- _id: false
13
+ _id: false,
14
+ versionKey: false
15
+ })
16
+
17
+ BearingFilterSchema.add({
18
+ type:
19
+ {type: String, required: true}
20
+ })
21
+
22
+ function validateAngles (toAngle, cb) {
23
+ let magicCallback = cb
24
+ let fromAngle = this.fromAngle
25
+
26
+ if (!toAngle && toAngle !== 0) {
27
+ return magicCallback(false, 'toAngle is required')
28
+ }
29
+
30
+ if (toAngle === fromAngle) {
31
+ return magicCallback(false, 'fromAngle and toAngle cannot be the same')
17
32
  }
18
- ));
19
- module.exports = BearingFilter;
33
+
34
+ if (fromAngle > toAngle) {
35
+ if ((fromAngle - toAngle) <= 270) {
36
+ return magicCallback(false, 'From Angle and To Angle must best separated by at least 90 degrees in both directions')
37
+ }
38
+ }
39
+ if (toAngle > fromAngle) {
40
+ if (((toAngle - fromAngle) < 90) || (((toAngle - fromAngle) > 270))) {
41
+ return magicCallback(false, 'From Angle and To Angle must best separated by at least 90 degrees in both directions')
42
+ }
43
+ }
44
+ magicCallback(true)
45
+ }
46
+
47
+ // optional mongoose
48
+ module.exports = (mongooseInstance) => {
49
+ let BearingFilter
50
+ if (mongooseInstance) {
51
+ BearingFilter = mongooseInstance.model('BearingFilter', BearingFilterSchema)
52
+ } else {
53
+ BearingFilter = mongoose.model('BearingFilter', BearingFilterSchema)
54
+ }
55
+
56
+ return BearingFilter
57
+ }
58
+ module.exports.bearingFilterSchema = schema
@@ -1,17 +1,39 @@
1
- /**
2
- * Created by Bluedot01 on 30/09/2014.
3
- * Copyright : Bluedot Innovations.
4
- * Owner :
5
- */
6
- var mongoose = require('mongoose');
7
- Schema = mongoose.Schema;
1
+ let mongoose = require('mongoose')
2
+ let StateEnum = require('@bluedot-innovation/enums').StateEnum
3
+ let uuidv4 = require('uuid/v4')
4
+ let Point = require('../schemas/Point')
8
5
 
9
- var BoundingBox = mongoose.model('BoundingBox', mongoose.Schema({
10
- type: {type: String, default: "MultiLineString"},
11
- "coordinates" : []
12
- },
6
+ const schema = {
7
+ guid: {type: String, default: uuidv4},
8
+ name: {type: String, required: [true, 'name is required. ']},
9
+ northEast: {type: Point, required: [true, 'northEast is required. ']},
10
+ southWest: {type: Point, required: [true, 'southWest is required. ']},
11
+ creationTime: {type: Date, default: Date.now},
12
+ lastUpdateTime: {type: Date, default: Date.now},
13
+ state: {type: String, default: StateEnum.active, select: false}
14
+ }
15
+
16
+ const BoundingBoxSchema = new mongoose.Schema(
17
+ schema,
13
18
  {
14
- _id: false
19
+ _id: false,
20
+ versionKey: false
21
+ })
22
+
23
+ BoundingBoxSchema.add({
24
+ type:
25
+ {type: String, required: true}
26
+ })
27
+
28
+ // optional mongoose
29
+ module.exports = (mongooseInstance) => {
30
+ let BoundingBox
31
+ if (mongooseInstance) {
32
+ BoundingBox = mongooseInstance.model('BoundingBox', BoundingBoxSchema)
33
+ } else {
34
+ BoundingBox = mongoose.model('BoundingBox', BoundingBox)
15
35
  }
16
- ));
17
- module.exports = BoundingBox;
36
+
37
+ return BoundingBox
38
+ }
39
+ module.exports.boundingBoxSchema = schema
@@ -0,0 +1,41 @@
1
+ let mongoose = require('mongoose')
2
+ let uuidv4 = require('uuid/v4')
3
+
4
+ let schema = {
5
+ guid: {type: String, default: uuidv4},
6
+ startDate: {type: Date, required: [true, 'startDate is required. ']},
7
+ endDate: {type: Date, required: [true, 'endDate is required. '], validate: validateDateRange}
8
+ }
9
+ let CalendarDateRangeSchema = new mongoose.Schema(
10
+ schema,
11
+ {
12
+ _id: false,
13
+ versionKey: false
14
+ })
15
+
16
+ CalendarDateRangeSchema.add({
17
+ type:
18
+ {type: String, required: true}
19
+ })
20
+
21
+ function validateDateRange (endDate) {
22
+ let startDate = new Date(this.startDate)
23
+ endDate = new Date(endDate)
24
+
25
+ if (endDate < startDate) {
26
+ throw new Error('startDate has to be less than endDate. ')
27
+ }
28
+ }
29
+
30
+ // optional mongoose
31
+ module.exports = (mongooseInstance) => {
32
+ let CalendarDateRange
33
+ if (mongooseInstance) {
34
+ CalendarDateRange = mongooseInstance.model('CalendarDateRange', CalendarDateRangeSchema)
35
+ } else {
36
+ CalendarDateRange = mongoose.model('CalendarDateRange', CalendarDateRangeSchema)
37
+ }
38
+
39
+ return CalendarDateRange
40
+ }
41
+ module.exports.calendarDateRangeSchema = schema
package/models/Circle.js CHANGED
@@ -1,21 +1,39 @@
1
- /**
2
- * Created by Bluedot01 on 30/09/2014.
3
- * Copyright : Bluedot Innovations.
4
- * Owner :
5
- */
6
- /*
7
- Right now mongoose does not support 1-1 relationships.
8
- https://github.com/LearnBoost/mongoose/pull/585.
9
- it can be wrapped around array like polygon.
10
- */
11
- var mongoose = require('mongoose');
12
- Schema = mongoose.Schema;
13
- var Circle = mongoose.model('Circle', mongoose.Schema({
14
- "type": {type: String, default: "MultiLineString"},
15
- "coordinates" : Array
16
- },
1
+ let mongoose = require('mongoose')
2
+ let StateEnum = require('@bluedot-innovation/enums').StateEnum
3
+ let Point = require('../schemas/Point')
4
+ let uuidv4 = require('uuid/v4')
5
+
6
+ let schema = {
7
+ guid: {type: String, default: uuidv4},
8
+ name: {type: String, required: [true, 'name is required. ']},
9
+ radius: {type: Number, required: [true, 'radius is required. '], min: 5},
10
+ center: {type: Point, required: [true, 'center is required. ']},
11
+ creationTime: {type: Date, default: Date.now},
12
+ lastUpdateTime: {type: Date, default: Date.now},
13
+ state: {type: String, default: StateEnum.active, select: false}
14
+ }
15
+
16
+ let CircleSchema = new mongoose.Schema(
17
+ schema,
17
18
  {
18
- _id: false
19
+ _id: false,
20
+ __v: false
21
+ })
22
+
23
+ CircleSchema.add({
24
+ type:
25
+ {type: String, required: true}
26
+ })
27
+
28
+ // optional mongoose
29
+ module.exports = (mongooseInstance) => {
30
+ let Circle
31
+ if (mongooseInstance) {
32
+ Circle = mongooseInstance.model('Circle', CircleSchema)
33
+ } else {
34
+ Circle = mongoose.model('Circle', CircleSchema)
19
35
  }
20
- ));
21
- module.exports = Circle;
36
+
37
+ return Circle
38
+ }
39
+ module.exports.circleSchema = schema
@@ -3,43 +3,42 @@
3
3
  * Copyright : Bluedot Innovations.
4
4
  * Owner :
5
5
  */
6
- var mongoose = require('mongoose');
6
+ let mongoose = require('mongoose')
7
7
 
8
- var Contract = mongoose.model('Contract', new mongoose.Schema(
9
- {
10
- customerId: String,
11
- organisationName: String,
12
- addressLine1: String,
13
- addressLine2: String,
14
- addressCity: String,
15
- addressRegion: String,
16
- addressPostcode: String,
17
- addressCountry: String,
18
- billingFirstName: String,
19
- billingLastName: String,
20
- billingTaxNumber: String,
21
- billingEmail: String,
22
- tradingName: String,
23
- salesforceUrl: String,
24
- startDate : {type: Date, default: Date.now},
25
- endDate : {type: Date, default: Date.now},
26
- frequency : mongoose.Schema.Types.Number,
27
- monthEntries: [],
28
- currency: {type: String, default: "USD"},
29
- currencyRate: Number,
30
- template: String,
31
- addedBy: String,
32
- lastEditedBy: String,
33
- xeroContactId: String,
34
- state: String,
35
- creationTime : {type: Date, default: Date.now},
36
- lastUpdateTime : {type: Date, default: Date.now},
37
- dataSource : {type:String, select: false, default : 'adminPortal'}
38
- },
39
- {
40
- collection : 'contract'
41
- }
42
- )
43
- );
8
+ let Contract = mongoose.model('Contract', new mongoose.Schema(
9
+ {
10
+ customerId: String,
11
+ organisationName: String,
12
+ addressLine1: String,
13
+ addressLine2: String,
14
+ addressCity: String,
15
+ addressRegion: String,
16
+ addressPostcode: String,
17
+ addressCountry: String,
18
+ billingFirstName: String,
19
+ billingLastName: String,
20
+ billingTaxNumber: String,
21
+ billingEmail: String,
22
+ tradingName: String,
23
+ salesforceUrl: String,
24
+ startDate: {type: Date, default: Date.now},
25
+ endDate: {type: Date, default: Date.now},
26
+ frequency: mongoose.Schema.Types.Number,
27
+ monthEntries: [],
28
+ currency: {type: String, default: 'USD'},
29
+ currencyRate: Number,
30
+ template: String,
31
+ addedBy: String,
32
+ lastEditedBy: String,
33
+ xeroContactId: String,
34
+ state: String,
35
+ creationTime: {type: Date, default: Date.now},
36
+ lastUpdateTime: {type: Date, default: Date.now},
37
+ dataSource: {type: String, select: false, default: 'adminPortal'}
38
+ },
39
+ {
40
+ collection: 'contract'
41
+ })
42
+ )
44
43
 
45
- module.exports = Contract;
44
+ module.exports = Contract
@@ -3,36 +3,36 @@
3
3
  * Copyright : Bluedot Innovations.
4
4
  * Owner :
5
5
  */
6
- var mongoose = require('mongoose');
7
- var StateEnum = require('@bluedot-innovation/enums').StateEnum;
6
+ let mongoose = require('mongoose')
7
+ let StateEnum = require('@bluedot-innovation/enums').StateEnum
8
+ let Schema = mongoose.Schema
8
9
 
9
- var Customer = mongoose.model('Customer', new mongoose.Schema(
10
- {
11
- _id: String,
12
- customerApiKey: String,
13
- email: String,
14
- password: String,
15
- name: String,
16
- userName: String,
17
- state: {type:String, default: StateEnum.active},
18
- "creationTime" : {type: Date, default: Date.now},
19
- "lastUpdateTime" : {type: Date, default: Date.now},
20
- "dataSource" : {type:String, select: false, default : 'openApi'},
21
- integrations: Schema.Types.Mixed,
22
- firstName: String,
23
- lastName: String,
24
- oldPassword: String,
25
- organisationWebsite: String,
26
- organisationName: String,
27
- phoneNumber: String,
28
- createdBy: String,
29
- poiCredits: {type: Number, default: 0},
30
- address: []
31
- },
32
- {
33
- collection : 'customer'
34
- }
35
- )
36
- );
10
+ let Customer = mongoose.model('Customer', new mongoose.Schema(
11
+ {
12
+ _id: String,
13
+ customerApiKey: String,
14
+ email: String,
15
+ password: String,
16
+ name: String,
17
+ userName: String,
18
+ state: {type: String, default: StateEnum.active},
19
+ 'creationTime': {type: Date, default: Date.now},
20
+ 'lastUpdateTime': {type: Date, default: Date.now},
21
+ 'dataSource': {type: String, select: false, default: 'openApi'},
22
+ integrations: Schema.Types.Mixed,
23
+ firstName: String,
24
+ lastName: String,
25
+ oldPassword: String,
26
+ organisationWebsite: String,
27
+ organisationName: String,
28
+ phoneNumber: String,
29
+ createdBy: String,
30
+ poiCredits: {type: Number, default: 0},
31
+ address: []
32
+ },
33
+ {
34
+ collection: 'customer'
35
+ })
36
+ )
37
37
 
38
- module.exports = Customer;
38
+ module.exports = Customer
@@ -2,8 +2,8 @@
2
2
  * Created by andrewstirling on 20/6/17.
3
3
  */
4
4
 
5
- var mongoose = require('mongoose');
6
- var StateEnum = require('@bluedot-innovation/enums').StateEnum;
5
+ var mongoose = require('mongoose')
6
+ var StateEnum = require('@bluedot-innovation/enums').StateEnum
7
7
 
8
8
  var CustomerLogin = mongoose.model('CustomerLogin', new mongoose.Schema(
9
9
  {
@@ -19,16 +19,15 @@ var CustomerLogin = mongoose.model('CustomerLogin', new mongoose.Schema(
19
19
  integrations: {},
20
20
  resetToken: String,
21
21
  lastLoginTime: Date,
22
- state: {type:String, default: StateEnum.active},
23
- creationTime : {type: Date, default: Date.now},
24
- lastUpdateTime : {type: Date, default: Date.now},
22
+ state: {type: String, default: StateEnum.active},
23
+ creationTime: {type: Date, default: Date.now},
24
+ lastUpdateTime: {type: Date, default: Date.now},
25
25
  createdBy: String,
26
26
  lastUpdatedBy: String
27
27
  },
28
28
  {
29
- collection : 'customerLogin'
30
- }
31
- )
32
- );
29
+ collection: 'customerLogin'
30
+ })
31
+ )
33
32
 
34
- module.exports = CustomerLogin;
33
+ module.exports = CustomerLogin
package/models/DBEvent.js CHANGED
@@ -3,19 +3,18 @@
3
3
  * Copyright : Bluedot Innovations.
4
4
  * Owner :
5
5
  */
6
- var mongoose = require('mongoose');
7
- Schema = mongoose.Schema;
6
+ let mongoose = require('mongoose')
8
7
 
9
- var DBEventSchema = new mongoose.Schema({
10
- _class : {type: String, default:"au.com.bluedot.application.spring.DBEvent"},
11
- customerId : String,
12
- customerEmail : String,
13
- actionName : String,
14
- referenceId: String,
15
- creationTime: {type: Date, select: false, default: Date.now},
16
- },
17
- { collection : 'dbevent' }
18
- );
19
- var DBEvent = mongoose.model('DBEvent', DBEventSchema);
8
+ let DBEventSchema = new mongoose.Schema({
9
+ _class: {type: String, default: 'au.com.bluedot.application.spring.DBEvent'},
10
+ customerId: String,
11
+ customerEmail: String,
12
+ actionName: String,
13
+ referenceId: String,
14
+ creationTime: {type: Date, select: false, default: Date.now}
15
+ },
16
+ {collection: 'dbevent'}
17
+ )
18
+ let DBEvent = mongoose.model('DBEvent', DBEventSchema)
20
19
 
21
- module.exports = DBEvent;
20
+ module.exports = DBEvent
@@ -4,25 +4,25 @@
4
4
  * Owner :
5
5
  */
6
6
 
7
- const mongoose = require('mongoose'),
8
- Schema = mongoose.Schema;
7
+ const mongoose = require('mongoose')
8
+ const Schema = mongoose.Schema
9
+ const uuidv4 = require('uuid/v4')
9
10
 
10
11
  const DailyStats = mongoose.model(
11
12
  'DailyStats',
12
13
  new Schema(
13
14
  {
14
- _id: { type : String },
15
+ _id: {type: String, default: uuidv4},
15
16
  totalEndUsers: Number,
16
17
  totalIos: Number,
17
18
  totalAndroid: Number,
18
- dateOfCount: { type: Date },
19
- creationTime: { type: Date, default: Date.now }
19
+ creationDate: {type: Date, default: Date.now}
20
20
  },
21
21
  {
22
22
  collection: 'dailyStats',
23
23
  versionKey: false
24
24
  }
25
25
  )
26
- );
26
+ )
27
27
 
28
- module.exports = DailyStats;
28
+ module.exports = DailyStats
@@ -3,35 +3,34 @@
3
3
  * Copyright : Bluedot Innovations.
4
4
  * Owner :
5
5
  */
6
- var mongoose = require('mongoose');
6
+ var mongoose = require('mongoose')
7
7
 
8
8
  var DeviceRulesRequest = mongoose.model('DeviceRulesRequest', new mongoose.Schema(
9
- {
10
- _id : String,
11
- _class : {type: String, default:"au.com.bluedot.application.model.client.DeviceRulesRequest"},
12
- currentDeviceLocation : {
13
- "longitude" : Number,
14
- "latitude" : Number,
15
- "geometryType" : String
16
- },
17
- installationReference : String,
18
- apiKey : String,
19
- packageName : String,
20
- clientEmail : String,
21
- batteryStatus : String,
22
- deviceType : String,
23
- locationMethod : String,
24
- platform : String,
25
- sdkVersion : String,
26
- osVersion : String,
27
- speed : Number,
28
- creationTime : { type: Date, default: Date.now },
29
- lastUpdateTime : { type: Date, default: Date.now }
9
+ {
10
+ _id: String,
11
+ _class: {type: String, default: 'au.com.bluedot.application.model.client.DeviceRulesRequest'},
12
+ currentDeviceLocation: {
13
+ 'longitude': Number,
14
+ 'latitude': Number,
15
+ 'geometryType': String
30
16
  },
31
- {
32
- collection: 'deviceRulesRequest'
33
- }
34
- )
35
- );
17
+ installationReference: String,
18
+ apiKey: String,
19
+ packageName: String,
20
+ clientEmail: String,
21
+ batteryStatus: String,
22
+ deviceType: String,
23
+ locationMethod: String,
24
+ platform: String,
25
+ sdkVersion: String,
26
+ osVersion: String,
27
+ speed: Number,
28
+ creationTime: { type: Date, default: Date.now },
29
+ lastUpdateTime: { type: Date, default: Date.now }
30
+ },
31
+ {
32
+ collection: 'deviceRulesRequest'
33
+ })
34
+ )
36
35
 
37
- module.exports = DeviceRulesRequest;
36
+ module.exports = DeviceRulesRequest
package/models/Fence.js CHANGED
@@ -3,19 +3,18 @@
3
3
  * Copyright : Bluedot Innovations.
4
4
  * Owner :
5
5
  */
6
- var mongoose = require('mongoose');
7
- Schema = mongoose.Schema;
6
+ let mongoose = require('mongoose')
7
+ const Schema = mongoose.Schema
8
8
 
9
- var FenceSchema = new mongoose.Schema({
10
- "_id" : {type: String},
11
- "creationTime" : {type: Date, default: Date.now},
12
- "lastUpdateTime" : {type: Date, default: Date.now},
13
- "type" : {type:String, default: "Feature"},
14
- "dataSource" : {type:String, select: false, default : 'openApi'},
15
- "geometry" : {type: Schema.Types.Mixed, default: {}}
16
- }
17
- );
9
+ let FenceSchema = new mongoose.Schema({
10
+ '_id': {type: String},
11
+ 'creationTime': {type: Date, default: Date.now},
12
+ 'lastUpdateTime': {type: Date, default: Date.now},
13
+ 'type': {type: String, default: 'Feature'},
14
+ 'dataSource': {type: String, select: false, default: 'openApi'},
15
+ 'geometry': {type: Schema.Types.Mixed, default: {}}
16
+ })
18
17
 
19
- var Fence = mongoose.model('Fence', FenceSchema);
18
+ let Fence = mongoose.model('Fence', FenceSchema)
20
19
 
21
- module.exports = Fence;
20
+ module.exports = Fence
@@ -3,21 +3,19 @@
3
3
  * Copyright : Bluedot Innovations.
4
4
  * Owner :
5
5
  */
6
- var mongoose = require('mongoose');
7
- Schema = mongoose.Schema;
6
+ let mongoose = require('mongoose')
8
7
 
9
- var FenceSchema = new mongoose.Schema({
10
- _id : {type: String},
11
- "geometry": {
12
- "type": { type: String, required: true },
13
- "coordinates": { type: Array, required: true}
14
- },
15
- "fenceId" : String,
16
- "fenceName" : String
8
+ let FenceSchema = new mongoose.Schema({
9
+ _id: {type: String},
10
+ 'geometry': {
11
+ 'type': { type: String, required: true },
12
+ 'coordinates': {type: Array, required: true}
17
13
  },
18
- { collection : 'GeoFence' }
19
- );
14
+ 'fenceId': String,
15
+ 'fenceName': String
16
+ },
17
+ {collection: 'GeoFence'})
20
18
 
21
- var GeoFence = mongoose.model('GeoFence', FenceSchema);
19
+ let GeoFence = mongoose.model('GeoFence', FenceSchema)
22
20
 
23
- module.exports = GeoFence;
21
+ module.exports = GeoFence
@@ -3,24 +3,22 @@
3
3
  * Copyright : Bluedot Innovations.
4
4
  * Owner :
5
5
  */
6
- var mongoose = require('mongoose'),
7
- Schema = mongoose.Schema;
6
+ let mongoose = require('mongoose')
7
+ let Schema = mongoose.Schema
8
8
 
9
- var GeofeatureSchema = new Schema({
10
- _id: Schema.Types.ObjectId,
11
- _class: {type: String, default: "au.com.bluedot.application.spring.GeoFeature"},
12
- geometry: Schema.Types.Mixed,
13
- referenceId: String,
14
- apiKey: String,
15
- zoneId: String,
16
- type: String,
17
- name: String,
18
- beaconType: String,
19
- creationTime : {type: Date, default: Date.now},
20
- lastUpdateTime : {type: Date, default: Date.now},
21
- },
22
- { collection : 'geofeature' });
9
+ let GeofeatureSchema = new Schema({
10
+ geometry: Schema.Types.Mixed,
11
+ referenceId: String,
12
+ apiKey: String,
13
+ zoneId: String,
14
+ type: String,
15
+ name: String,
16
+ beaconType: String,
17
+ creationTime: {type: Date, default: Date.now},
18
+ lastUpdateTime: {type: Date, default: Date.now}
19
+ },
20
+ { collection: 'geofeature' })
23
21
 
24
- var Geofeature = mongoose.model('Geofeature', GeofeatureSchema);
22
+ let Geofeature = mongoose.model('Geofeature', GeofeatureSchema)
25
23
 
26
- module.exports = Geofeature;
24
+ module.exports = Geofeature