@bluedot-innovation/models 5.1.3 → 5.1.4
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/CHANGELOG.md +6 -0
- package/__tests__/user/user.rules.js +1 -1
- package/__tests__/user/user.spec.js +0 -11
- package/models/User.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
requiredFields: ['username', 'firstName', 'lastName', 'isAdmin', 'accountId'
|
|
2
|
+
requiredFields: ['username', 'firstName', 'lastName', 'isAdmin', 'accountId'],
|
|
3
3
|
customValidators: [
|
|
4
4
|
{name: 'phoneNumber', invalidInputs: ['409203492039284232034398']},
|
|
5
5
|
{name: 'creationTime', invalidInputs: ['21/07/2017', 'thursday']},
|
|
@@ -116,17 +116,6 @@ describe('User', () => {
|
|
|
116
116
|
})
|
|
117
117
|
})
|
|
118
118
|
|
|
119
|
-
it('should fail if projectPermissions is not provided', (done) => {
|
|
120
|
-
user = JSON.parse(JSON.stringify(user))
|
|
121
|
-
delete user.projectPermissions
|
|
122
|
-
const User = new UserModel(user)
|
|
123
|
-
|
|
124
|
-
User.validate((err, res) => {
|
|
125
|
-
assert.match(err, /(ProjectPermissions is required)/i)
|
|
126
|
-
done()
|
|
127
|
-
})
|
|
128
|
-
})
|
|
129
|
-
|
|
130
119
|
it('should fail if permissionLevel is missing', (done) => {
|
|
131
120
|
user = JSON.parse(JSON.stringify(user))
|
|
132
121
|
user.projectPermissions[0].permissionLevel = undefined
|
package/models/User.js
CHANGED
|
@@ -34,7 +34,7 @@ let UserSchema = new mongoose.Schema({
|
|
|
34
34
|
lastUpdateTime: {type: Date, default: Date.now},
|
|
35
35
|
isAdmin: {type: Boolean, required: true},
|
|
36
36
|
secret: String,
|
|
37
|
-
projectPermissions:
|
|
37
|
+
projectPermissions: [ProjectPermission],
|
|
38
38
|
accountId: {
|
|
39
39
|
type: String,
|
|
40
40
|
required: true,
|
package/package.json
CHANGED