Skip to content

Commit

Permalink
Fix validation in submit_form endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaptoss committed Jul 10, 2024
1 parent 26b05a8 commit 510ca4b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/service/requests/submit_form.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ func NewSubmitForm(r *http.Request) (req resources.SubmitFormRequest, err error)

errs := validation.Errors{
"data/type": validation.Validate(req.Data.Type, validation.Required, validation.In(resources.SUBMIT_FORM)),
"data/attributes/name": validation.Validate(req.Data.Attributes.Name, validation.Required, is.Alpha),
"data/attributes/surname": validation.Validate(req.Data.Attributes.Surname, validation.Required, is.Alpha),
"data/attributes/name": validation.Validate(req.Data.Attributes.Name, validation.Required),
"data/attributes/surname": validation.Validate(req.Data.Attributes.Surname, validation.Required),
"data/attributes/id_num": validation.Validate(req.Data.Attributes.IdNum, validation.Required, is.Digit),
"data/attributes/birthday": validation.Validate(req.Data.Attributes.Birthday, validation.Required, validation.Date("01-02-2006")),
"data/attributes/citizen": validation.Validate(req.Data.Attributes.Citizen, validation.Required, is.Alpha),
"data/attributes/citizen": validation.Validate(req.Data.Attributes.Citizen, validation.Required),
"data/attributes/visited": validation.Validate(req.Data.Attributes.Visited, validation.Required),
"data/attributes/purpose": validation.Validate(req.Data.Attributes.Purpose, validation.Required),
"data/attributes/country": validation.Validate(req.Data.Attributes.Country, validation.Required, is.Alpha),
"data/attributes/city": validation.Validate(req.Data.Attributes.City, validation.Required, is.Alpha),
"data/attributes/country": validation.Validate(req.Data.Attributes.Country, validation.Required),
"data/attributes/city": validation.Validate(req.Data.Attributes.City, validation.Required),
"data/attributes/address": validation.Validate(req.Data.Attributes.Address, validation.Required),
"data/attributes/postal": validation.Validate(req.Data.Attributes.Postal, validation.Required, is.Digit),
"data/attributes/postal": validation.Validate(req.Data.Attributes.Postal, validation.Required, is.Digit, validation.Length(5, 5)),
"data/attributes/phone": validation.Validate(req.Data.Attributes.Phone, validation.Required),
"data/attributes/email": validation.Validate(req.Data.Attributes.Email, validation.Required, is.Email),
"data/attributes/image": validation.Validate(req.Data.Attributes.Image, validation.Required, is.Base64, validation.Length(0, maxImageSize)),
Expand Down

0 comments on commit 510ca4b

Please sign in to comment.