const Joi = require('joi'); const validate = require('./validate'); const schemaCreateContact = Joi.object({ number: Joi.string().min(8).max(14).required(), }); const schemaUpdateContact = Joi.object({ id: Joi.string().required(), _id: Joi.string().required(), name: Joi.string().min(1).max(30).trim().required(), lastName: Joi.string().min(1).max(30).trim().required(), companionId: Joi.string().min(1).required(), }); module.exports.createContact = (req, _res, next) => { return validate(schemaCreateContact, req.body, next); }; module.exports.updateContact = (req, _res, next) => { return validate(schemaUpdateContact, req.body, next); };