@bluedot-innovation/models 2.0.0-beta.15 → 2.0.0-beta.2
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/.gitlab-ci.yml +1 -1
- package/.nyc_output/d08d4085968c722e0d4badb2cb6e7f77.json +1 -0
- package/Models.js +0 -7
- package/__tests__/filter/calendarDateRange/calendarDateRangeFilter.spec.js +1 -1
- package/__tests__/filter/percentageCrossed/percentageCrossedFilter.spec.js +1 -1
- package/__tests__/{beacon → geofeature/beacon}/beacon.data.json +2 -3
- package/__tests__/{beacon → geofeature/beacon}/beacon.spec.js +2 -2
- package/__tests__/geofeature/boundingBox/boundingBox.spec.js +1 -2
- package/__tests__/geofeature/circle/circle.spec.js +1 -1
- package/__tests__/geofeature/polygon/polygon.spec.js +1 -1
- package/__tests__/geofeature/polyline/polyline.spec.js +1 -1
- package/__tests__/monthlyStats/monthlyStats.spec.js +4 -32
- package/__tests__/project/project.data.json +1 -2
- package/__tests__/project/project.rules.json +1 -1
- package/__tests__/project/project.spec.js +2 -2
- package/__tests__/zone/zone.data.json +2 -6
- package/models/AdminUser.js +11 -0
- package/models/Beacon.js +7 -5
- package/models/BoundingBox.js +0 -1
- package/models/Circle.js +0 -1
- package/models/Customer.js +38 -0
- package/models/MonthlyStats.js +3 -7
- package/models/Polygon.js +0 -1
- package/models/Project.js +8 -7
- package/models/RuleRequestAggregation.js +10 -29
- package/models/Zone.js +2 -6
- package/package.json +1 -1
- package/.nyc_output/d9020767349457a911ef2b431e357310.json +0 -1
- package/CHANGELOG.md +0 -9
- package/__tests__/account/account.data.json +0 -12
- package/__tests__/account/account.rules.js +0 -8
- package/__tests__/account/account.spec.js +0 -83
- package/__tests__/ruleRequestAggregation/ruleRequestAggregation.data.json +0 -8
- package/__tests__/ruleRequestAggregation/ruleRequestAggregation.spec.js +0 -69
- package/__tests__/user/user.data.js +0 -13
- package/__tests__/user/user.rules.js +0 -8
- package/__tests__/user/user.spec.js +0 -83
- package/helpers.js +0 -14
- package/models/Account.js +0 -49
- package/models/User.js +0 -59
- package/yarn.lock +0 -2796
- /package/.nyc_output/{b3865a46e2cec635045d586cfc79e5c6.json → d7fc240e95720f6ec07fb83631e1206d.json} +0 -0
- /package/__tests__/{beacon → geofeature/beacon}/beacon.rules.json +0 -0
package/models/Account.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Richard Tan on 27/02/18.
|
|
3
|
-
* Copyright : Bluedot Innovation.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
let mongoose = require('mongoose')
|
|
7
|
-
// let Schema = mongoose.Schema
|
|
8
|
-
let StateEnum = require('@bluedot-innovation/enums').StateEnum
|
|
9
|
-
let uuidv4 = require('uuid/v4')
|
|
10
|
-
let patcher = require('mongoose-json-patch')
|
|
11
|
-
const helpers = require('../helpers')
|
|
12
|
-
|
|
13
|
-
let AccountSchema = new mongoose.Schema({
|
|
14
|
-
_id: {type: String, default: uuidv4},
|
|
15
|
-
name: {type: String, required: true},
|
|
16
|
-
createdBy: {
|
|
17
|
-
// type: Schema.Types.ObjectId,
|
|
18
|
-
type: String,
|
|
19
|
-
validator: helpers.validateUUIDv4,
|
|
20
|
-
required: true,
|
|
21
|
-
// Adding a default to allow the lambdas to pass until we know who
|
|
22
|
-
// the createdBy will be.
|
|
23
|
-
default: uuidv4
|
|
24
|
-
},
|
|
25
|
-
state: {type: String, default: StateEnum.active},
|
|
26
|
-
poiCredits: Number,
|
|
27
|
-
integrations: Object,
|
|
28
|
-
features: Object,
|
|
29
|
-
creationTime: {type: Date, required: [true, 'creationTime is required'], select: false},
|
|
30
|
-
lastUpdateTime: {type: Date, required: [true, 'lastUpdateTime is required'], select: false}
|
|
31
|
-
},
|
|
32
|
-
{collection: 'account'})
|
|
33
|
-
|
|
34
|
-
AccountSchema.plugin(patcher)
|
|
35
|
-
|
|
36
|
-
// optional mongoose
|
|
37
|
-
let model = (mongooseInstance) => {
|
|
38
|
-
let Account
|
|
39
|
-
if (mongooseInstance) {
|
|
40
|
-
Account = mongooseInstance.model('Account', AccountSchema)
|
|
41
|
-
} else {
|
|
42
|
-
Account = mongoose.model('Account', AccountSchema)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return Account
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Exports Mongoose Model, Mongoose Schema, JSON schema (required locally for discriminators)
|
|
49
|
-
module.exports = { Model: model, Schema: AccountSchema }
|
package/models/User.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Richard Tan on 27/02/18.
|
|
3
|
-
* Copyright : Bluedot Innovation.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
let StateEnum = require('@bluedot-innovation/enums').StateEnum
|
|
7
|
-
let mongoose = require('mongoose')
|
|
8
|
-
let patcher = require('mongoose-json-patch')
|
|
9
|
-
const helpers = require('../helpers')
|
|
10
|
-
|
|
11
|
-
let UserSchema = new mongoose.Schema({
|
|
12
|
-
username: {
|
|
13
|
-
type: String,
|
|
14
|
-
required: true,
|
|
15
|
-
maxlength: 100,
|
|
16
|
-
unique: true
|
|
17
|
-
},
|
|
18
|
-
email: {
|
|
19
|
-
type: String,
|
|
20
|
-
required: true,
|
|
21
|
-
validate: {
|
|
22
|
-
validator: helpers.validateEmail,
|
|
23
|
-
message: '{VALUE} is not a valid email'
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
password: {type: String, required: true},
|
|
27
|
-
firstName: {type: String, required: true},
|
|
28
|
-
lastName: {type: String, required: true},
|
|
29
|
-
phoneNumber: {type: String, maxlength: 20},
|
|
30
|
-
state: {type: String, default: StateEnum.active},
|
|
31
|
-
creationTime: {type: Date, default: Date.now},
|
|
32
|
-
lastUpdateTime: {type: Date, default: Date.now},
|
|
33
|
-
isAdmin: {type: Boolean, required: true},
|
|
34
|
-
secret: String,
|
|
35
|
-
projectPermissions: Array,
|
|
36
|
-
accountId: {
|
|
37
|
-
type: String,
|
|
38
|
-
required: true,
|
|
39
|
-
validator: helpers.validateUUIDv4
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
{collection: 'user'})
|
|
43
|
-
|
|
44
|
-
UserSchema.plugin(patcher)
|
|
45
|
-
|
|
46
|
-
// optional mongoose
|
|
47
|
-
let model = (mongooseInstance) => {
|
|
48
|
-
let User
|
|
49
|
-
if (mongooseInstance) {
|
|
50
|
-
User = mongooseInstance.model('User', UserSchema)
|
|
51
|
-
} else {
|
|
52
|
-
User = mongoose.model('User', UserSchema)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return User
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Exports Mongoose Model, Mongoose Schema, JSON schema (required locally for discriminators)
|
|
59
|
-
module.exports = { Model: model, Schema: UserSchema }
|