MicroHack-Registrations-RestAPI / src / services / registration / registration.validator.ts
registration.validator.ts
Raw
import { body } from "express-validator";
  
export const registrationValidators = [
    body("firstName")
        .isLength({ min: 2 })
        .withMessage("First name must be at least 2 characters long"),
    body("lastName")
        .isLength({ min: 2 })
        .withMessage("Last name must be at least 2 characters long"),
    body("email").isEmail().withMessage("Invalid email"),
    body("phone").notEmpty().withMessage("Phone number is required"),
    body("profession").notEmpty().withMessage("Profession is required"),
    body("skills")
        .isArray({ min: 1 })
        .withMessage("At least one skill is required"),
    body("participatedQuest")
        .notEmpty()
        .withMessage("Participated Quest is required"),
    body("availableQuest")
        .notEmpty()
        .withMessage("Available Quest is required"),
    body("motivationQuest")
        .notEmpty()
        .withMessage("Motivation Quest is required"),
    body("teamname").notEmpty().withMessage("Team name is required"), 
    ];