diff --git a/backend/routes/member/create_member.go b/backend/routes/member/create_member.go index 4b59b1e..824735e 100644 --- a/backend/routes/member/create_member.go +++ b/backend/routes/member/create_member.go @@ -65,15 +65,15 @@ func (s *Server) createMember(w http.ResponseWriter, r *http.Request) (err error } if err := validateSlicePtr("name", &cmr.Names); err != nil { - return err + return *err } if err := validateSlicePtr("pronoun", &cmr.Pronouns); err != nil { - return err + return *err } if err := validateSlicePtr("field", &cmr.Fields); err != nil { - return err + return *err } tx, err := s.DB.Begin(ctx) @@ -175,7 +175,7 @@ func validateSlicePtr[T validator](typ string, slice *[]T) *server.APIError { if s := pronouns.Validate(); s != "" { return &server.APIError{ Code: server.ErrBadRequest, - Details: fmt.Sprintf("%s %d: %s", typ, i, s), + Details: fmt.Sprintf("%s %d: %s", typ, i+1, s), } } } diff --git a/backend/routes/member/patch_member.go b/backend/routes/member/patch_member.go index b909a5b..dd5077e 100644 --- a/backend/routes/member/patch_member.go +++ b/backend/routes/member/patch_member.go @@ -115,15 +115,15 @@ func (s *Server) patchMember(w http.ResponseWriter, r *http.Request) error { } if err := validateSlicePtr("name", req.Names); err != nil { - return err + return *err } if err := validateSlicePtr("pronoun", req.Pronouns); err != nil { - return err + return *err } if err := validateSlicePtr("field", req.Fields); err != nil { - return err + return *err } // update avatar diff --git a/backend/routes/user/patch_user.go b/backend/routes/user/patch_user.go index a54b68b..486fc7f 100644 --- a/backend/routes/user/patch_user.go +++ b/backend/routes/user/patch_user.go @@ -89,15 +89,15 @@ func (s *Server) patchUser(w http.ResponseWriter, r *http.Request) error { } if err := validateSlicePtr("name", req.Names); err != nil { - return err + return *err } if err := validateSlicePtr("pronoun", req.Pronouns); err != nil { - return err + return *err } if err := validateSlicePtr("field", req.Fields); err != nil { - return err + return *err } // update avatar @@ -250,7 +250,7 @@ func validateSlicePtr[T validator](typ string, slice *[]T) *server.APIError { if s := pronouns.Validate(); s != "" { return &server.APIError{ Code: server.ErrBadRequest, - Details: fmt.Sprintf("%s %d: %s", typ, i, s), + Details: fmt.Sprintf("%s %d: %s", typ, i+1, s), } } }