@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.
- package/.eslintrc.js +6 -0
- package/.gitlab-ci.yml +43 -0
- package/.nyc_output/.gitkeep +0 -0
- package/Models.js +8 -8
- package/README.MD +36 -0
- package/__tests__/action/message/messageAction.data.json +5 -0
- package/__tests__/action/message/messageAction.rules.json +3 -0
- package/__tests__/action/message/messageAction.spec.js +61 -0
- package/__tests__/action/url/urlAction.data.json +4 -0
- package/__tests__/action/url/urlAction.rules.json +3 -0
- package/__tests__/action/url/urlAction.spec.js +62 -0
- package/__tests__/dailyStats/checkDailyStats.js +30 -0
- package/__tests__/filter/beacon/beaconFilter.data.json +1 -0
- package/__tests__/filter/beacon/beaconFilter.rules.json +3 -0
- package/__tests__/filter/beacon/beaconFilter.spec.js +1 -0
- package/__tests__/filter/bearing/bearingFilter.data.json +5 -0
- package/__tests__/filter/bearing/bearingFilter.rules.json +3 -0
- package/__tests__/filter/bearing/bearingFilter.spec.js +95 -0
- package/__tests__/filter/calendarDateRange/calendarDateRangeFilter.data.json +5 -0
- package/__tests__/filter/calendarDateRange/calendarDateRangeFilter.rules.json +3 -0
- package/__tests__/filter/calendarDateRange/calendarDateRangeFilter.spec.js +62 -0
- package/__tests__/filter/percentageCrossed/percentageCrossedFilter.data.json +5 -0
- package/__tests__/filter/percentageCrossed/percentageCrossedFilter.rules.json +3 -0
- package/__tests__/filter/percentageCrossed/percentageCrossedFilter.spec.js +62 -0
- package/__tests__/filter/speed/speedFilter.data.json +5 -0
- package/__tests__/filter/speed/speedFilter.rules.json +3 -0
- package/__tests__/filter/speed/speedFilter.spec.js +73 -0
- package/__tests__/filter/timeOfDayRange/timeOfDayRange.data.json +5 -0
- package/__tests__/filter/timeOfDayRange/timeOfDayRange.rules.json +3 -0
- package/__tests__/filter/timeOfDayRange/timeOfDayRange.spec.js +73 -0
- package/__tests__/geofeature/beacon/beacon.data.json +12 -0
- package/__tests__/geofeature/beacon/beacon.rules.json +13 -0
- package/__tests__/geofeature/beacon/beacon.spec.js +95 -0
- package/__tests__/geofeature/boundingBox/boundingBox.data.json +12 -0
- package/__tests__/geofeature/boundingBox/boundingBox.rules.json +3 -0
- package/__tests__/geofeature/boundingBox/boundingBox.spec.js +61 -0
- package/__tests__/geofeature/circle/circle.data.json +9 -0
- package/__tests__/geofeature/circle/circle.rules.json +3 -0
- package/__tests__/geofeature/circle/circle.spec.js +62 -0
- package/__tests__/geofeature/polygon/polygon.data.json +46 -0
- package/__tests__/geofeature/polygon/polygon.rules.json +3 -0
- package/__tests__/geofeature/polygon/polygon.spec.js +61 -0
- package/__tests__/geofeature/polyline/polyline.data.json +46 -0
- package/__tests__/geofeature/polyline/polyline.rules.json +3 -0
- package/__tests__/geofeature/polyline/polyline.spec.js +61 -0
- package/__tests__/zone/zone.action.spec.js +50 -0
- package/__tests__/zone/zone.data.json +154 -0
- package/__tests__/zone/zone.filter.spec.js +50 -0
- package/__tests__/zone/zone.geofeatures.spec.js +64 -0
- package/__tests__/zone/zone.spec.js +98 -0
- package/models/AdminPortalUser.js +10 -11
- package/models/AdminUser.js +6 -5
- package/models/Application.js +31 -30
- package/models/Beacon.js +102 -32
- package/models/BeaconFilter.js +30 -12
- package/models/BearingFilter.js +56 -17
- package/models/BoundingBox.js +36 -14
- package/models/CalendarDateRangeFilter.js +41 -0
- package/models/Circle.js +37 -19
- package/models/Contract.js +37 -38
- package/models/Customer.js +31 -31
- package/models/CustomerLogin.js +9 -10
- package/models/DBEvent.js +13 -14
- package/models/DailyStats.js +7 -7
- package/models/DeviceRulesRequest.js +27 -28
- package/models/Fence.js +12 -13
- package/models/GeoFence.js +12 -14
- package/models/Geofeature.js +16 -18
- package/models/MessageAction.js +32 -25
- package/models/NotificationLogEntry.js +7 -8
- package/models/POILocation.js +6 -7
- package/models/POILookup.js +8 -9
- package/models/POIResult.js +7 -8
- package/models/PartnerCustomer.js +12 -13
- package/models/PartnerPasswordReset.js +8 -9
- package/models/PartnerUser.js +10 -11
- package/models/Partners.js +11 -12
- package/models/PercentageCrossedFilter.js +30 -16
- package/models/Polygon.js +34 -15
- package/models/Polyline.js +35 -15
- package/models/RuleRequestAggregation.js +14 -17
- package/models/SimpleCheckInZone.js +21 -21
- package/models/SingleUseToken.js +7 -8
- package/models/SpeedFilter.js +43 -16
- package/models/TestDevice.js +11 -12
- package/models/TestDeviceCluster.js +9 -10
- package/models/TestInstance.js +9 -10
- package/models/TestScenario.js +9 -10
- package/models/TimeOfDayRange.js +16 -16
- package/models/TimeOfDayRangeFilter.js +39 -16
- package/models/UrlAction.js +51 -0
- package/models/Zone.js +97 -0
- package/models/ZoneUIState.js +18 -18
- package/package.json +25 -4
- package/schemas/Point.js +13 -0
- package/NodeModels.iml +0 -9
- package/models/ApplicationNotificationAction.js +0 -30
- package/models/ApplicationUsage.js +0 -11
- package/models/ConfigurationParameters.js +0 -20
- package/models/DateRangeFilter.js +0 -20
- package/models/FormattedBeacon.js +0 -16
- package/models/FormattedCircle.js +0 -12
- package/models/FormattedConditions.js +0 -11
- package/models/FormattedDateRange.js +0 -11
- package/models/FormattedPercentageCrossed.js +0 -12
- package/models/FormattedPoint.js +0 -10
- package/models/FormattedPolygon.js +0 -11
- package/models/FormattedPolyline.js +0 -11
- package/models/FormattedRectangle.js +0 -12
- package/models/FormattedTimeActive.js +0 -17
- package/models/FormattedZone.js +0 -28
- package/models/MonthlyStats.js +0 -28
- package/models/Point.js +0 -20
- package/models/PropertyMapping.js +0 -17
- package/models/Reference.js +0 -19
- package/models/SequenceFilter.js +0 -18
- package/models/SoundAction.js +0 -28
- package/models/URLAction.js +0 -31
- package/models/VibrationAction.js +0 -28
- package/models/property.js +0 -25
package/models/MessageAction.js
CHANGED
|
@@ -1,29 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Owner :
|
|
5
|
-
*/
|
|
6
|
-
var mongoose = require('mongoose');
|
|
7
|
-
var StateEnum = require('@bluedot-innovation/enums').StateEnum;
|
|
1
|
+
let mongoose = require('mongoose')
|
|
2
|
+
let StateEnum = require('@bluedot-innovation/enums').StateEnum
|
|
3
|
+
let uuidv4 = require('uuid/v4')
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
lastUpdateTime : {type: Date, default: Date.now},
|
|
20
|
-
state: {type: String, default : StateEnum.active, select: false},
|
|
21
|
-
filters: []
|
|
22
|
-
},
|
|
5
|
+
let schema = {
|
|
6
|
+
guid: {type: String, default: uuidv4},
|
|
7
|
+
title: {type: String, required: [true, 'title is required. ']},
|
|
8
|
+
message: {type: String, required: [true, 'message is required. ']},
|
|
9
|
+
creationTime: {type: Date, default: Date.now},
|
|
10
|
+
lastUpdateTime: {type: Date, default: Date.now},
|
|
11
|
+
state: {type: String, default: StateEnum.active, select: false}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let MessageActionSchema = new mongoose.Schema(schema,
|
|
23
15
|
{
|
|
24
|
-
|
|
16
|
+
_id: false,
|
|
17
|
+
__v: false
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
MessageActionSchema.add({
|
|
21
|
+
type:
|
|
22
|
+
{type: String, required: true}
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
// optional mongoose
|
|
26
|
+
module.exports = (mongooseInstance) => {
|
|
27
|
+
let MessageAction
|
|
28
|
+
if (mongooseInstance) {
|
|
29
|
+
MessageAction = mongooseInstance.model('MessageAction', MessageActionSchema)
|
|
30
|
+
} else {
|
|
31
|
+
MessageAction = mongoose.model('MessageAction', MessageActionSchema)
|
|
25
32
|
}
|
|
26
|
-
);
|
|
27
|
-
var MessageAction = mongoose.model('MessageAction', MessageActionSchema);
|
|
28
33
|
|
|
29
|
-
|
|
34
|
+
return MessageAction
|
|
35
|
+
}
|
|
36
|
+
module.exports.messageActionSchema = schema
|
|
@@ -3,17 +3,16 @@
|
|
|
3
3
|
* Copyright : Bluedot Innovations.
|
|
4
4
|
* Owner :
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
let mongoose = require('mongoose')
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
var NotificationLogEntry = mongoose.model('NotificationLogEntry', new mongoose.Schema(
|
|
8
|
+
let NotificationLogEntry = mongoose.model('NotificationLogEntry', new mongoose.Schema(
|
|
10
9
|
{
|
|
11
10
|
_id: String,
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
'notification.zoneId': String,
|
|
12
|
+
creationTime: {type: Date}
|
|
14
13
|
},
|
|
15
14
|
{
|
|
16
|
-
collection
|
|
15
|
+
collection: 'notificationLogEntry'
|
|
17
16
|
}
|
|
18
|
-
))
|
|
19
|
-
module.exports = NotificationLogEntry
|
|
17
|
+
))
|
|
18
|
+
module.exports = NotificationLogEntry
|
package/models/POILocation.js
CHANGED
|
@@ -3,18 +3,17 @@
|
|
|
3
3
|
* Copyright : Bluedot Innovations.
|
|
4
4
|
* Owner :
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
let mongoose = require('mongoose')
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
let POILocation = mongoose.model('POILocation', new mongoose.Schema(
|
|
9
9
|
{
|
|
10
10
|
type: String,
|
|
11
11
|
properties: {},
|
|
12
12
|
geometryId: String
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
|
-
collection
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
);
|
|
15
|
+
collection: 'poiLocation'
|
|
16
|
+
})
|
|
17
|
+
)
|
|
19
18
|
|
|
20
|
-
module.exports = POILocation
|
|
19
|
+
module.exports = POILocation
|
package/models/POILookup.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Copyright : Bluedot Innovations.
|
|
4
4
|
* Owner :
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
let mongoose = require('mongoose')
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
let POILookup = mongoose.model('POILookup', new mongoose.Schema(
|
|
9
9
|
{
|
|
10
10
|
_id: String,
|
|
11
11
|
customerId: String,
|
|
@@ -17,15 +17,14 @@ var POILookup = mongoose.model('POILookup', new mongoose.Schema(
|
|
|
17
17
|
type: String,
|
|
18
18
|
status: String,
|
|
19
19
|
errorMessage: String,
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
'creationTime': {type: Date, default: Date.now},
|
|
21
|
+
'lastUpdateTime': {type: Date, default: Date.now},
|
|
22
22
|
creditsUsed: {type: Number, default: 0},
|
|
23
23
|
results: []
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
collection
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
);
|
|
26
|
+
collection: 'poiLookup'
|
|
27
|
+
})
|
|
28
|
+
)
|
|
30
29
|
|
|
31
|
-
module.exports = POILookup
|
|
30
|
+
module.exports = POILookup
|
package/models/POIResult.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Created by andrewstirling on 12/4/17.
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
let mongoose = require('mongoose')
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
let POIResult = mongoose.model('POIResult', new mongoose.Schema(
|
|
7
7
|
{
|
|
8
8
|
_id: String,
|
|
9
9
|
lookupId: String,
|
|
10
10
|
page: Number,
|
|
11
|
-
|
|
11
|
+
'lastUpdateTime': {type: Date, default: Date.now},
|
|
12
12
|
results: []
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
|
-
collection
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
);
|
|
15
|
+
collection: 'poiResult'
|
|
16
|
+
})
|
|
17
|
+
)
|
|
19
18
|
|
|
20
|
-
module.exports = POIResult
|
|
19
|
+
module.exports = POIResult
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright : Bluedot Innovations.
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
let mongoose = require('mongoose')
|
|
5
|
+
let StateEnum = require('@bluedot-innovation/enums').StateEnum
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
let PartnerCustomer = mongoose.model('PartnerCustomer', new mongoose.Schema(
|
|
8
8
|
{
|
|
9
|
-
emailAddress: {
|
|
9
|
+
emailAddress: {type: String, unique: true},
|
|
10
10
|
password: String,
|
|
11
11
|
firstName: String,
|
|
12
12
|
lastName: String,
|
|
@@ -20,16 +20,15 @@ var PartnerCustomer = mongoose.model('PartnerCustomer', new mongoose.Schema(
|
|
|
20
20
|
hasDemonstrated: Boolean,
|
|
21
21
|
isUsingGeofencing: Boolean,
|
|
22
22
|
additionalComments: String,
|
|
23
|
-
referredBy:mongoose.Schema.Types.ObjectId,
|
|
24
|
-
state: {type:String, default: StateEnum.active},
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
referredBy: mongoose.Schema.Types.ObjectId,
|
|
24
|
+
state: {type: String, default: StateEnum.active},
|
|
25
|
+
'creationTime': {type: Date, default: Date.now},
|
|
26
|
+
'dataSource': {type: String, select: false, default: 'PartnerPortal'},
|
|
27
27
|
partnerId: String
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
collection
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
);
|
|
30
|
+
collection: 'partnerCustomer'
|
|
31
|
+
})
|
|
32
|
+
)
|
|
34
33
|
|
|
35
|
-
module.exports = PartnerCustomer
|
|
34
|
+
module.exports = PartnerCustomer
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright : Bluedot Innovations.
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
let mongoose = require('mongoose')
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
let PartnerPasswordReset = mongoose.model('PartnerPasswordReset', new mongoose.Schema(
|
|
7
7
|
{
|
|
8
8
|
emailAddress: String,
|
|
9
9
|
partnerUserId: String,
|
|
10
10
|
token: String,
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
'creationTime': {type: Date, default: Date.now},
|
|
12
|
+
'dataSource': {type: String, select: false, default: 'PartnerPortal'}
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
|
-
collection
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
);
|
|
15
|
+
collection: 'partnerPasswordReset'
|
|
16
|
+
})
|
|
17
|
+
)
|
|
19
18
|
|
|
20
|
-
module.exports = PartnerPasswordReset
|
|
19
|
+
module.exports = PartnerPasswordReset
|
package/models/PartnerUser.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright : Bluedot Innovations.
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
let mongoose = require('mongoose')
|
|
5
|
+
let StateEnum = require('@bluedot-innovation/enums').StateEnum
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
let PartnerUser = mongoose.model('PartnerUser', new mongoose.Schema(
|
|
8
8
|
{
|
|
9
9
|
emailAddress: String,
|
|
10
10
|
password: String,
|
|
@@ -16,15 +16,14 @@ var PartnerUser = mongoose.model('PartnerUser', new mongoose.Schema(
|
|
|
16
16
|
approvalToken: String,
|
|
17
17
|
phoneNumber: String,
|
|
18
18
|
partnerCompany: String,
|
|
19
|
-
state: {type:String, default: StateEnum.active},
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
state: {type: String, default: StateEnum.active},
|
|
20
|
+
'creationTime': {type: Date, default: Date.now},
|
|
21
|
+
'dataSource': {type: String, select: false, default: 'PartnerPortal'},
|
|
22
22
|
partnerId: String
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
|
-
collection
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
);
|
|
25
|
+
collection: 'partnerUser'
|
|
26
|
+
})
|
|
27
|
+
)
|
|
29
28
|
|
|
30
|
-
module.exports = PartnerUser
|
|
29
|
+
module.exports = PartnerUser
|
package/models/Partners.js
CHANGED
|
@@ -2,17 +2,16 @@
|
|
|
2
2
|
* Created by Ram on 8/12/2016.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
let mongoose = require('mongoose')
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
);
|
|
7
|
+
let Partners = mongoose.model('Partners', new mongoose.Schema(
|
|
8
|
+
{
|
|
9
|
+
name: String,
|
|
10
|
+
notificationEmail: String
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
collection: 'partners'
|
|
14
|
+
})
|
|
15
|
+
)
|
|
17
16
|
|
|
18
|
-
module.exports = Partners
|
|
17
|
+
module.exports = Partners
|
|
@@ -1,19 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Copyright : Bluedot Innovations.
|
|
4
|
-
* Owner :
|
|
5
|
-
*/
|
|
6
|
-
var mongoose = require('mongoose');
|
|
1
|
+
let mongoose = require('mongoose')
|
|
2
|
+
let uuidv4 = require('uuid/v4')
|
|
7
3
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
let schema = {
|
|
5
|
+
guid: {type: String, default: uuidv4},
|
|
6
|
+
percentage: {type: Number, required: [true, 'percentage is required. '], min: 1, max: 100},
|
|
7
|
+
timeOutSeconds: {type: Number, required: [true, 'timeOutSeconds is required. '], min: 60, max: 86400},
|
|
8
|
+
sequential: {type: Boolean, default: false}
|
|
9
|
+
}
|
|
10
|
+
let PercentageCrossedFilterSchema = new mongoose.Schema(
|
|
11
|
+
schema,
|
|
15
12
|
{
|
|
16
|
-
_id: false
|
|
13
|
+
_id: false,
|
|
14
|
+
versionKey: false
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
PercentageCrossedFilterSchema.add({
|
|
18
|
+
type:
|
|
19
|
+
{type: String, required: true}
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
// optional mongoose
|
|
23
|
+
module.exports = (mongooseInstance) => {
|
|
24
|
+
let PercentageCrossedFilter
|
|
25
|
+
if (mongooseInstance) {
|
|
26
|
+
PercentageCrossedFilter = mongooseInstance.model('PercentageCrossedFilter', PercentageCrossedFilterSchema)
|
|
27
|
+
} else {
|
|
28
|
+
PercentageCrossedFilter = mongoose.model('PercentageCrossedFilter', PercentageCrossedFilterSchema)
|
|
17
29
|
}
|
|
18
|
-
|
|
19
|
-
|
|
30
|
+
|
|
31
|
+
return PercentageCrossedFilter
|
|
32
|
+
}
|
|
33
|
+
module.exports.percentageCrossedFilterSchema = schema
|
package/models/Polygon.js
CHANGED
|
@@ -1,18 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
var mongoose = require('mongoose');
|
|
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')
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const schema = {
|
|
7
|
+
guid: {type: String, default: uuidv4},
|
|
8
|
+
name: {type: String, required: [true, 'name is required. ']},
|
|
9
|
+
vertices: {type: [Point], required: [true, 'vertices is required. ']},
|
|
10
|
+
creationTime: {type: Date, default: Date.now},
|
|
11
|
+
lastUpdateTime: {type: Date, default: Date.now},
|
|
12
|
+
state: {type: String, default: StateEnum.active, select: false}
|
|
13
|
+
}
|
|
14
|
+
const PolygonSchema = new mongoose.Schema(
|
|
15
|
+
schema,
|
|
10
16
|
{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
_id: false,
|
|
18
|
+
versionKey: false
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
PolygonSchema.add({
|
|
22
|
+
type:
|
|
23
|
+
{type: String, required: true}
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
// optional mongoose
|
|
27
|
+
module.exports = (mongooseInstance) => {
|
|
28
|
+
let Polygon
|
|
29
|
+
if (mongooseInstance) {
|
|
30
|
+
Polygon = mongooseInstance.model('Polygon', PolygonSchema)
|
|
31
|
+
} else {
|
|
32
|
+
Polygon = mongoose.model('Polygon', PolygonSchema)
|
|
33
|
+
}
|
|
17
34
|
|
|
18
|
-
|
|
35
|
+
return Polygon
|
|
36
|
+
}
|
|
37
|
+
module.exports.polygonSchema = schema
|
package/models/Polyline.js
CHANGED
|
@@ -1,18 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
var mongoose = require('mongoose');
|
|
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')
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
6
|
+
const schema = {
|
|
7
|
+
guid: {type: String, default: uuidv4},
|
|
8
|
+
name: {type: String, required: [true, 'name is required. ']},
|
|
9
|
+
vertices: {type: [Point], required: [true, 'vertices is required. ']},
|
|
10
|
+
creationTime: {type: Date, default: Date.now},
|
|
11
|
+
lastUpdateTime: {type: Date, default: Date.now},
|
|
12
|
+
state: {type: String, default: StateEnum.active, select: false}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const PolylineSchema = new mongoose.Schema(
|
|
16
|
+
schema,
|
|
14
17
|
{
|
|
15
|
-
_id: false
|
|
16
|
-
|
|
18
|
+
_id: false,
|
|
19
|
+
versionKey: false
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
PolylineSchema.add({
|
|
23
|
+
type:
|
|
24
|
+
{type: String, required: true}
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
// optional mongoose
|
|
28
|
+
module.exports = (mongooseInstance) => {
|
|
29
|
+
let Polyline
|
|
30
|
+
if (mongooseInstance) {
|
|
31
|
+
Polyline = mongooseInstance.model('Polyline', PolylineSchema)
|
|
32
|
+
} else {
|
|
33
|
+
Polyline = mongoose.model('Polyline', PolylineSchema)
|
|
34
|
+
}
|
|
17
35
|
|
|
18
|
-
|
|
36
|
+
return Polyline
|
|
37
|
+
}
|
|
38
|
+
module.exports.polylineSchema = schema
|
|
@@ -3,22 +3,19 @@
|
|
|
3
3
|
* Copyright : Bluedot Innovations.
|
|
4
4
|
* Owner :
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
let mongoose = require('mongoose')
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
)
|
|
22
|
-
);
|
|
8
|
+
let RuleRequestAggregation = mongoose.model('RuleRequestAggregation', new mongoose.Schema(
|
|
9
|
+
{
|
|
10
|
+
_id: String,
|
|
11
|
+
_class: {type: String, default: 'au.com.bluedot.application.model.client.RuleRequestAggregation'},
|
|
12
|
+
creationTime: {type: Date, default: Date.now},
|
|
13
|
+
users: []
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
collection: 'ruleRequestAggregation',
|
|
17
|
+
versionKey: false
|
|
18
|
+
})
|
|
19
|
+
)
|
|
23
20
|
|
|
24
|
-
module.exports = RuleRequestAggregation
|
|
21
|
+
module.exports = RuleRequestAggregation
|
|
@@ -3,27 +3,27 @@
|
|
|
3
3
|
* Copyright : Bluedot Innovations.
|
|
4
4
|
* Owner :
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
let mongoose = require('mongoose')
|
|
7
|
+
let Schema = mongoose.Schema
|
|
8
|
+
let StateEnum = require('@bluedot-innovation/enums').StateEnum
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
let SimpleCheckInZoneSchema = new Schema({
|
|
11
|
+
_id: {type: String},
|
|
12
|
+
name: String,
|
|
13
|
+
description: {type: String, default: ''},
|
|
14
|
+
minimumRetriggerTime: {type: Number},
|
|
15
|
+
checkout: {type: Boolean, default: false},
|
|
16
|
+
dataSource: {type: String, select: false, default: 'openApi'},
|
|
17
|
+
conditionalActions: [],
|
|
18
|
+
spatialFilters: [],
|
|
19
|
+
creationTime: {type: Date, default: Date.now},
|
|
20
|
+
lastUpdateTime: {type: Date, default: Date.now},
|
|
21
|
+
activeTimeRange: Schema.Types.Mixed,
|
|
22
|
+
applicationId: String,
|
|
23
|
+
state: {type: String, default: StateEnum.active, select: false}
|
|
24
|
+
},
|
|
25
|
+
{collection: 'zone'})
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
let SimpleCheckInZone = mongoose.model('SimpleCheckInZone', SimpleCheckInZoneSchema)
|
|
28
28
|
|
|
29
|
-
module.exports = SimpleCheckInZone
|
|
29
|
+
module.exports = SimpleCheckInZone
|
package/models/SingleUseToken.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright : Bluedot Innovations.
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
let mongoose = require('mongoose')
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
let SingleUseToken = mongoose.model('SingleUseToken', new mongoose.Schema(
|
|
7
7
|
{
|
|
8
8
|
tokenString: String,
|
|
9
9
|
customerId: String,
|
|
10
10
|
customerLoginId: String,
|
|
11
|
-
integration: {type:String, default
|
|
11
|
+
integration: {type: String, default: 'admin'},
|
|
12
12
|
expiration: Date
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
|
-
collection
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
);
|
|
15
|
+
collection: 'singleUseToken'
|
|
16
|
+
})
|
|
17
|
+
)
|
|
19
18
|
|
|
20
|
-
module.exports = SingleUseToken
|
|
19
|
+
module.exports = SingleUseToken
|
package/models/SpeedFilter.js
CHANGED
|
@@ -1,19 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Copyright : Bluedot Innovations.
|
|
4
|
-
*/
|
|
1
|
+
let mongoose = require('mongoose')
|
|
2
|
+
let uuidv4 = require('uuid/v4')
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
type : {type: String, default:"speedFilter"}
|
|
14
|
-
},
|
|
4
|
+
let schema = {
|
|
5
|
+
guid: {type: String, default: uuidv4},
|
|
6
|
+
minimumSpeed: {type: Number, required: [true, 'minimumSpeed is required. '], min: 0},
|
|
7
|
+
maximumSpeed: {type: Number, required: true, validate: {validator: validateMaxSpeed, msg: 'default error message'}}
|
|
8
|
+
}
|
|
9
|
+
let SpeedFilterSchema = new mongoose.Schema(
|
|
10
|
+
schema,
|
|
15
11
|
{
|
|
16
|
-
_id: false
|
|
12
|
+
_id: false,
|
|
13
|
+
versionKey: false
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
SpeedFilterSchema.add({
|
|
17
|
+
type:
|
|
18
|
+
{type: String, required: true}
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
function validateMaxSpeed (v, cb) {
|
|
22
|
+
let magicCallback = cb
|
|
23
|
+
let minSpeed = this.minimumSpeed
|
|
24
|
+
let maxSpeed = v
|
|
25
|
+
let speedDifference = maxSpeed - minSpeed
|
|
26
|
+
|
|
27
|
+
if (maxSpeed < 5) {
|
|
28
|
+
magicCallback(false, 'Maximum speed has to be at least 5 km/h')
|
|
29
|
+
} else if (speedDifference < 5) {
|
|
30
|
+
magicCallback(false, 'Maximum speed has to be at least 5 km/h greater than minimum speed')
|
|
17
31
|
}
|
|
18
|
-
)
|
|
19
|
-
|
|
32
|
+
magicCallback(true)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// optional mongoose
|
|
36
|
+
module.exports = (mongooseInstance) => {
|
|
37
|
+
let SpeedFilter
|
|
38
|
+
if (mongooseInstance) {
|
|
39
|
+
SpeedFilter = mongooseInstance.model('SpeedFilter', SpeedFilterSchema)
|
|
40
|
+
} else {
|
|
41
|
+
SpeedFilter = mongoose.model('SpeedFilter', SpeedFilterSchema)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return SpeedFilter
|
|
45
|
+
}
|
|
46
|
+
module.exports.speedFilterSchema = schema
|