12345678910111213141516171819202122 |
- 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).optional().trim().optional(),
- lastName: Joi.string().min(1).max(30).optional().trim().optional(),
- }).min(2);
- module.exports.createContact = (req, _res, next) => {
- return validate(schemaCreateContact, req.body, next);
- };
- module.exports.updateContact = (req, _res, next) => {
- return validate(schemaUpdateContact, req.body, next);
- };
|