@bluedot-innovation/models 3.1.1 → 4.0.0

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 (160) hide show
  1. package/Models.js +10 -55
  2. package/models/AdminPortalUser.js +11 -10
  3. package/models/AdminUser.js +10 -0
  4. package/models/Application.js +38 -0
  5. package/models/ApplicationNotificationAction.js +30 -0
  6. package/models/ApplicationUsage.js +11 -0
  7. package/models/Beacon.js +32 -84
  8. package/models/BeaconFilter.js +23 -0
  9. package/models/BearingFilter.js +19 -0
  10. package/models/BoundingBox.js +17 -0
  11. package/models/Circle.js +21 -0
  12. package/models/ConfigurationParameters.js +20 -0
  13. package/models/Contract.js +38 -37
  14. package/models/Customer.js +38 -0
  15. package/models/CustomerLogin.js +10 -9
  16. package/models/DBEvent.js +14 -13
  17. package/models/DailyStats.js +7 -7
  18. package/models/DateRangeFilter.js +20 -0
  19. package/models/DeviceRulesRequest.js +28 -27
  20. package/models/Fence.js +21 -0
  21. package/models/FormattedBeacon.js +16 -0
  22. package/models/FormattedCircle.js +12 -0
  23. package/models/FormattedConditions.js +11 -0
  24. package/models/FormattedDateRange.js +11 -0
  25. package/models/FormattedPercentageCrossed.js +12 -0
  26. package/models/FormattedPoint.js +10 -0
  27. package/models/FormattedPolygon.js +11 -0
  28. package/models/FormattedPolyline.js +11 -0
  29. package/models/FormattedRectangle.js +12 -0
  30. package/models/FormattedTimeActive.js +17 -0
  31. package/models/FormattedZone.js +28 -0
  32. package/models/GeoFence.js +23 -0
  33. package/models/Geofeature.js +26 -0
  34. package/models/MessageAction.js +26 -28
  35. package/models/MonthlyStats.js +19 -35
  36. package/models/NotificationLogEntry.js +8 -7
  37. package/models/POILocation.js +7 -6
  38. package/models/POILookup.js +9 -8
  39. package/models/POIResult.js +8 -7
  40. package/models/PartnerCustomer.js +13 -12
  41. package/models/PartnerPasswordReset.js +9 -8
  42. package/models/PartnerUser.js +11 -10
  43. package/models/Partners.js +12 -11
  44. package/models/PercentageCrossedFilter.js +19 -0
  45. package/models/Point.js +20 -0
  46. package/models/Polygon.js +18 -0
  47. package/models/Polyline.js +18 -0
  48. package/models/PropertyMapping.js +17 -0
  49. package/models/Reference.js +19 -0
  50. package/models/RuleRequestAggregation.js +17 -33
  51. package/models/SequenceFilter.js +18 -0
  52. package/models/SimpleCheckInZone.js +29 -0
  53. package/models/SingleUseToken.js +8 -7
  54. package/models/SoundAction.js +28 -0
  55. package/models/SpeedFilter.js +19 -0
  56. package/models/TestDevice.js +12 -11
  57. package/models/TestDeviceCluster.js +10 -9
  58. package/models/TestInstance.js +10 -9
  59. package/models/TestScenario.js +10 -9
  60. package/models/TimeOfDayRange.js +16 -16
  61. package/models/TimeOfDayRangeFilter.js +19 -0
  62. package/models/URLAction.js +31 -0
  63. package/models/VibrationAction.js +28 -0
  64. package/models/ZoneUIState.js +18 -18
  65. package/models/property.js +25 -0
  66. package/package-lock.json.bak +170 -0
  67. package/package.json +6 -30
  68. package/.eslintrc.js +0 -42
  69. package/.gitlab-ci.yml +0 -43
  70. package/CHANGELOG.md +0 -152
  71. package/README.MD +0 -36
  72. package/__tests__/account/account.data.json +0 -12
  73. package/__tests__/account/account.rules.js +0 -8
  74. package/__tests__/account/account.spec.js +0 -83
  75. package/__tests__/action/message/messageAction.data.json +0 -5
  76. package/__tests__/action/message/messageAction.rules.json +0 -3
  77. package/__tests__/action/message/messageAction.spec.js +0 -61
  78. package/__tests__/action/url/urlAction.data.json +0 -4
  79. package/__tests__/action/url/urlAction.rules.json +0 -3
  80. package/__tests__/action/url/urlAction.spec.js +0 -74
  81. package/__tests__/beacon/beacon.data.json +0 -15
  82. package/__tests__/beacon/beacon.rules.json +0 -13
  83. package/__tests__/beacon/beacon.spec.js +0 -104
  84. package/__tests__/condition/beacon/beaconFilter.data.json +0 -1
  85. package/__tests__/condition/beacon/beaconFilter.rules.json +0 -3
  86. package/__tests__/condition/beacon/beaconFilter.spec.js +0 -1
  87. package/__tests__/condition/dayRange/dayRange.data.json +0 -5
  88. package/__tests__/condition/dayRange/dayRange.rules.json +0 -3
  89. package/__tests__/condition/dayRange/dayRange.spec.js +0 -74
  90. package/__tests__/condition/percentageCrossed/travelPath.data.json +0 -5
  91. package/__tests__/condition/percentageCrossed/travelPath.rules.json +0 -3
  92. package/__tests__/condition/percentageCrossed/travelPath.spec.js +0 -62
  93. package/__tests__/condition/speed/speed.data.json +0 -5
  94. package/__tests__/condition/speed/speed.rules.json +0 -3
  95. package/__tests__/condition/speed/speed.spec.js +0 -73
  96. package/__tests__/condition/timeActive/timeActive.data.json +0 -5
  97. package/__tests__/condition/timeActive/timeActive.rules.json +0 -7
  98. package/__tests__/condition/timeActive/timeActive.spec.js +0 -94
  99. package/__tests__/condition/travelDirection/travelDirection.data.json +0 -5
  100. package/__tests__/condition/travelDirection/travelDirection.rules.json +0 -3
  101. package/__tests__/condition/travelDirection/travelDirection.spec.js +0 -132
  102. package/__tests__/dailyStats/checkDailyStats.js +0 -31
  103. package/__tests__/geofeature/boundingBox/boundingBox.data.json +0 -12
  104. package/__tests__/geofeature/boundingBox/boundingBox.rules.json +0 -3
  105. package/__tests__/geofeature/boundingBox/boundingBox.spec.js +0 -78
  106. package/__tests__/geofeature/circle/circle.data.json +0 -9
  107. package/__tests__/geofeature/circle/circle.rules.json +0 -3
  108. package/__tests__/geofeature/circle/circle.spec.js +0 -71
  109. package/__tests__/geofeature/geoline/geoline.data.json +0 -46
  110. package/__tests__/geofeature/geoline/geoline.rules.json +0 -3
  111. package/__tests__/geofeature/geoline/geoline.spec.js +0 -70
  112. package/__tests__/geofeature/polygon/polygon.data.json +0 -46
  113. package/__tests__/geofeature/polygon/polygon.rules.json +0 -3
  114. package/__tests__/geofeature/polygon/polygon.spec.js +0 -127
  115. package/__tests__/geofeature/zoneBeacon/zoneBeacon.data.json +0 -16
  116. package/__tests__/geofeature/zoneBeacon/zoneBeacon.rules.json +0 -13
  117. package/__tests__/geofeature/zoneBeacon/zoneBeacon.spec.js +0 -62
  118. package/__tests__/monthlyStats/monthlyStats.data.json +0 -29
  119. package/__tests__/monthlyStats/monthlyStats.spec.js +0 -66
  120. package/__tests__/project/project.data.json +0 -18
  121. package/__tests__/project/project.rules.json +0 -9
  122. package/__tests__/project/project.spec.js +0 -81
  123. package/__tests__/ruleRequestAggregation/ruleRequestAggregation.data.json +0 -8
  124. package/__tests__/ruleRequestAggregation/ruleRequestAggregation.spec.js +0 -69
  125. package/__tests__/setup.js +0 -7
  126. package/__tests__/user/user.data.js +0 -19
  127. package/__tests__/user/user.rules.js +0 -8
  128. package/__tests__/user/user.spec.js +0 -130
  129. package/__tests__/utils/utils.spec.js +0 -24
  130. package/__tests__/zone/zone.action.spec.js +0 -50
  131. package/__tests__/zone/zone.condition.spec.js +0 -76
  132. package/__tests__/zone/zone.data.json +0 -157
  133. package/__tests__/zone/zone.geofeatures.spec.js +0 -75
  134. package/__tests__/zone/zone.spec.js +0 -134
  135. package/constants/errorMessages.js +0 -2
  136. package/helpers.js +0 -102
  137. package/models/Account.js +0 -50
  138. package/models/Project.js +0 -55
  139. package/models/UrlAction.js +0 -46
  140. package/models/User.js +0 -61
  141. package/models/Zone.js +0 -123
  142. package/models/conditions/DayRange.js +0 -52
  143. package/models/conditions/Speed.js +0 -42
  144. package/models/conditions/TimeActive.js +0 -50
  145. package/models/conditions/TravelDirection.js +0 -67
  146. package/models/conditions/TravelPath.js +0 -36
  147. package/models/geofeatures/BoundingBox.js +0 -44
  148. package/models/geofeatures/Circle.js +0 -39
  149. package/models/geofeatures/Geoline.js +0 -34
  150. package/models/geofeatures/Polygon.js +0 -45
  151. package/models/geofeatures/ZoneBeacon.js +0 -28
  152. package/schemas/MultiLineStringGeometry.js +0 -14
  153. package/schemas/Point.js +0 -13
  154. package/schemas/PointGeometry.js +0 -14
  155. package/schemas/PolygonGeometry.js +0 -14
  156. package/schemas/ProjectPermission.js +0 -21
  157. package/schemas/Webhook.js +0 -22
  158. package/utils/index.js +0 -39
  159. package/validators/checkDistanceBetweenVertices.js +0 -21
  160. package/yarn.lock +0 -2796
