@bluedot-innovation/models 2.0.0-alpha1 → 2.0.0-beta.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/b3865a46e2cec635045d586cfc79e5c6.json +1 -0
- package/.nyc_output/d9020767349457a911ef2b431e357310.json +1 -0
- package/Models.js +48 -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 +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 +74 -0
- package/__tests__/dailyStats/checkDailyStats.js +31 -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 +62 -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/polygon/polygon.data.json +46 -0
- package/__tests__/geofeature/polygon/polygon.rules.json +3 -0
- package/__tests__/geofeature/polygon/polygon.spec.js +70 -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 +70 -0
- package/__tests__/monthlyStats/monthlyStats.data.json +29 -0
- package/__tests__/monthlyStats/monthlyStats.spec.js +68 -0
- package/__tests__/project/project.data.json +14 -0
- package/__tests__/project/project.rules.json +9 -0
- package/__tests__/project/project.spec.js +81 -0
- package/__tests__/ruleRequestAggregation/ruleRequestAggregation.data.json +8 -0
- package/__tests__/ruleRequestAggregation/ruleRequestAggregation.spec.js +69 -0
- package/__tests__/user/user.data.js +13 -0
- package/__tests__/user/user.rules.js +8 -0
- package/__tests__/user/user.spec.js +83 -0
- package/__tests__/zone/zone.action.spec.js +50 -0
- package/__tests__/zone/zone.data.json +156 -0
- package/__tests__/zone/zone.filter.spec.js +50 -0
- package/__tests__/zone/zone.geofeatures.spec.js +74 -0
- package/__tests__/zone/zone.spec.js +107 -0
- package/helpers.js +14 -0
- package/models/Account.js +49 -0
- package/models/AdminPortalUser.js +10 -11
- package/models/Beacon.js +92 -78
- package/models/BeaconFilter.js +28 -12
- package/models/BearingFilter.js +46 -23
- package/models/BoundingBox.js +37 -20
- package/models/CalendarDateRangeFilter.js +34 -19
- package/models/Circle.js +34 -18
- package/models/Contract.js +37 -38
- package/models/CustomerLogin.js +9 -10
- package/models/DBEvent.js +13 -14
- package/models/DailyStats.js +28 -0
- 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 +31 -16
- package/models/MonthlyStats.js +44 -0
- 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 -15
- package/models/Polygon.js +35 -19
- package/models/Polyline.js +35 -19
- package/models/Project.js +54 -0
- package/models/RuleRequestAggregation.js +33 -15
- package/models/SimpleCheckInZone.js +21 -21
- package/models/SingleUseToken.js +7 -8
- package/models/SpeedFilter.js +39 -19
- 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 +36 -18
- package/models/UrlAction.js +54 -0
- package/models/User.js +59 -0
- package/models/Zone.js +85 -273
- package/models/ZoneUIState.js +18 -18
- package/package.json +20 -8
- package/schemas/Point.js +10 -13
- package/schemas/Webhook.js +22 -0
- package/yarn.lock +2796 -0
- package/__tests__/zone/checkActions.js +0 -64
- package/__tests__/zone/checkAppId.js +0 -41
- package/__tests__/zone/checkBeacon.js +0 -46
- package/__tests__/zone/checkBearingFitler.js +0 -48
- package/__tests__/zone/checkBoundingBox.js +0 -44
- package/__tests__/zone/checkCalendarDateRangeFilterFitler.js +0 -48
- package/__tests__/zone/checkCircle.js +0 -41
- package/__tests__/zone/checkMRT.js +0 -46
- package/__tests__/zone/checkPercentageCrossedFitler.js +0 -48
- package/__tests__/zone/checkPolygon.js +0 -78
- package/__tests__/zone/checkPolyline.js +0 -78
- package/__tests__/zone/checkSpeedFitler.js +0 -48
- package/__tests__/zone/checkTimeOfDayRangeFitler.js +0 -48
- package/models/AdminUser.js +0 -10
- package/models/Application.js +0 -38
- package/models/Customer.js +0 -38
- package/models/URLAction.js +0 -34
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by Daniel on 23/11/2017.
|
|
3
|
+
* Copyright : Bluedot Innovations.
|
|
4
|
+
* Owner :
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const mongoose = require('mongoose')
|
|
8
|
+
const Schema = mongoose.Schema
|
|
9
|
+
const uuidv4 = require('uuid/v4')
|
|
10
|
+
|
|
11
|
+
const DailyStats = mongoose.model(
|
|
12
|
+
'DailyStats',
|
|
13
|
+
new Schema(
|
|
14
|
+
{
|
|
15
|
+
_id: {type: String, default: uuidv4},
|
|
16
|
+
totalEndUsers: Number,
|
|
17
|
+
totalIos: Number,
|
|
18
|
+
totalAndroid: Number,
|
|
19
|
+
creationDate: {type: Date, default: Date.now}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
collection: 'dailyStats',
|
|
23
|
+
versionKey: false
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
module.exports = DailyStats
|
|
@@ -3,35 +3,34 @@
|
|
|
3
3
|
* Copyright : Bluedot Innovations.
|
|
4
4
|
* Owner :
|
|
5
5
|
*/
|
|
6
|
-
var mongoose = require('mongoose')
|
|
6
|
+
var mongoose = require('mongoose')
|
|
7
7
|
|
|
8
8
|
var DeviceRulesRequest = mongoose.model('DeviceRulesRequest', new mongoose.Schema(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
installationReference : String,
|
|
18
|
-
apiKey : String,
|
|
19
|
-
packageName : String,
|
|
20
|
-
clientEmail : String,
|
|
21
|
-
batteryStatus : String,
|
|
22
|
-
deviceType : String,
|
|
23
|
-
locationMethod : String,
|
|
24
|
-
platform : String,
|
|
25
|
-
sdkVersion : String,
|
|
26
|
-
osVersion : String,
|
|
27
|
-
speed : Number,
|
|
28
|
-
creationTime : { type: Date, default: Date.now },
|
|
29
|
-
lastUpdateTime : { type: Date, default: Date.now }
|
|
9
|
+
{
|
|
10
|
+
_id: String,
|
|
11
|
+
_class: {type: String, default: 'au.com.bluedot.application.model.client.DeviceRulesRequest'},
|
|
12
|
+
currentDeviceLocation: {
|
|
13
|
+
'longitude': Number,
|
|
14
|
+
'latitude': Number,
|
|
15
|
+
'geometryType': String
|
|
30
16
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
17
|
+
installationReference: String,
|
|
18
|
+
apiKey: String,
|
|
19
|
+
packageName: String,
|
|
20
|
+
clientEmail: String,
|
|
21
|
+
batteryStatus: String,
|
|
22
|
+
deviceType: String,
|
|
23
|
+
locationMethod: String,
|
|
24
|
+
platform: String,
|
|
25
|
+
sdkVersion: String,
|
|
26
|
+
osVersion: String,
|
|
27
|
+
speed: Number,
|
|
28
|
+
creationTime: { type: Date, default: Date.now },
|
|
29
|
+
lastUpdateTime: { type: Date, default: Date.now }
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
collection: 'deviceRulesRequest'
|
|
33
|
+
})
|
|
34
|
+
)
|
|
36
35
|
|
|
37
|
-
module.exports = DeviceRulesRequest
|
|
36
|
+
module.exports = DeviceRulesRequest
|
package/models/Fence.js
CHANGED
|
@@ -3,19 +3,18 @@
|
|
|
3
3
|
* Copyright : Bluedot Innovations.
|
|
4
4
|
* Owner :
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
Schema = mongoose.Schema
|
|
6
|
+
let mongoose = require('mongoose')
|
|
7
|
+
const Schema = mongoose.Schema
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
);
|
|
9
|
+
let FenceSchema = new mongoose.Schema({
|
|
10
|
+
'_id': {type: String},
|
|
11
|
+
'creationTime': {type: Date, default: Date.now},
|
|
12
|
+
'lastUpdateTime': {type: Date, default: Date.now},
|
|
13
|
+
'type': {type: String, default: 'Feature'},
|
|
14
|
+
'dataSource': {type: String, select: false, default: 'openApi'},
|
|
15
|
+
'geometry': {type: Schema.Types.Mixed, default: {}}
|
|
16
|
+
})
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
let Fence = mongoose.model('Fence', FenceSchema)
|
|
20
19
|
|
|
21
|
-
module.exports = Fence
|
|
20
|
+
module.exports = Fence
|
package/models/GeoFence.js
CHANGED
|
@@ -3,21 +3,19 @@
|
|
|
3
3
|
* Copyright : Bluedot Innovations.
|
|
4
4
|
* Owner :
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
Schema = mongoose.Schema;
|
|
6
|
+
let mongoose = require('mongoose')
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
"fenceId" : String,
|
|
16
|
-
"fenceName" : String
|
|
8
|
+
let FenceSchema = new mongoose.Schema({
|
|
9
|
+
_id: {type: String},
|
|
10
|
+
'geometry': {
|
|
11
|
+
'type': { type: String, required: true },
|
|
12
|
+
'coordinates': {type: Array, required: true}
|
|
17
13
|
},
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
'fenceId': String,
|
|
15
|
+
'fenceName': String
|
|
16
|
+
},
|
|
17
|
+
{collection: 'GeoFence'})
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
let GeoFence = mongoose.model('GeoFence', FenceSchema)
|
|
22
20
|
|
|
23
|
-
module.exports = GeoFence
|
|
21
|
+
module.exports = GeoFence
|
package/models/Geofeature.js
CHANGED
|
@@ -3,24 +3,22 @@
|
|
|
3
3
|
* Copyright : Bluedot Innovations.
|
|
4
4
|
* Owner :
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
let mongoose = require('mongoose')
|
|
7
|
+
let Schema = mongoose.Schema
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
{ collection : 'geofeature' });
|
|
9
|
+
let GeofeatureSchema = new Schema({
|
|
10
|
+
geometry: Schema.Types.Mixed,
|
|
11
|
+
referenceId: String,
|
|
12
|
+
apiKey: String,
|
|
13
|
+
zoneId: String,
|
|
14
|
+
type: String,
|
|
15
|
+
name: String,
|
|
16
|
+
beaconType: String,
|
|
17
|
+
creationTime: {type: Date, default: Date.now},
|
|
18
|
+
lastUpdateTime: {type: Date, default: Date.now}
|
|
19
|
+
},
|
|
20
|
+
{ collection: 'geofeature' })
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
let Geofeature = mongoose.model('Geofeature', GeofeatureSchema)
|
|
25
23
|
|
|
26
|
-
module.exports = Geofeature
|
|
24
|
+
module.exports = Geofeature
|
package/models/MessageAction.js
CHANGED
|
@@ -1,22 +1,37 @@
|
|
|
1
|
-
let mongoose
|
|
2
|
-
let StateEnum
|
|
3
|
-
let
|
|
1
|
+
let mongoose = require('mongoose')
|
|
2
|
+
let StateEnum = require('@bluedot-innovation/enums').StateEnum
|
|
3
|
+
let uuidv4 = require('uuid/v4')
|
|
4
4
|
|
|
5
|
-
let
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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,
|
|
14
15
|
{
|
|
15
16
|
_id: false,
|
|
16
17
|
__v: false
|
|
17
|
-
}
|
|
18
|
-
);
|
|
18
|
+
})
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
MessageActionSchema.add({
|
|
21
|
+
type:
|
|
22
|
+
{type: String, required: true}
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
// optional mongoose
|
|
26
|
+
let model = (mongooseInstance) => {
|
|
27
|
+
let MessageAction
|
|
28
|
+
if (mongooseInstance) {
|
|
29
|
+
MessageAction = mongooseInstance.model('MessageAction', MessageActionSchema)
|
|
30
|
+
} else {
|
|
31
|
+
MessageAction = mongoose.model('MessageAction', MessageActionSchema)
|
|
32
|
+
}
|
|
21
33
|
|
|
22
|
-
|
|
34
|
+
return MessageAction
|
|
35
|
+
}
|
|
36
|
+
// Exports Mongoose Model, Mongoose Schema, JSON schema (required locally for discriminators)
|
|
37
|
+
module.exports = { Model: model, Schema: MessageActionSchema, messageActionSchema: schema }
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by Daniel on 08/02/2018.
|
|
3
|
+
* Copyright : Bluedot Innovations.
|
|
4
|
+
* Owner :
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const mongoose = require('mongoose')
|
|
8
|
+
const uuidv4 = require('uuid/v4')
|
|
9
|
+
const helpers = require('../helpers')
|
|
10
|
+
|
|
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
|
+
}
|
|
29
|
+
)
|
|
30
|
+
|
|
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', MonthlyStats)
|
|
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
|
|
@@ -1,19 +1,34 @@
|
|
|
1
|
-
let mongoose
|
|
2
|
-
let
|
|
1
|
+
let mongoose = require('mongoose')
|
|
2
|
+
let uuidv4 = require('uuid/v4')
|
|
3
3
|
|
|
4
|
-
let
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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,
|
|
11
12
|
{
|
|
12
|
-
_id
|
|
13
|
-
versionKey
|
|
14
|
-
}
|
|
15
|
-
|
|
13
|
+
_id: false,
|
|
14
|
+
versionKey: false
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
PercentageCrossedFilterSchema.add({
|
|
18
|
+
type:
|
|
19
|
+
{type: String, required: true}
|
|
20
|
+
})
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
// optional mongoose
|
|
23
|
+
let model = (mongooseInstance) => {
|
|
24
|
+
let PercentageCrossedFilter
|
|
25
|
+
if (mongooseInstance) {
|
|
26
|
+
PercentageCrossedFilter = mongooseInstance.model('PercentageCrossedFilter', PercentageCrossedFilterSchema)
|
|
27
|
+
} else {
|
|
28
|
+
PercentageCrossedFilter = mongoose.model('PercentageCrossedFilter', PercentageCrossedFilterSchema)
|
|
29
|
+
}
|
|
18
30
|
|
|
19
|
-
|
|
31
|
+
return PercentageCrossedFilter
|
|
32
|
+
}
|
|
33
|
+
// Exports Mongoose Model, Mongoose Schema, JSON schema (required locally for discriminators)
|
|
34
|
+
module.exports = { Model: model, Schema: PercentageCrossedFilterSchema, percentageCrossedFilterSchema: schema }
|