fix: register request validation

This commit is contained in:
Derrick Hammer 2023-06-11 02:04:36 -04:00
parent c0df04d7d5
commit c197b1425b
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 7 additions and 3 deletions

View File

@ -7,6 +7,7 @@ import (
)
type RegisterRequest struct {
validatable validators.ValidatableImpl
Email string `json:"email"`
Password string `json:"password"`
Pubkey string `json:"pubkey"`
@ -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)
}