package/Models.js CHANGED
@@ -2,58 +2,13 @@
2
2
  * Created by andrewstirling on 22/12/16.
3
3
  */
4
4
 
5
- let Models = {}
6
-
7
- Models.Account = require('./models/Account').Model
8
- Models.Beacon = require('./models/Beacon').Model
9
-
10
- Models.MessageAction = require('./models/MessageAction').Model
11
- Models.MonthlyStat = require('./models/MonthlyStats').Model
12
- Models.Project = require('./models/Project').Model
13
- Models.RuleRequestAggregation = require('./models/RuleRequestAggregation').Model
14
- Models.UrlAction = require('./models/UrlAction').Model
15
- Models.User = require('./models/User').Model
16
- Models.Zone = require('./models/Zone').Model
17
-
18
- // Geofeatures
19
- Models.BoundingBox = require('./models/geofeatures/BoundingBox').Model
20
- Models.Circle = require('./models/geofeatures/Circle').Model
21
- Models.Polygon = require('./models/geofeatures/Polygon').Model
22
- Models.Geoline = require('./models/geofeatures/Geoline').Model
23
- Models.ZoneBeacon = require('./models/geofeatures/ZoneBeacon').Model
24
-
25
- // Conditions
26
- Models.DayRange = require('./models/conditions/DayRange').Model
27
- Models.TimeActive = require('./models/conditions/TimeActive').Model
28
- Models.TravelPath = require('./models/conditions/TravelPath').Model
29
- Models.Speed = require('./models/conditions/Speed').Model
30
- Models.TravelDirection = require('./models/conditions/TravelDirection').Model
31
-
32
- let Schemas = {}
33
-
34
- Schemas.Account = require('./models/Account').Schema
35
- Schemas.Beacon = require('./models/Beacon').Schema
36
- Schemas.MessageAction = require('./models/MessageAction').Schema
37
- Schemas.MonthlyStat = require('./models/MonthlyStats').Schema
38
- Schemas.Project = require('./models/Project').Schema
39
- Schemas.RuleRequestAggregation = require('./models/RuleRequestAggregation').Schema
40
- Schemas.UrlAction = require('./models/UrlAction').Schema
41
- Schemas.User = require('./models/User').Schema
42
- Schemas.Zone = require('./models/Zone').Schema
43
-
44
- // Geofeatures
45
- Schemas.BoundingBox = require('./models/geofeatures/BoundingBox').Schema
46
- Schemas.Circle = require('./models/geofeatures/Circle').Schema
47
- Schemas.Polygon = require('./models/geofeatures/Polygon').Schema
48
- Schemas.Geoline = require('./models/geofeatures/Geoline').Schema
49
- Schemas.ZoneBeacon = require('./models/geofeatures/ZoneBeacon').Schema
50
-
51
- // Conditions
52
- Schemas.DayRange = require('./models/conditions/DayRange').Schema
53
- Schemas.Speed = require('./models/conditions/Speed').Schema
54
- Schemas.TimeActive = require('./models/conditions/TimeActive').Schema
55
- Schemas.TravelPath = require('./models/conditions/TravelPath').Schema
56
- Schemas.TravelDirection = require('./models/conditions/TravelDirection').Schema
57
-
58
- Models.Schemas = Schemas
59
- module.exports = Models
5
+ var Models = {};
6
+ var normalizedPath = require("path").join(__dirname, "models");
7
+ var fs = require("fs");
8
+ fs.readdirSync(normalizedPath).forEach(function(file) {
9
+ if( !fs.lstatSync(normalizedPath+'/'+file).isDirectory() ) {
10
+ Models[file.substring(0, file.length - 3)] = require("./models/" + file);
11
+ }
12
+ });
13
+
14
+ module.exports = Models;
@@ -2,24 +2,25 @@
2
2
  * Copyright : Bluedot Innovations.
3
3
  */
4
4
 
5
- let mongoose = require('mongoose')
6
- let Enums = require('@bluedot-innovation/enums')
5
+ var mongoose = require('mongoose');
6
+ var Enums = require('@bluedot-innovation/enums');
7
7
 
8
- let AdminPortalUser = mongoose.model('AdminPortalUser', new mongoose.Schema(
8
+ var AdminPortalUser = mongoose.model('AdminPortalUser', new mongoose.Schema(
9
9
  {
10
10
  emailAddress: String,
11
11
  password: String,
12
12
  firstName: String,
13
13
  lastName: String,
14
- state: {type: String, default: Enums.StateEnum.active},
15
- 'creationTime': {type: Date, default: Date.now},
16
- 'dataSource': {type: String, select: false, default: 'AdminPortal'},
14
+ state: {type:String, default: Enums.StateEnum.active},
15
+ "creationTime" : {type: Date, default: Date.now},
16
+ "dataSource" : {type:String, select: false, default : 'AdminPortal'},
17
17
  adminId: String,
18
18
  secret: String
19
19
  },
20
20
  {
21
- collection: 'adminPortalUser'
22
- })
23
- )
21
+ collection : 'adminPortalUser'
22
+ }
23
+ )
24
+ );
24
25
 
25
- module.exports = AdminPortalUser
26
+ module.exports = AdminPortalUser;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Created by Arun on 10/09/2014.
3
+ * Copyright : Bluedot Innovations.
4
+ * Owner :
5
+ */
6
+ var mongoose = require('mongoose');
7
+ var AdminUser = mongoose.model('AdminUser', new mongoose.Schema({},
8
+ { collection : 'AdminUser' }
9
+ ));
10
+ module.exports = AdminUser;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Created by Arun on 10/09/2014.
3
+ * Copyright : Bluedot Innovations.
4
+ * Owner :
5
+ */
6
+ var mongoose = require('mongoose');
7
+ var Enums = require('@bluedot-innovation/enums');
8
+ Schema = mongoose.Schema;
9
+
10
+ var ApplicationSchema = new mongoose.Schema({
11
+ _id : {type: String},
12
+ _class : {type: String, default:"au.com.bluedot.application.model.client.Application"},
13
+ state : {type: String, default : Enums.StateEnum.active, select: false},
14
+ nextRuleUpdateInterval: {type: Number, select: false},
15
+ nextRuleUpdateIntervalFormatted: {type:String, required: true},
16
+ lastUpdateTime: {type: Date, select: false},
17
+ creationTime: {type: Date, select: false},
18
+ "administrator" : {type: String, select: false},
19
+ enableDataAnonymisation: {type: Boolean, select: false},
20
+ apiKey: String,
21
+ dataSource: {type:String, select: false, default : 'openApi'},
22
+ name: {type: String},
23
+ packageName: {type: String},
24
+ customerId : String,
25
+ firebaseApiKey: String,
26
+ lastPushSync: Date,
27
+ webhook : {
28
+ url: String,
29
+ enabled: Boolean,
30
+ params: {}
31
+ },
32
+ configurationParameters:{type: Schema.Types.Mixed, default: null}
33
+ },
34
+ { collection : 'application' }
35
+ );
36
+ var Application = mongoose.model('Application', ApplicationSchema);
37
+
38
+ module.exports = Application;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Created by Arun on 10/09/2014.
3
+ * Copyright : Bluedot Innovations.
4
+ * Owner :
5
+ */
6
+ var mongoose = require('mongoose');
7
+ var StateEnum = require('@bluedot-innovation/enums').StateEnum;
8
+
9
+ var ApplicationNotificationActionSchema = new mongoose.Schema({
10
+ guid : {type: String},
11
+ creationTime : {type: Date, default: Date.now},
12
+ dataSource: {type:String, select: false, default : 'openApi'},
13
+ actionName : String,
14
+ type: {type: String, default: 'applicationNotification'},
15
+ _class: {type: String, default: 'au.com.bluedot.application.spring.action.ApplicationNotificationAction'},
16
+ description : String,
17
+ lastUpdateTime : Date,
18
+ customData : Schema.Types.Mixed,
19
+ state: {type: String, default : StateEnum.active, select: false},
20
+ filters: []
21
+ },
22
+ {
23
+ _id: false
24
+ }
25
+ );
26
+
27
+ var ApplicationNotificationAction = mongoose.model('ApplicationNotificationAction', ApplicationNotificationActionSchema);
28
+
29
+
30
+ module.exports = ApplicationNotificationAction;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Created by Arun on 10/09/2014.
3
+ * Copyright : Bluedot Innovations.
4
+ * Owner :
5
+ */
6
+ var mongoose = require('mongoose');
7
+
8
+ var ApplicationUsage = mongoose.model('ApplicationUsage', new mongoose.Schema({},
9
+ { collection : 'applicationUsage' }
10
+ ));
11
+ module.exports = ApplicationUsage;
package/models/Beacon.js CHANGED
@@ -1,88 +1,36 @@
1
- const { BeaconEnum, StateEnum } = require('@bluedot-innovation/enums')
2
- const PointGeometry = require('../schemas/PointGeometry')
3
- const patcher = require('mongoose-json-patch')
4
- const Point = require('../schemas/Point')
5
- const mongoose = require('mongoose')
6
- const uuidv4 = require('uuid/v4')
7
-
8
- let schema = {
9
- _id: {type: String, default: uuidv4},
10
- name: {type: String, required: [true, 'name is required.']},
11
- description: {type: String, default: ''},
12
- creationTime: {type: Date, default: Date.now},
13
- lastUpdateTime: {type: Date, default: Date.now},
14
- state: {type: String, default: StateEnum.active},
15
- beaconType: {
16
- type: String,
17
- required: true,
18
- enum: [BeaconEnum.IOS, BeaconEnum.ANDROID, BeaconEnum.BOTH],
19
- validate: {
20
- isAsync: true,
21
- validator: validateBeaconType,
22
- msg: 'Async validation. Not used'
23
- }
1
+ /**
2
+ * Created by Arun on 10/09/2014.
3
+ * Copyright : Bluedot Innovations.
4
+ * Owner :
5
+ */
6
+ var mongoose = require('mongoose');
7
+ var StateEnum = require('@bluedot-innovation/enums').StateEnum;
8
+
9
+ Schema = mongoose.Schema;
10
+ var BeaconSchema = new mongoose.Schema({
11
+ "_id" : {type: String},
12
+ "creationTime" : {type: Date, default: Date.now},
13
+ "lastUpdateTime" : {type: Date, default: Date.now},
14
+ "state": {type: String, default: StateEnum.active},
15
+ "range": Number,
16
+ "major": Number,
17
+ "minor": Number,
18
+ "description": String,
19
+ "txPower": Number,
20
+ "name": String,
21
+ "macAddress": String,
22
+ "proximityUUID": String,
23
+ "customerId": String,
24
+ "beaconType": String,
25
+ "altitude": Number,
26
+ "altitudeAccuracy": Number,
27
+ "dataSource" : {type:String, select: false, default : 'openApi'},
28
+ "geometry" : {type: Schema.Types.Mixed, default: {}}
24
29
  },
25
- location: {type: Point, required: true},
26
- geometry: {type: PointGeometry},
27
- accountId: {type: String, required: true},
28
- // These must be unique
29
- major: {type: Number, validate: [{validator: validateMajorMinor, msg: 'Major needs to be within range(0-65535)'}]},
30
- minor: {type: Number, validate: [{validator: validateMajorMinor, msg: 'Minor needs to be within range(0-65535)'}]},
31
- txPower: {type: Number},
32
- macAddress: {type: String},
33
- proximityUUID: {type: String}
34
- }
35
-
36
- let BeaconSchema = new mongoose.Schema(schema, {collection: 'beacon', autoIndex: false})
37
-
38
- BeaconSchema.index({ macAddress: 1 })
39
- BeaconSchema.index({ proximityUUID: 1, major: 1, minor: 1 })
40
- BeaconSchema.index({ accountId: 1, geometry: '2dsphere' })
41
-
42
- BeaconSchema.plugin(patcher)
43
-
44
- // mongoose validator helper plugin
45
- BeaconSchema.post('validate', function (doc) {
46
- // Beacon Schema post validate hook
47
- this.lastUpdateTime = Date.now()
48
- Object.assign(this.errors || {}, this.errors || {}, this.customErrors)
49
- })
50
-
51
- function validateMajorMinor (v) {
52
- 'use strict'
53
- return v >= 0 && v <= 65535
54
- }
55
-
56
- function validateBeaconType (v, callback) {
57
- 'use strict'
58
- const beaconType = v
59
- const { minor, major, macAddress, proximityUUID } = this;
60
-
61
- let androidRegex = new RegExp(/(android)/ig)
62
- let iosRegex = new RegExp(/(ios)/ig)
63
- let bothRegex = new RegExp(/(both)/ig)
64
-
65
- if (androidRegex.test(beaconType)) {
66
- callback((!!macAddress), "Beacon type 'Android' must have a mac address")
67
- } else if (iosRegex.test(beaconType)) {
68
- callback((!!proximityUUID && !!minor && !!major), "Beacon type 'IOS' must have 'proximityUUID', 'minor' and 'major' values")
69
- } else if (bothRegex.test(beaconType)) {
70
- callback((!!proximityUUID && !!minor && !!major && !!macAddress), "Beacon type 'Both' must have all of 'proximityUUID', 'minor', 'major', and 'mac address' values")
71
- } else {
72
- callback(true)
73
- }
74
- }
30
+ { collection : 'beacon' }
31
+ );
75
32
 
76
- // optional mongoose
77
- let model = (mongooseInstance) => {
78
- const instance = mongooseInstance || mongoose
79
- let Beacon = instance.model('Beacon', BeaconSchema)
33
+ var Beacon = mongoose.model('Beacon', BeaconSchema);
80
34
 
81
- Beacon.on('index', function (error) {
82
- console.log(error.message)
83
- })
35
+ module.exports = Beacon;
84
36
 
85
- return Beacon
86
- }
87
- // Exports Mongoose Model, Mongoose Schema, JSON schema (required locally for discriminators)
88
- module.exports = { Model: model, Schema: BeaconSchema, beaconSchema: schema }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Created by Arun on 10/09/2014.
3
+ * Copyright : Bluedot Innovations.
4
+ * Owner :
5
+ */
6
+ var mongoose = require('mongoose');
7
+ Schema = mongoose.Schema;
8
+
9
+ var BeaconFilterSchema = new mongoose.Schema(
10
+ {
11
+ "_class" : {type:String, default : "au.com.bluedot.application.spring.filter.spatial.BeaconFilter"},
12
+ "beacon" : {},
13
+ "guid" : String,
14
+ "type" : {type:String, default: "beacon"}
15
+ },
16
+ {
17
+ _id: false
18
+ }
19
+ );
20
+
21
+ var BeaconFilter = mongoose.model('BeaconFilter', BeaconFilterSchema);
22
+
23
+ module.exports = BeaconFilter;
@@ -0,0 +1,19 @@
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
+ },
15
+ {
16
+ _id: false
17
+ }
18
+ ));
19
+ module.exports = BearingFilter;
@@ -0,0 +1,17 @@
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;
8
+
9
+ var BoundingBox = mongoose.model('BoundingBox', mongoose.Schema({
10
+ type: {type: String, default: "MultiLineString"},
11
+ "coordinates" : []
12
+ },
13
+ {
14
+ _id: false
15
+ }
16
+ ));
17
+ module.exports = BoundingBox;
@@ -0,0 +1,21 @@
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
+ },
17
+ {
18
+ _id: false
19
+ }
20
+ ));
21
+ module.exports = Circle;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright : Bluedot Innovations.
3
+ */
4
+
5
+ var mongoose = require('mongoose'),
6
+ Schema = mongoose.Schema;
7
+
8
+ var ConfigurationParameters = mongoose.model('ConfigurationParameters', new Schema(
9
+ {
10
+ name: String,
11
+ iosConfig: {type: Schema.Types.Mixed, default: {}},
12
+ androidConfig: {type: Schema.Types.Mixed, default: {}},
13
+ },
14
+ {
15
+ collection : 'configurationParameters'
16
+ }
17
+ )
18
+ );
19
+
20
+ module.exports = ConfigurationParameters;
@@ -3,42 +3,43 @@
3
3
  * Copyright : Bluedot Innovations.
