Included user-information in employee Model.

This commit is contained in:
Sockenklaus
2021-11-04 14:00:13 +01:00
parent 63c1407643
commit 3d2e551a8e
13 changed files with 171 additions and 217 deletions

View File

@@ -38,15 +38,17 @@ export default class CreateEmployeeValidator {
trim: true
}),
shorthand: schema.string({
shorthand: schema.string(
{
trim: true
},
[
},
[
rules.unique({
table: 'employees',
column: 'shorthand',
caseInsensitive: true,
})
]),
]),
email: schema.string.optional({
trim: true
@@ -61,7 +63,40 @@ export default class CreateEmployeeValidator {
mobile: schema.string.optional(),
contractHours: schema.number.optional()
contractHours: schema.number.optional(
[
rules.unsigned(),
rules.range(0, 40)
]
),
role: schema.string(
{
trim: true
}
),
isActive: schema.boolean.optional(),
username: schema.string.optional(
{
trim: true
},
[
rules.unique({
table: 'employees',
column: 'username',
caseInsensitive: true,
})
]
),
password: schema.string.optional(
{},
[
rules.requiredIfExists('username')
]
)
})