text: import * as Yup from 'yup';
  
  export default async (req, res, next) => {
    try {
      const schema = Yup.object().shape({
        name: Yup.string().required(),
        street: Yup.string().required(),
        street_number: Yup.string().required(),
        complement: Yup.string(),
        neighborhood: Yup.string().required(),
        state: Yup.string().required(),
        city: Yup.string().required(),
        zip_code: Yup.string().required(),
      });
  
      await schema.validate(req.body, { abortEarly: false });
  
      return next();
    } catch (error) {
      return res
        .status(400)
        .json({ error: 'Validation fails', messsages: error.inner });
    }
  };
  