4
4
  * Owner :
5
5
  */
6
- let mongoose = require('mongoose')
6
+ var mongoose = require('mongoose');
7
7
 
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
- )
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
+ );
43
44
 
44
- module.exports = Contract
45
+ module.exports = Contract;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Created by Arun on 10/09/2014.
3
+ * Copyright : Bluedot Innovations.
4
+ * Owner :
5
+ */
6
+ var mongoose = require('mongoose');
7
+ var StateEnum = require('@bluedot-innovation/enums').StateEnum;
8
+
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
+ );
37
+
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,15 +19,16 @@ 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
- )
29
+ collection : 'customerLogin'
30
+ }
31
+ )
32
+ );
32
33
 
33
- module.exports = CustomerLogin
34
+ module.exports = CustomerLogin;
package/models/DBEvent.js CHANGED
@@ -3,18 +3,19 @@
3
3
  * Copyright : Bluedot Innovations.
4
4
  * Owner :
5
5
  */
6
- let mongoose = require('mongoose')
6
+ var mongoose = require('mongoose');
7
+ Schema = mongoose.Schema;
7
8
 
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)
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);
19
20
 
20
- module.exports = DBEvent
21
+ module.exports = DBEvent;
@@ -4,25 +4,25 @@
4
4
  * Owner :
5
5
  */
6
6
 
7
- const mongoose = require('mongoose')
8
- const Schema = mongoose.Schema
9
- const uuidv4 = require('uuid/v4')
7
+ const mongoose = require('mongoose'),
8
+ Schema = mongoose.Schema;
10
9
 
11
10
  const DailyStats = mongoose.model(
12
11
  'DailyStats',
13
12
  new Schema(
14
13
  {
15
- _id: {type: String, default: uuidv4},
14
+ _id: { type : String },
16
15
  totalEndUsers: Number,
17
16
  totalIos: Number,
18
17
  totalAndroid: Number,
19
- creationDate: {type: Date, default: Date.now}
18
+ dateOfCount: { type: Date },
19
+ creationTime: { 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;