fix: register request validation
This commit is contained in:
parent
c0df04d7d5
commit
c197b1425b
|
@ -7,9 +7,10 @@ import (
|
|||
)
|
||||
|
||||
type RegisterRequest struct {
|
||||
Email string `json:"email"`
|
||||
Password string `json:"password"`
|
||||
Pubkey string `json:"pubkey"`
|
||||
validatable validators.ValidatableImpl
|
||||
Email string `json:"email"`
|
||||
Password string `json:"password"`
|
||||
Pubkey string `json:"pubkey"`
|
||||
}
|
||||
|
||||
func (r RegisterRequest) Validate() error {
|
||||
|
@ -19,3 +20,6 @@ func (r RegisterRequest) Validate() error {
|
|||
validation.Field(&r.Password, validation.When(len(r.Pubkey) == 0, validation.Required)),
|
||||
)
|
||||
}
|
||||
func (r RegisterRequest) Import(d map[string]interface{}) (validators.Validatable, error) {
|
||||
return r.validatable.Import(d, r)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue