const { body,param, validationResult } = require("express-validator");

const autoValidator = {
    add: [
        body("quartion").notEmpty().withMessage("quartion empty"),
    ],
    delete: [
        param("id").notEmpty().withMessage("id empty"),
    ],
    error: (req, res, next) => {
        const error = validationResult(req);
        if (!error.isEmpty()) {
            return res.error(error.array().filter((err) => err.msg).map((err) => err.msg).join(', '));
        }
        next();
    }
}
module.exports = autoValidator;