@bluedot-innovation/models 4.0.0 → 5.0.1
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 +42 -0
- package/.gitlab-ci.yml +44 -0
- package/CHANGELOG.md +156 -0
- package/Models.js +55 -10
- package/README.MD +36 -0
- package/__tests__/account/account.data.json +12 -0
- package/__tests__/account/account.rules.js +8 -0
- package/__tests__/account/account.spec.js +83 -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 +73 -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 +74 -0
- package/__tests__/beacon/beacon.data.json +15 -0
- package/__tests__/beacon/beacon.rules.json +13 -0
- package/__tests__/beacon/beacon.spec.js +104 -0
- package/__tests__/condition/beacon/beaconFilter.data.json +1 -0
- package/__tests__/condition/beacon/beaconFilter.rules.json +3 -0
- package/__tests__/condition/beacon/beaconFilter.spec.js +1 -0
- package/__tests__/condition/dayRange/dayRange.data.json +5 -0
- package/__tests__/condition/dayRange/dayRange.rules.json +3 -0
- package/__tests__/condition/dayRange/dayRange.spec.js +95 -0
- package/__tests__/condition/percentageCrossed/travelPath.data.json +5 -0
- package/__tests__/condition/percentageCrossed/travelPath.rules.json +3 -0
- package/__tests__/condition/percentageCrossed/travelPath.spec.js +72 -0
- package/__tests__/condition/speed/speed.data.json +5 -0
- package/__tests__/condition/speed/speed.rules.json +3 -0
- package/__tests__/condition/speed/speed.spec.js +92 -0
- package/__tests__/condition/timeActive/timeActive.data.json +5 -0
- package/__tests__/condition/timeActive/timeActive.rules.json +14 -0
- package/__tests__/condition/timeActive/timeActive.spec.js +103 -0
- package/__tests__/condition/travelDirection/travelDirection.data.json +5 -0
- package/__tests__/condition/travelDirection/travelDirection.rules.json +3 -0
- package/__tests__/condition/travelDirection/travelDirection.spec.js +141 -0
- package/__tests__/dailyStats/checkDailyStats.js +31 -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 +87 -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 +71 -0
- package/__tests__/geofeature/geoline/geoline.data.json +46 -0
- package/__tests__/geofeature/geoline/geoline.rules.json +3 -0
- package/__tests__/geofeature/geoline/geoline.spec.js +70 -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 +132 -0
- package/__tests__/geofeature/zoneBeacon/zoneBeacon.data.json +16 -0
- package/__tests__/geofeature/zoneBeacon/zoneBeacon.rules.json +13 -0
- package/__tests__/geofeature/zoneBeacon/zoneBeacon.spec.js +71 -0
- package/__tests__/monthlyStats/monthlyStats.data.json +29 -0
- package/__tests__/monthlyStats/monthlyStats.spec.js +75 -0
- package/__tests__/project/project.data.json +18 -0
- package/__tests__/project/project.remote.config.json +122 -0
- package/__tests__/project/project.rules.json +9 -0
- package/__tests__/project/project.spec.js +100 -0
- package/__tests__/ruleRequestAggregation/ruleRequestAggregation.data.json +8 -0
- package/__tests__/ruleRequestAggregation/ruleRequestAggregation.spec.js +78 -0
- package/__tests__/setup.js +7 -0
- package/__tests__/user/user.data.js +19 -0
- package/__tests__/user/user.rules.js +8 -0
- package/__tests__/user/user.spec.js +130 -0
- package/__tests__/utils/utils.spec.js +26 -0
- package/__tests__/zone/zone.action.spec.js +50 -0
- package/__tests__/zone/zone.condition.spec.js +94 -0
- package/__tests__/zone/zone.data.json +157 -0
- package/__tests__/zone/zone.geofeatures.spec.js +75 -0
- package/__tests__/zone/zone.spec.js +140 -0
- package/constants/errorMessages.js +2 -0
- package/helpers.js +117 -0
- package/models/Account.js +50 -0
- package/models/AdminPortalUser.js +10 -11
- package/models/Beacon.js +84 -32
- package/models/Contract.js +37 -38
- 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/MessageAction.js +26 -26
- package/models/MonthlyStats.js +35 -19
- 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/Project.js +63 -0
- package/models/RuleRequestAggregation.js +33 -17
- package/models/SingleUseToken.js +7 -8
- 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/UrlAction.js +37 -0
- package/models/User.js +61 -0
- package/models/Zone.js +126 -0
- package/models/ZoneUIState.js +18 -18
- package/models/conditions/DayRange.js +44 -0
- package/models/conditions/Speed.js +42 -0
- package/models/conditions/TimeActive.js +50 -0
- package/models/conditions/TravelDirection.js +59 -0
- package/models/conditions/TravelPath.js +36 -0
- package/models/geofeatures/BoundingBox.js +44 -0
- package/models/geofeatures/Circle.js +39 -0
- package/models/geofeatures/Geoline.js +34 -0
- package/models/geofeatures/Polygon.js +45 -0
- package/models/geofeatures/ZoneBeacon.js +28 -0
- package/package.json +30 -6
- package/schemas/AccuracySuppression.js +14 -0
- package/schemas/AndroidConfig.js +35 -0
- package/schemas/IosConfig.js +38 -0
- package/schemas/MultiLineStringGeometry.js +14 -0
- package/schemas/Point.js +13 -0
- package/schemas/PointGeometry.js +14 -0
- package/schemas/PolygonGeometry.js +14 -0
- package/schemas/ProjectPermission.js +21 -0
- package/schemas/StarvationDetection.js +11 -0
- package/schemas/Telemetry.js +36 -0
- package/schemas/Webhook.js +22 -0
- package/utils/index.js +39 -0
- package/utils/validators.js +6 -0
- package/validators/checkDistanceBetweenVertices.js +21 -0
- package/yarn.lock +2796 -0
- package/models/AdminUser.js +0 -10
- package/models/Application.js +0 -38
- package/models/ApplicationNotificationAction.js +0 -30
- package/models/ApplicationUsage.js +0 -11
- package/models/BeaconFilter.js +0 -23
- package/models/BearingFilter.js +0 -19
- package/models/BoundingBox.js +0 -17
- package/models/Circle.js +0 -21
- package/models/ConfigurationParameters.js +0 -20
- package/models/Customer.js +0 -38
- package/models/DateRangeFilter.js +0 -20
- package/models/Fence.js +0 -21
- 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/GeoFence.js +0 -23
- package/models/Geofeature.js +0 -26
- package/models/PercentageCrossedFilter.js +0 -19
- package/models/Point.js +0 -20
- package/models/Polygon.js +0 -18
- package/models/Polyline.js +0 -18
- package/models/PropertyMapping.js +0 -17
- package/models/Reference.js +0 -19
- package/models/SequenceFilter.js +0 -18
- package/models/SimpleCheckInZone.js +0 -29
- package/models/SoundAction.js +0 -28
- package/models/SpeedFilter.js +0 -19
- package/models/TimeOfDayRangeFilter.js +0 -19
- package/models/URLAction.js +0 -31
- package/models/VibrationAction.js +0 -28
- package/models/property.js +0 -25
- package/package-lock.json.bak +0 -170
package/models/MonthlyStats.js
CHANGED
|
@@ -4,25 +4,41 @@
|
|
|
4
4
|
* Owner :
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
const mongoose = require('mongoose')
|
|
8
|
-
|
|
7
|
+
const mongoose = require('mongoose')
|
|
8
|
+
const uuidv4 = require('uuid/v4')
|
|
9
|
+
const helpers = require('../helpers')
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
const schema = {
|
|
12
|
+
_id: { type: String, default: uuidv4 },
|
|
13
|
+
customerId: {type: String, required: [true, 'customerId is required'], validate: {isAsync: false, validator: helpers.validateUUIDv4, msg: 'invalid customerId'}},
|
|
14
|
+
totalMonthlyUsers: {type: Number, required: [true, 'totalMonthlyUsers is required'], min: 0},
|
|
15
|
+
applications: [{
|
|
16
|
+
applicationId: {type: String, required: [true, 'applicationId is required'], validate: {isAsync: false, validator: helpers.validateUUIDv4, msg: 'invalid applicationId'}},
|
|
17
|
+
monthlyUsers: {type: Number, required: [true, 'monthlyUsers is required'], min: 0}
|
|
18
|
+
}],
|
|
19
|
+
countMonth: { type: Date, default: Date.now },
|
|
20
|
+
creationDate: { type: Date, default: Date.now }
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const MonthlyStatsSchema = new mongoose.Schema(
|
|
24
|
+
schema,
|
|
25
|
+
{
|
|
26
|
+
collection: 'monthlyStats',
|
|
27
|
+
versionKey: false
|
|
28
|
+
}
|
|
26
29
|
)
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
// optional mongoose
|
|
32
|
+
let model = (mongooseInstance) => {
|
|
33
|
+
let MonthlyStats
|
|
34
|
+
if (mongooseInstance) {
|
|
35
|
+
MonthlyStats = mongooseInstance.model('MonthlyStat', MonthlyStatsSchema)
|
|
36
|
+
} else {
|
|
37
|
+
MonthlyStats = mongoose.model('MonthlyStat', MonthlyStatsSchema)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return MonthlyStats
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Exports Mongoose Model, Mongoose Schema, JSON schema (required locally for discriminators)
|
|
44
|
+
module.exports = { Model: model, Schema: MonthlyStatsSchema }
|
|
@@ -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
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by Ryan W. Kan on 14/02/2018.
|
|
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 uuidv4 = require('uuid/v4')
|
|
11
|
+
let patcher = require('mongoose-json-patch')
|
|
12
|
+
let helpers = require('../helpers')
|
|
13
|
+
|
|
14
|
+
let WebhookSchema = require('../schemas/Webhook')
|
|
15
|
+
let iosConfig = require('../schemas/IosConfig')
|
|
16
|
+
let androidConfig = require('../schemas/AndroidConfig')
|
|
17
|
+
|
|
18
|
+
let ProjectSchema = new mongoose.Schema({
|
|
19
|
+
_id: {type: String, default: uuidv4},
|
|
20
|
+
nextRuleUpdateInterval: {
|
|
21
|
+
type: Number,
|
|
22
|
+
required: [true, 'nextRuleUpdateInterval is required'],
|
|
23
|
+
min: 5,
|
|
24
|
+
max: 172800,
|
|
25
|
+
validate: {
|
|
26
|
+
validator: Number.isInteger,
|
|
27
|
+
message: '{VALUE} is not a number'
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
creationTime: {type: Date, default: Date.now},
|
|
31
|
+
lastUpdateTime: {type: Date, default: Date.now},
|
|
32
|
+
lastSyncTime: {type: Date, default: Date.now},
|
|
33
|
+
name: {type: String, required: [true, 'name is required']},
|
|
34
|
+
accountId: {type: String, required: true, validate: {isAsync: false, validator: helpers.validateUUIDv4, msg: 'default error message'}},
|
|
35
|
+
webhooks: [WebhookSchema],
|
|
36
|
+
configurationParameters: {
|
|
37
|
+
paymentGatewayPrivateKey: {type: String, required: false},
|
|
38
|
+
creationTime: {type: Date, required: true, default: Date.now()},
|
|
39
|
+
lastUpdateTime: {type: Date, default: Date.now()},
|
|
40
|
+
iosConfig: iosConfig, // when we want to enable this {type: iosConfig, required: true}
|
|
41
|
+
androidConfig: androidConfig, // when we want to enable this {type: androidConfig, required: true}
|
|
42
|
+
}, // http://collab.bluedot.io/display/PD/Remote+configuration => https://bluedotinnovation.atlassian.net/wiki/spaces/ENG/pages/223150126/Remote+Config+details
|
|
43
|
+
firebaseApiKey: {type: String},
|
|
44
|
+
apiKey: {type: String}
|
|
45
|
+
},
|
|
46
|
+
{collection: 'project'})
|
|
47
|
+
|
|
48
|
+
ProjectSchema.plugin(patcher)
|
|
49
|
+
|
|
50
|
+
// optional mongoose
|
|
51
|
+
let model = (mongooseInstance) => {
|
|
52
|
+
let Project
|
|
53
|
+
if (mongooseInstance) {
|
|
54
|
+
Project = mongooseInstance.model('Project', ProjectSchema)
|
|
55
|
+
} else {
|
|
56
|
+
Project = mongoose.model('Project', ProjectSchema)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return Project
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Exports Mongoose Model, Mongoose Schema, JSON schema (required locally for discriminators)
|
|
63
|
+
module.exports = { Model: model, Schema: ProjectSchema }
|
|
@@ -3,22 +3,38 @@
|
|
|
3
3
|
* Copyright : Bluedot Innovations.
|
|
4
4
|
* Owner :
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
const mongoose = require('mongoose')
|
|
7
|
+
const uuidv4 = require('uuid/v4')
|
|
8
|
+
const helpers = require('../helpers')
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
collection: 'ruleRequestAggregation',
|
|
19
|
-
versionKey: false
|
|
20
|
-
}
|
|
21
|
-
)
|
|
22
|
-
);
|
|
10
|
+
const schema = {
|
|
11
|
+
_id: { type: String, default: uuidv4 },
|
|
12
|
+
applicationId: {type: String, required: [true, 'applicationId is required'], validate: {isAsync: false, validator: helpers.validateUUIDv4, msg: 'invalid applicationId'}},
|
|
13
|
+
customerId: {type: String, required: [true, 'customerId is required'], validate: {isAsync: false, validator: helpers.validateUUIDv4, msg: 'invalid customerId'}},
|
|
14
|
+
iosCount: {type: Number, required: [true, 'iosCount is required'], min: 0},
|
|
15
|
+
androidCount: {type: Number, required: [true, 'androidCount is required'], min: 0},
|
|
16
|
+
creationDate: { type: Date, default: Date.now }
|
|
17
|
+
}
|
|
23
18
|
|
|
24
|
-
|
|
19
|
+
const RuleRequestAggregationSchema = new mongoose.Schema(
|
|
20
|
+
schema,
|
|
21
|
+
{
|
|
22
|
+
collection: 'ruleRequestAggregation',
|
|
23
|
+
versionKey: false
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
// optional mongoose
|
|
28
|
+
let model = (mongooseInstance) => {
|
|
29
|
+
let RuleRequestAggregation
|
|
30
|
+
if (mongooseInstance) {
|
|
31
|
+
RuleRequestAggregation = mongooseInstance.model('RuleRequestAggregation', RuleRequestAggregationSchema)
|
|
32
|
+
} else {
|
|
33
|
+
RuleRequestAggregation = mongoose.model('RuleRequestAggregation', RuleRequestAggregationSchema)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return RuleRequestAggregation
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Exports Mongoose Model, Mongoose Schema, JSON schema (required locally for discriminators)
|
|
40
|
+
module.exports = { Model: model, Schema: RuleRequestAggregationSchema }
|
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/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
|