@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/TestDevice.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Copyright : Bluedot Innovations.
|
|
4
4
|
* Owner :
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
let mongoose = require('mongoose')
|
|
7
|
+
let StateEnum = require('@bluedot-innovation/enums').StateEnum
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
let TestDevice = mongoose.model('TestDevice', new mongoose.Schema(
|
|
10
10
|
{
|
|
11
11
|
name: String,
|
|
12
12
|
identifier: String,
|
|
@@ -15,21 +15,20 @@ var TestDevice = mongoose.model('TestDevice', new mongoose.Schema(
|
|
|
15
15
|
hostToken: String,
|
|
16
16
|
batteryToken: String,
|
|
17
17
|
model: String,
|
|
18
|
-
trackingDevice: {type: Boolean, default
|
|
19
|
-
creationTime
|
|
20
|
-
lastUpdateTime
|
|
18
|
+
trackingDevice: {type: Boolean, default: false},
|
|
19
|
+
creationTime: {type: Date, default: Date.now},
|
|
20
|
+
lastUpdateTime: {type: Date, default: Date.now},
|
|
21
21
|
serialNumber: String,
|
|
22
22
|
mobileNumber: String,
|
|
23
23
|
deviceType: String,
|
|
24
|
-
state: {type:String, default: StateEnum.active},
|
|
24
|
+
state: {type: String, default: StateEnum.active},
|
|
25
25
|
comments: String,
|
|
26
26
|
imei: String,
|
|
27
27
|
udid: String
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
collection
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
);
|
|
30
|
+
collection: 'testDevice'
|
|
31
|
+
})
|
|
32
|
+
)
|
|
34
33
|
|
|
35
|
-
module.exports = TestDevice
|
|
34
|
+
module.exports = TestDevice
|
|
@@ -3,22 +3,21 @@
|
|
|
3
3
|
* Copyright : Bluedot Innovations.
|
|
4
4
|
* Owner :
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
let mongoose = require('mongoose')
|
|
7
|
+
let StateEnum = require('@bluedot-innovation/enums').StateEnum
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
let TestDeviceCluster = mongoose.model('TestDeviceCluster', new mongoose.Schema(
|
|
10
10
|
{
|
|
11
11
|
name: String,
|
|
12
12
|
devices: [],
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
'creationTime': {type: Date, default: Date.now},
|
|
14
|
+
'lastUpdateTime': {type: Date, default: Date.now},
|
|
15
15
|
comments: String,
|
|
16
16
|
state: {type: String, default: StateEnum.active}
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
collection
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
);
|
|
19
|
+
collection: 'testDeviceCluster'
|
|
20
|
+
})
|
|
21
|
+
)
|
|
23
22
|
|
|
24
|
-
module.exports = TestDeviceCluster
|
|
23
|
+
module.exports = TestDeviceCluster
|
package/models/TestInstance.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Copyright : Bluedot Innovations.
|
|
4
4
|
* Owner :
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
let mongoose = require('mongoose')
|
|
7
|
+
let StateEnum = require('@bluedot-innovation/enums').StateEnum
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
let TestInstance = mongoose.model('TestInstance', new mongoose.Schema(
|
|
10
10
|
{
|
|
11
11
|
name: String,
|
|
12
12
|
scenarioId: String,
|
|
@@ -17,17 +17,16 @@ var TestInstance = mongoose.model('TestInstance', new mongoose.Schema(
|
|
|
17
17
|
duration: Number,
|
|
18
18
|
endPoint: String,
|
|
19
19
|
trackedLocations: {type: Array, default: []},
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
'creationTime': {type: Date, default: Date.now},
|
|
21
|
+
'lastUpdateTime': {type: Date, default: Date.now},
|
|
22
22
|
state: {type: String, default: StateEnum.active},
|
|
23
23
|
comments: String,
|
|
24
24
|
isProduction: Boolean,
|
|
25
25
|
sdkVersion: String
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
|
-
collection
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
);
|
|
28
|
+
collection: 'testInstance'
|
|
29
|
+
})
|
|
30
|
+
)
|
|
32
31
|
|
|
33
|
-
module.exports = TestInstance
|
|
32
|
+
module.exports = TestInstance
|
package/models/TestScenario.js
CHANGED
|
@@ -3,27 +3,26 @@
|
|
|
3
3
|
* Copyright : Bluedot Innovations.
|
|
4
4
|
* Owner :
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
let mongoose = require('mongoose')
|
|
7
|
+
let StateEnum = require('@bluedot-innovation/enums').StateEnum
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
let TestScenario = mongoose.model('TestScenario', new mongoose.Schema(
|
|
10
10
|
{
|
|
11
11
|
name: String,
|
|
12
12
|
apiKey: String,
|
|
13
13
|
customerApiKey: String,
|
|
14
14
|
email: String,
|
|
15
15
|
package: String,
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
'creationTime': {type: Date, default: Date.now},
|
|
17
|
+
'lastUpdateTime': {type: Date, default: Date.now},
|
|
18
18
|
state: {type: String, default: StateEnum.active},
|
|
19
19
|
numberZones: String,
|
|
20
20
|
comments: String,
|
|
21
21
|
environment: String
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
collection
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
);
|
|
24
|
+
collection: 'testScenario'
|
|
25
|
+
})
|
|
26
|
+
)
|
|
28
27
|
|
|
29
|
-
module.exports = TestScenario
|
|
28
|
+
module.exports = TestScenario
|
package/models/TimeOfDayRange.js
CHANGED
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
* Copyright : Bluedot Innovations.
|
|
4
4
|
* Owner :
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
var SchemaTypes = mongoose.Schema.Types;
|
|
6
|
+
let mongoose = require('mongoose')
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
))
|
|
22
|
-
|
|
8
|
+
let TimeOfDayRange = mongoose.model('TimeOfDayRange', mongoose.Schema({
|
|
9
|
+
start: {
|
|
10
|
+
'_class': {type: String, default: 'au.com.bluedot.schedule.model.value.TimeOfDay'},
|
|
11
|
+
hour: Number,
|
|
12
|
+
seconds: Number,
|
|
13
|
+
minute: Number
|
|
14
|
+
},
|
|
15
|
+
interval: Number
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
_id: false
|
|
19
|
+
}
|
|
20
|
+
))
|
|
21
|
+
|
|
22
|
+
module.exports = TimeOfDayRange
|
|
@@ -1,19 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Copyright : Bluedot Innovations.
|
|
4
|
-
* Owner :
|
|
5
|
-
*/
|
|
6
|
-
var mongoose = require('mongoose');
|
|
7
|
-
var SchemaTypes = mongoose.Schema.Types;
|
|
1
|
+
let mongoose = require('mongoose')
|
|
2
|
+
let uuidv4 = require('uuid/v4')
|
|
8
3
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
let schema = {
|
|
5
|
+
guid: {type: String, default: uuidv4},
|
|
6
|
+
fromTime: {type: Number, required: [true, 'time is required. '], min: 0, max: 86400},
|
|
7
|
+
toTime: {type: Number, required: true, min: 0, max: 86400, validate: validateTime}
|
|
8
|
+
}
|
|
9
|
+
let TimeOfDayRangeFilterSchema = new mongoose.Schema(
|
|
10
|
+
schema,
|
|
15
11
|
{
|
|
16
|
-
_id: false
|
|
12
|
+
_id: false,
|
|
13
|
+
versionKey: false
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
TimeOfDayRangeFilterSchema.add({
|
|
17
|
+
type:
|
|
18
|
+
{type: String, required: true}
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
function validateTime (toTime, cb) {
|
|
22
|
+
let magicCallback = cb
|
|
23
|
+
let fromTime = this.fromTime
|
|
24
|
+
|
|
25
|
+
if (fromTime === toTime) {
|
|
26
|
+
return magicCallback(false, 'fromTime and toTime cannot be same')
|
|
17
27
|
}
|
|
18
|
-
)
|
|
19
|
-
|
|
28
|
+
return magicCallback(true)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// optional mongoose
|
|
32
|
+
module.exports = (mongooseInstance) => {
|
|
33
|
+
let TimeOfDayRangeFilter
|
|
34
|
+
if (mongooseInstance) {
|
|
35
|
+
TimeOfDayRangeFilter = mongooseInstance.model('TimeOfDayRangeFilterSchema', TimeOfDayRangeFilterSchema)
|
|
36
|
+
} else {
|
|
37
|
+
TimeOfDayRangeFilter = mongoose.model('TimeOfDayRangeFilterSchema', TimeOfDayRangeFilterSchema)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return TimeOfDayRangeFilter
|
|
41
|
+
}
|
|
42
|
+
module.exports.timeOfDayRangeFilterSchema = schema
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
let mongoose = require('mongoose')
|
|
2
|
+
let StateEnum = require('@bluedot-innovation/enums').StateEnum
|
|
3
|
+
let uuidv4 = require('uuid/v4')
|
|
4
|
+
|
|
5
|
+
let schema = {
|
|
6
|
+
guid: {type: String, default: uuidv4},
|
|
7
|
+
url: {
|
|
8
|
+
type: String,
|
|
9
|
+
required: [true, 'url is required. '],
|
|
10
|
+
validate: {
|
|
11
|
+
validator: validateURL
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
description: {type: String, default: ''},
|
|
15
|
+
creationTime: {type: Date, default: Date.now},
|
|
16
|
+
lastUpdateTime: {type: Date, default: Date.now},
|
|
17
|
+
state: {type: String, default: StateEnum.active, select: false}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let URLActionSchema = new mongoose.Schema(schema,
|
|
21
|
+
{
|
|
22
|
+
_id: false,
|
|
23
|
+
__v: false
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
URLActionSchema.add({
|
|
27
|
+
type:
|
|
28
|
+
{type: String, required: true}
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
function validateURL (url, cb) {
|
|
32
|
+
let magicCallback = cb
|
|
33
|
+
let urlRegex = new RegExp('^(http[s]?:\\/\\/(www\\.)?|ftp:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\.@:%_+~#=]+)+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?')
|
|
34
|
+
if (!urlRegex.test(url)) {
|
|
35
|
+
return magicCallback(false, `${url} is not a valid URL`)
|
|
36
|
+
}
|
|
37
|
+
magicCallback(true)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// optional mongoose
|
|
41
|
+
module.exports = (mongooseInstance) => {
|
|
42
|
+
let Urlaction
|
|
43
|
+
if (mongooseInstance) {
|
|
44
|
+
Urlaction = mongooseInstance.model('Urlaction', URLActionSchema)
|
|
45
|
+
} else {
|
|
46
|
+
Urlaction = mongoose.model('Urlaction', URLActionSchema)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return Urlaction
|
|
50
|
+
}
|
|
51
|
+
module.exports.urlActionSchema = schema
|
package/models/Zone.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by Andrew on 17/10/2017.
|
|
3
|
+
* Copyright : Bluedot Innovations.
|
|
4
|
+
* Owner :
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
let mongoose = require('mongoose')
|
|
8
|
+
let Schema = mongoose.Schema
|
|
9
|
+
let StateEnum = require('@bluedot-innovation/enums').StateEnum
|
|
10
|
+
let messageActionSchema = require('./MessageAction').messageActionSchema
|
|
11
|
+
let urlActionSchema = require('./UrlAction').urlActionSchema
|
|
12
|
+
let circleSchema = require('./Circle').circleSchema
|
|
13
|
+
let boundingBoxSchema = require('./BoundingBox').boundingBoxSchema
|
|
14
|
+
let polylineSchema = require('./Polyline').polylineSchema
|
|
15
|
+
let polygonSchema = require('./Polygon').polygonSchema
|
|
16
|
+
let beaconSchema = require('./Beacon').beaconSchema
|
|
17
|
+
let speedFilterSchema = require('./SpeedFilter').speedFilterSchema
|
|
18
|
+
let bearingFilterSchema = require('./BearingFilter').bearingFilterSchema
|
|
19
|
+
let timeOfDayRangeFilterSchema = require('./TimeOfDayRangeFilter').timeOfDayRangeFilterSchema
|
|
20
|
+
let calendarDateRangeFilterSchema = require('./CalendarDateRangeFilter').calendarDateRangeSchema
|
|
21
|
+
let percentageCrossedFilterSchema = require('./PercentageCrossedFilter').percentageCrossedFilterSchema
|
|
22
|
+
let uuidv4 = require('uuid/v4')
|
|
23
|
+
let patcher = require('mongoose-json-patch')
|
|
24
|
+
|
|
25
|
+
// ////// //
|
|
26
|
+
// Schema //
|
|
27
|
+
// ////// //
|
|
28
|
+
|
|
29
|
+
let actionSchema = new Schema({},
|
|
30
|
+
{ discriminatorKey: 'type', _id: false })
|
|
31
|
+
|
|
32
|
+
let filterSchema = new Schema({},
|
|
33
|
+
{ discriminatorKey: 'type', _id: false })
|
|
34
|
+
|
|
35
|
+
let geofeatureSchema = new Schema({},
|
|
36
|
+
{ discriminatorKey: 'type', _id: false })
|
|
37
|
+
|
|
38
|
+
let ZoneSchema = new Schema({
|
|
39
|
+
_id: {type: String, default: uuidv4},
|
|
40
|
+
name: {type: String, required: [true, 'name is required']},
|
|
41
|
+
minimumRetriggerTime: {
|
|
42
|
+
type: Number,
|
|
43
|
+
required: [true, 'minimumRetriggerTime is required'],
|
|
44
|
+
min: 60,
|
|
45
|
+
max: 3599940,
|
|
46
|
+
validate: {
|
|
47
|
+
validator: Number.isInteger,
|
|
48
|
+
message: '{VALUE} is not a number'
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
filters: {
|
|
52
|
+
type: [filterSchema]
|
|
53
|
+
},
|
|
54
|
+
actions: {
|
|
55
|
+
type: [actionSchema]
|
|
56
|
+
},
|
|
57
|
+
geofeatures: {
|
|
58
|
+
type: [geofeatureSchema],
|
|
59
|
+
required: false
|
|
60
|
+
},
|
|
61
|
+
customData: [{type: Schema.Types.Mixed}],
|
|
62
|
+
description: {type: String, default: ''},
|
|
63
|
+
creationTime: {type: Date, default: Date.now},
|
|
64
|
+
lastUpdateTime: {type: Date, default: Date.now},
|
|
65
|
+
applicationId: {type: String, required: [true, 'applicationId is required']},
|
|
66
|
+
state: {type: String, default: StateEnum.active, select: false}
|
|
67
|
+
}, {collection: 'zone'})
|
|
68
|
+
|
|
69
|
+
// TODO: Test patcher and include for other schemas if required
|
|
70
|
+
ZoneSchema.plugin(patcher)
|
|
71
|
+
|
|
72
|
+
ZoneSchema.path('actions').discriminator('url', new Schema(urlActionSchema))
|
|
73
|
+
ZoneSchema.path('actions').discriminator('message', new Schema(messageActionSchema))
|
|
74
|
+
|
|
75
|
+
ZoneSchema.path('filters').discriminator('bearing', new Schema(bearingFilterSchema))
|
|
76
|
+
ZoneSchema.path('filters').discriminator('calendarDateRange', new Schema(calendarDateRangeFilterSchema))
|
|
77
|
+
ZoneSchema.path('filters').discriminator('percentageCrossed', new Schema(percentageCrossedFilterSchema))
|
|
78
|
+
ZoneSchema.path('filters').discriminator('speed', new Schema(speedFilterSchema))
|
|
79
|
+
ZoneSchema.path('filters').discriminator('timeOfDayRange', new Schema(timeOfDayRangeFilterSchema))
|
|
80
|
+
|
|
81
|
+
ZoneSchema.path('geofeatures').discriminator('circle', new Schema(circleSchema))
|
|
82
|
+
ZoneSchema.path('geofeatures').discriminator('beacon', new Schema(beaconSchema))
|
|
83
|
+
ZoneSchema.path('geofeatures').discriminator('polygon', new Schema(polygonSchema))
|
|
84
|
+
ZoneSchema.path('geofeatures').discriminator('polyline', new Schema(polylineSchema))
|
|
85
|
+
ZoneSchema.path('geofeatures').discriminator('boundingBox', new Schema(boundingBoxSchema))
|
|
86
|
+
|
|
87
|
+
// optional mongoose
|
|
88
|
+
module.exports = (mongooseInstance) => {
|
|
89
|
+
let Zone
|
|
90
|
+
if (mongooseInstance) {
|
|
91
|
+
Zone = mongooseInstance.model('Zone', ZoneSchema)
|
|
92
|
+
} else {
|
|
93
|
+
Zone = mongoose.model('Zone', ZoneSchema)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return Zone
|
|
97
|
+
}
|
package/models/ZoneUIState.js
CHANGED
|
@@ -3,23 +3,23 @@
|
|
|
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
|
-
)
|
|
10
|
+
let ZoneUIStateSchema = new mongoose.Schema({
|
|
11
|
+
_id: {type: String},
|
|
12
|
+
signature: {type: String},
|
|
13
|
+
center: Schema.Types.Mixed,
|
|
14
|
+
dataSource: {type: String, select: false, default: 'openApi'},
|
|
15
|
+
zoom: {type: Number, default: 4},
|
|
16
|
+
lastUpdateTime: {type: Date, default: Date.now},
|
|
17
|
+
creationTime: {type: Date, default: Date.now},
|
|
18
|
+
state: {type: String, default: StateEnum.active, select: false},
|
|
19
|
+
zoneId: String
|
|
20
|
+
},
|
|
21
|
+
{collection: 'zoneUIState'}
|
|
22
|
+
)
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
module.exports = ZoneUIState
|
|
24
|
+
let ZoneUIState = mongoose.model('ZoneUIState', ZoneUIStateSchema)
|
|
25
|
+
module.exports = ZoneUIState
|
package/package.json
CHANGED
|
@@ -1,15 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bluedot-innovation/models",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "Models.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"
|
|
7
|
+
"lint": "./node_modules/.bin/eslint -c .eslintrc.js ./models/*.js ./__tests__/**/**/*.js ./schemas/*.js",
|
|
8
|
+
"test": "mocha __tests__/**/*.spec.js __tests__/**/**/*.spec.js",
|
|
9
|
+
"test:coverage": "nyc mocha __tests__/**/*.spec.js __tests__/**/**/*.spec.js",
|
|
10
|
+
"test:coverage-check": "nyc check-coverage --lines 90 --functions 90 --branches 70",
|
|
11
|
+
"test:ci": "npm run lint && npm run test:coverage-check && npm test"
|
|
8
12
|
},
|
|
9
13
|
"author": "",
|
|
10
14
|
"license": "UNLICENSED",
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"chai": "^4.1.2",
|
|
17
|
+
"describe": "*",
|
|
18
|
+
"eslint": "^4.12.0",
|
|
19
|
+
"eslint-config-standard": "^10.2.1",
|
|
20
|
+
"eslint-plugin-import": "^2.8.0",
|
|
21
|
+
"eslint-plugin-node": "^5.2.1",
|
|
22
|
+
"eslint-plugin-promise": "^3.6.0",
|
|
23
|
+
"eslint-plugin-standard": "^3.0.1",
|
|
24
|
+
"mocha": "^4.0.1",
|
|
25
|
+
"mockgoose": "^7.3.3",
|
|
26
|
+
"nyc": "^11.3.0",
|
|
27
|
+
"sinon": "^4.1.2"
|
|
28
|
+
},
|
|
11
29
|
"dependencies": {
|
|
12
|
-
"
|
|
13
|
-
"
|
|
30
|
+
"@bluedot-innovation/enums": "*",
|
|
31
|
+
"mongoose": "^4.13.6",
|
|
32
|
+
"mongoose-error-helper": "0.0.2",
|
|
33
|
+
"mongoose-json-patch": "^1.1.1",
|
|
34
|
+
"uuid": "^3.1.0"
|
|
14
35
|
}
|
|
15
36
|
}
|
package/schemas/Point.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
let mongoose = require('mongoose')
|
|
2
|
+
|
|
3
|
+
let PointSchema = new mongoose.Schema({
|
|
4
|
+
type: {type: String},
|
|
5
|
+
latitude: {type: Number, required: [true, 'latitude is required. '], min: -90, max: 90},
|
|
6
|
+
longitude: {type: Number, required: [true, 'longitude is required. '], min: -180, max: 180}
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
_id: false,
|
|
10
|
+
__v: false
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
module.exports = PointSchema
|
package/NodeModels.iml
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
-
<exclude-output />
|
|
5
|
-
<content url="file://$MODULE_DIR$" />
|
|
6
|
-
<orderEntry type="inheritedJdk" />
|
|
7
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
|
-
</component>
|
|
9
|
-
</module>
|
|
@@ -1,30 +0,0 @@
|
|
|
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;
|
|
@@ -1,11 +0,0 @@
|
|
|
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;
|
|
@@ -1,20 +0,0 @@
|
|
|
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;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Arun on 30/09/2014.
|
|
3
|
-
* Copyright : Bluedot Innovations.
|
|
4
|
-
* Owner :
|
|
5
|
-
*/
|
|
6
|
-
var mongoose = require('mongoose');
|
|
7
|
-
var SchemaTypes = mongoose.Schema.Types;
|
|
8
|
-
|
|
9
|
-
var DateRangeFilter = mongoose.model('DateRangeFilter', mongoose.Schema({
|
|
10
|
-
guid: {type: String},
|
|
11
|
-
_class : {type: String, default:"au.com.bluedot.application.spring.filter.action.DateRangeFilter"},
|
|
12
|
-
startDate: {type: String},
|
|
13
|
-
endDate: {type: String},
|
|
14
|
-
type : {type: String, default:"dateRangeFilter"},
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
_id: false
|
|
18
|
-
}
|
|
19
|
-
));
|
|
20
|
-
module.exports = DateRangeFilter;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Arun on 10/09/2014.
|
|
3
|
-
* Copyright : Bluedot Innovations.
|
|
4
|
-
* Owner :
|
|
5
|
-
*/
|
|
6
|
-
var FormattedBeacon = function () {
|
|
7
|
-
this.beaconId = null;
|
|
8
|
-
this.name = null;
|
|
9
|
-
this.proximityUUID = null;
|
|
10
|
-
this.longitude = null;
|
|
11
|
-
this.latitude = null;
|
|
12
|
-
this.major = null;
|
|
13
|
-
this.minor = null;
|
|
14
|
-
this.macAddress = null;
|
|
15
|
-
};
|
|
16
|
-
module.exports = FormattedBeacon;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Arun on 10/09/2014.
|
|
3
|
-
* Copyright : Bluedot Innovations.
|
|
4
|
-
* Owner :
|
|
5
|
-
*/
|
|
6
|
-
var FormattedCircle = function () {
|
|
7
|
-
this.name = null;
|
|
8
|
-
this.color = null;
|
|
9
|
-
this.radius = null;
|
|
10
|
-
this.center = null;
|
|
11
|
-
};
|
|
12
|
-
module.exports = FormattedCircle;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Arun on 10/09/2014.
|
|
3
|
-
* Copyright : Bluedot Innovations.
|
|
4
|
-
* Owner :
|
|
5
|
-
*/
|
|
6
|
-
var FormattedConditions = function () {
|
|
7
|
-
this.percentageCrossed = [];
|
|
8
|
-
this.dateRange = [];
|
|
9
|
-
this.timeActive = [];
|
|
10
|
-
};
|
|
11
|
-
module.exports = FormattedConditions;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Arun on 10/09/2014.
|
|
3
|
-
* Copyright : Bluedot Innovations.
|
|
4
|
-
* Owner :
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var FormattedPercentageCrossed = function (id, percentage, timeout) {
|
|
8
|
-
this.conditionId = id;
|
|
9
|
-
this.percentage = percentage;
|
|
10
|
-
this.timeoutPeriod = timeout;
|
|
11
|
-
};
|
|
12
|
-
module.exports = FormattedPercentageCrossed;
|