export class RegisterUserDto { private constructor( public readonly name: string, public readonly email: string, public readonly password: string, ) {} static create(props: { [key: string]: any }): [string | undefined, RegisterUserDto?] { const { name, email, password } = props; if (!name) return ['name is required']; if (!email) return ['email is required']; if (!password) return ['password is required']; if (password.length < 6) { return ['password must be at least 6 characters']; } return [undefined, new RegisterUserDto(name, email, password)]; } }