From c197b1425bbd689e8f662846de0478aff8d38f35 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sun, 11 Jun 2023 02:04:36 -0400 Subject: [PATCH] fix: register request validation --- controller/request/register.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/controller/request/register.go b/controller/request/register.go index 9e3fe4f..17831ab 100644 --- a/controller/request/register.go +++ b/controller/request/register.go @@ -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) +}