Created the schema validation util

This commit is contained in:
2022-12-27 15:01:06 +01:00
parent ca81fe4551
commit 95d8ea4ece

5
server/util/validate.js Normal file
View File

@ -0,0 +1,5 @@
module.exports.validateSchema = (schema, object) => {
const {error} = schema.validate(object, {errors: {wrap: {label: ''}}});
return error ? error.details[0].message : undefined;
}