Archived
2

added GET /user route

This commit is contained in:
VLE2FE
2020-04-24 12:25:32 +02:00
parent 8bf408138f
commit a64229d1dc
9 changed files with 385 additions and 33 deletions

View File

@ -33,13 +33,14 @@ export default class UserValidate { // validate input for user
}
static output (data) { // validate output from database for needed properties, strip everything else
return joi.object({
const {value, error} = joi.object({
_id: joi.any(),
name: joi.string(),
email: joi.string(),
level: joi.string(),
location: joi.string(),
device_name: joi.string()
}).validate(data, {stripUnknown: true}).value;
device_name: joi.string().allow('')
}).validate(data, {stripUnknown: true})
return error !== undefined? null : value;
}
}