func validateLogin(username, password string) validator.Validator { v := validator.New() v.RequiredString(username, ErrUsernameRequired) v.RequiredString(password, ErrPasswordRequired) return v }
func validateLogin(data *LoginData) validator.Validator { v := validator.New() v.RequiredString(data.Username, ErrUsernameRequired, "username") v.RequiredString(data.Password, ErrPasswordRequired, "password") return v }
func validateChangePassword(req *ChangePasswordRequest) validator.Validator { v := validator.New() v.RequiredString(req.Password, ErrPasswordRequired, "password") v.RequiredString(req.OldPassword, ErrOldPasswordRequired, "old_password") return v }
func validateUpdateUser(req *UpdateUserRequest) validator.Validator { v := validator.New() v.RequiredString(req.Name, ErrNameRequired, "name") v.RequiredString(req.Email, ErrEmailRequired, "email") return v }
func validateChangePassword(id, password, oldPassword string) validator.Validator { v := validator.New() v.RequiredString(id, ErrNameRequired) v.RequiredString(password, ErrPasswordRequired) v.RequiredString(oldPassword, ErrOldPasswordRequired) return v }
func validateUpdate(id, name, email string) validator.Validator { v := validator.New() v.RequiredString(id, ErrNameRequired) v.RequiredString(name, ErrNameRequired) v.RequiredString(email, ErrEmailRequired) return v }
func validateCreate(input *CreateInput) validator.Validator { v := validator.New() v.RequiredString(input.Username, ErrUsernameRequired) v.RequiredString(input.Password, ErrPasswordRequired) v.RequiredString(input.Name, ErrNameRequired) v.RequiredString(input.Email, ErrEmailRequired) v.Email(input.Email, ErrEmailInvalid) return v }
func validateRegister(form *RegisterForm) validator.Validator { v := validator.New() v.RequiredString(form.Username, ErrUsernameRequired) v.RequiredString(form.Password, ErrPasswordRequired) v.RequiredString(form.Name, ErrNameRequired) v.RequiredString(form.Email, ErrEmailRequired) v.Email(form.Email, ErrEmailInvalid) return v }
func validateCreateUser(req *CreateUserRequest) validator.Validator { v := validator.New() v.RequiredString(req.Username, ErrUsernameRequired, "username") v.RequiredString(req.Password, ErrPasswordRequired, "password") v.RequiredString(req.Name, ErrNameRequired, "name") v.RequiredString(req.Email, ErrEmailRequired, "email") v.Email(req.Email, ErrEmailInvalid, "email") return v }
func ValidateRegister(data *RegisterData) validator.Validator { v := validator.New() v.RequiredString(data.Username, ErrUsernameRequired, "username") v.RequiredString(data.Password, ErrPasswordRequired, "password") v.RequiredString(data.ConfirmPassword, ErrConfirmPasswordRequired, "confirm_password") v.Confirm(data.Password, data.ConfirmPassword, ErrPasswordMisMatch, "password") v.RequiredString(data.Name, ErrNameRequired, "name") v.RequiredString(data.Email, ErrEmailRequired, "email") v.Email(data.Email, ErrEmailInvalid, "email") return v }