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

const authValidator = {
    login: [
        body("email").isEmail().withMessage("Valid email is required"),
        body("password").isLength({ min: 6 }).withMessage("Password must be at least 6 characters long"),
    ],
    logout: [

    ],
    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 = authValidator;