@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.
- package/Models.js +10 -55
- package/models/AdminPortalUser.js +11 -10
- package/models/AdminUser.js +10 -0
- package/models/Application.js +38 -0
- package/models/ApplicationNotificationAction.js +30 -0
- package/models/ApplicationUsage.js +11 -0
- package/models/Beacon.js +32 -84
- package/models/BeaconFilter.js +23 -0
- package/models/BearingFilter.js +19 -0
- package/models/BoundingBox.js +17 -0
- package/models/Circle.js +21 -0
- package/models/ConfigurationParameters.js +20 -0
- package/models/Contract.js +38 -37
- package/models/Customer.js +38 -0
- package/models/CustomerLogin.js +10 -9
- package/models/DBEvent.js +14 -13
- package/models/DailyStats.js +7 -7
- package/models/DateRangeFilter.js +20 -0
- package/models/DeviceRulesRequest.js +28 -27
- package/models/Fence.js +21 -0
- package/models/FormattedBeacon.js +16 -0
- package/models/FormattedCircle.js +12 -0
- package/models/FormattedConditions.js +11 -0
- package/models/FormattedDateRange.js +11 -0
- package/models/FormattedPercentageCrossed.js +12 -0
- package/models/FormattedPoint.js +10 -0
- package/models/FormattedPolygon.js +11 -0
- package/models/FormattedPolyline.js +11 -0
- package/models/FormattedRectangle.js +12 -0
- package/models/FormattedTimeActive.js +17 -0
- package/models/FormattedZone.js +28 -0
- package/models/GeoFence.js +23 -0
- package/models/Geofeature.js +26 -0
- package/models/MessageAction.js +26 -28
- package/models/MonthlyStats.js +19 -35
- package/models/NotificationLogEntry.js +8 -7
- package/models/POILocation.js +7 -6
- package/models/POILookup.js +9 -8
- package/models/POIResult.js +8 -7
- package/models/PartnerCustomer.js +13 -12
- package/models/PartnerPasswordReset.js +9 -8
- package/models/PartnerUser.js +11 -10
- package/models/Partners.js +12 -11
- package/models/PercentageCrossedFilter.js +19 -0
- package/models/Point.js +20 -0
- package/models/Polygon.js +18 -0
- package/models/Polyline.js +18 -0
- package/models/PropertyMapping.js +17 -0
- package/models/Reference.js +19 -0
- package/models/RuleRequestAggregation.js +17 -33
- package/models/SequenceFilter.js +18 -0
- package/models/SimpleCheckInZone.js +29 -0
- package/models/SingleUseToken.js +8 -7
- package/models/SoundAction.js +28 -0
- package/models/SpeedFilter.js +19 -0
- package/models/TestDevice.js +12 -11
- package/models/TestDeviceCluster.js +10 -9
- package/models/TestInstance.js +10 -9
- package/models/TestScenario.js +10 -9
- package/models/TimeOfDayRange.js +16 -16
- package/models/TimeOfDayRangeFilter.js +19 -0
- package/models/URLAction.js +31 -0
- package/models/VibrationAction.js +28 -0
- package/models/ZoneUIState.js +18 -18
- package/models/property.js +25 -0
- package/package-lock.json.bak +170 -0
- package/package.json +6 -30
- package/.eslintrc.js +0 -42
- package/.gitlab-ci.yml +0 -43
- package/CHANGELOG.md +0 -152
- package/README.MD +0 -36
- package/__tests__/account/account.data.json +0 -12
- package/__tests__/account/account.rules.js +0 -8
- package/__tests__/account/account.spec.js +0 -83
- package/__tests__/action/message/messageAction.data.json +0 -5
- package/__tests__/action/message/messageAction.rules.json +0 -3
- package/__tests__/action/message/messageAction.spec.js +0 -61
- package/__tests__/action/url/urlAction.data.json +0 -4
- package/__tests__/action/url/urlAction.rules.json +0 -3
- package/__tests__/action/url/urlAction.spec.js +0 -74
- package/__tests__/beacon/beacon.data.json +0 -15
- package/__tests__/beacon/beacon.rules.json +0 -13
- package/__tests__/beacon/beacon.spec.js +0 -104
- package/__tests__/condition/beacon/beaconFilter.data.json +0 -1
- package/__tests__/condition/beacon/beaconFilter.rules.json +0 -3
- package/__tests__/condition/beacon/beaconFilter.spec.js +0 -1
- package/__tests__/condition/dayRange/dayRange.data.json +0 -5
- package/__tests__/condition/dayRange/dayRange.rules.json +0 -3
- package/__tests__/condition/dayRange/dayRange.spec.js +0 -74
- package/__tests__/condition/percentageCrossed/travelPath.data.json +0 -5
- package/__tests__/condition/percentageCrossed/travelPath.rules.json +0 -3
- package/__tests__/condition/percentageCrossed/travelPath.spec.js +0 -62
- package/__tests__/condition/speed/speed.data.json +0 -5
- package/__tests__/condition/speed/speed.rules.json +0 -3
- package/__tests__/condition/speed/speed.spec.js +0 -73
- package/__tests__/condition/timeActive/timeActive.data.json +0 -5
- package/__tests__/condition/timeActive/timeActive.rules.json +0 -7
- package/__tests__/condition/timeActive/timeActive.spec.js +0 -94
- package/__tests__/condition/travelDirection/travelDirection.data.json +0 -5
- package/__tests__/condition/travelDirection/travelDirection.rules.json +0 -3
- package/__tests__/condition/travelDirection/travelDirection.spec.js +0 -132
- package/__tests__/dailyStats/checkDailyStats.js +0 -31
- package/__tests__/geofeature/boundingBox/boundingBox.data.json +0 -12
- package/__tests__/geofeature/boundingBox/boundingBox.rules.json +0 -3
- package/__tests__/geofeature/boundingBox/boundingBox.spec.js +0 -78
- package/__tests__/geofeature/circle/circle.data.json +0 -9
- package/__tests__/geofeature/circle/circle.rules.json +0 -3
- package/__tests__/geofeature/circle/circle.spec.js +0 -71
- package/__tests__/geofeature/geoline/geoline.data.json +0 -46
- package/__tests__/geofeature/geoline/geoline.rules.json +0 -3
- package/__tests__/geofeature/geoline/geoline.spec.js +0 -70
- package/__tests__/geofeature/polygon/polygon.data.json +0 -46
- package/__tests__/geofeature/polygon/polygon.rules.json +0 -3
- package/__tests__/geofeature/polygon/polygon.spec.js +0 -127
- package/__tests__/geofeature/zoneBeacon/zoneBeacon.data.json +0 -16
- package/__tests__/geofeature/zoneBeacon/zoneBeacon.rules.json +0 -13
- package/__tests__/geofeature/zoneBeacon/zoneBeacon.spec.js +0 -62
- package/__tests__/monthlyStats/monthlyStats.data.json +0 -29
- package/__tests__/monthlyStats/monthlyStats.spec.js +0 -66
- package/__tests__/project/project.data.json +0 -18
- package/__tests__/project/project.rules.json +0 -9
- package/__tests__/project/project.spec.js +0 -81
- package/__tests__/ruleRequestAggregation/ruleRequestAggregation.data.json +0 -8
- package/__tests__/ruleRequestAggregation/ruleRequestAggregation.spec.js +0 -69
- package/__tests__/setup.js +0 -7
- package/__tests__/user/user.data.js +0 -19
- package/__tests__/user/user.rules.js +0 -8
- package/__tests__/user/user.spec.js +0 -130
- package/__tests__/utils/utils.spec.js +0 -24
- package/__tests__/zone/zone.action.spec.js +0 -50
- package/__tests__/zone/zone.condition.spec.js +0 -76
- package/__tests__/zone/zone.data.json +0 -157
- package/__tests__/zone/zone.geofeatures.spec.js +0 -75
- package/__tests__/zone/zone.spec.js +0 -134
- package/constants/errorMessages.js +0 -2
- package/helpers.js +0 -102
- package/models/Account.js +0 -50
- package/models/Project.js +0 -55
- package/models/UrlAction.js +0 -46
- package/models/User.js +0 -61
- package/models/Zone.js +0 -123
- package/models/conditions/DayRange.js +0 -52
- package/models/conditions/Speed.js +0 -42
- package/models/conditions/TimeActive.js +0 -50
- package/models/conditions/TravelDirection.js +0 -67
- package/models/conditions/TravelPath.js +0 -36
- package/models/geofeatures/BoundingBox.js +0 -44
- package/models/geofeatures/Circle.js +0 -39
- package/models/geofeatures/Geoline.js +0 -34
- package/models/geofeatures/Polygon.js +0 -45
- package/models/geofeatures/ZoneBeacon.js +0 -28
- package/schemas/MultiLineStringGeometry.js +0 -14
- package/schemas/Point.js +0 -13
- package/schemas/PointGeometry.js +0 -14
- package/schemas/PolygonGeometry.js +0 -14
- package/schemas/ProjectPermission.js +0 -21
- package/schemas/Webhook.js +0 -22
- package/utils/index.js +0 -39
- package/validators/checkDistanceBetweenVertices.js +0 -21
- 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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Models.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
6
|
-
|
|
5
|
+
var mongoose = require('mongoose');
|
|
6
|
+
var Enums = require('@bluedot-innovation/enums');
|
|
7
7
|
|
|
8
|
-
|
|
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:
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
26
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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;
|
package/models/Circle.js
ADDED
|
@@ -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;
|
package/models/Contract.js
CHANGED
|
@@ -3,42 +3,43 @@
|
|
|
3
3
|
* Copyright : Bluedot Innovations.
|
|
4
4
|
* Owner :
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
var mongoose = require('mongoose');
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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;
|
package/models/CustomerLogin.js
CHANGED
|
@@ -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:
|
|
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
|
-
|
|
6
|
+
var mongoose = require('mongoose');
|
|
7
|
+
Schema = mongoose.Schema;
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
{collection: 'dbevent'}
|
|
17
|
-
)
|
|
18
|
-
|
|
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;
|
package/models/DailyStats.js
CHANGED
|
@@ -4,25 +4,25 @@
|
|
|
4
4
|
* Owner :
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
const mongoose = require('mongoose')
|
|
8
|
-
|
|
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
|
|
14
|
+
_id: { type : String },
|
|
16
15
|
totalEndUsers: Number,
|
|
17
16
|
totalIos: Number,
|
|
18
17
|
totalAndroid: Number,
|
|
19
|
-
|
|
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;
|