Unverified Commit 9309ff5a authored by Lemon-miaow's avatar Lemon-miaow
Browse files

chore: apply the missed S1016 conversions in handlers_users

The gofmt/staticcheck commit staged handlers_user.go (singular) for the
formatting fix but missed this sibling for its two struct-literal-to-
conversion cleanups.
parent e690b058
Loading
Loading
Loading
Loading
+2 −10
Changes for internal/api/handlers_users.go: 2 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -88,11 +88,7 @@ func (a *API) handleCreateUser(w http.ResponseWriter, r *http.Request) {
		return
	}

	u, err := a.Repo.CreateUser(r.Context(), CreateUserInput{
		Username: body.Username,
		Email:    body.Email,
		Role:     body.Role,
	}, p.Email)
	u, err := a.Repo.CreateUser(r.Context(), CreateUserInput(body), p.Email)
	if err != nil {
		if errors.Is(err, ErrConflict) {
			writeError(w, r, newError(http.StatusConflict, "already_exists",
@@ -156,11 +152,7 @@ func (a *API) handlePatchUser(w http.ResponseWriter, r *http.Request) {
		return
	}

	u, err := a.Repo.UpdateUser(r.Context(), id, UpdateUserInput{
		Username: body.Username,
		Email:    body.Email,
		Role:     body.Role,
	}, p.Email)
	u, err := a.Repo.UpdateUser(r.Context(), id, UpdateUserInput(body), p.Email)
	if err != nil {
		if errors.Is(err, ErrNotFound) {
			writeError(w, r, newError(http.StatusNotFound, "not_found", "user not found"))