import { ValidationSchema , registerSchema } from 'class-validator' ; const firstName = [ { type : 'minLength' , constraints : [ 3 ] , message : 'Your firstName must be between 3 and 20 characters' } , { type : 'maxLength' , constraints : [ 20 ] , message : 'Your firstName must be between 3 and 20 characters' } ] ; const lastName = [ { type : 'minLength' , constraints : [ 3 ] , message : 'Your lastName must be between 3 and 20 characters.' } , { type : 'maxLength' , constraints : [ 20 ] , message : 'Your lastName must be between 3 and 20 characters.' } ] ; const email = [ { type : 'isEmail' , constraints : [ { } ] , message : 'Your email is invalid.' } ] ; const password = [ { type : 'minLength' , constraints : [ 1 ] , message : 'Your password must be between 1 and 8 characters.' } , { type : 'maxLength' , constraints : [ 8 ] , message : 'Your password must be between 1 and 8 characters.' } ] ; const createUserValidation = { name : 'createUserRegister' , properties : { firstName , lastName , email , password } } ; const updateUserValidation = { name : 'updateUserRegister' , properties : { firstName , lastName , password } } ; export const loginUserValidation = { name : 'loginUserRegister' , properties : { email , password } } ; registerSchema ( createUserValidation ) ; registerSchema ( updateUserValidation ) ; registerSchema ( loginUserValidation ) ;