From e4b2c19a5020b4f40b7c96ee095fd7086786dab4 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Sun, 16 Oct 2022 17:56:39 -0800 Subject: [PATCH] update names --- backend/app/api/routes.go | 1 - backend/app/api/v1/partials.go | 2 +- backend/app/api/v1/v1_ctrl_items.go | 2 +- backend/app/api/v1/v1_ctrl_items_attachments.go | 4 ++-- backend/app/api/v1/v1_ctrl_labels.go | 2 +- backend/app/api/v1/v1_ctrl_locations.go | 2 +- backend/app/api/v1/v1_ctrl_user.go | 13 ------------- 7 files changed, 6 insertions(+), 20 deletions(-) diff --git a/backend/app/api/routes.go b/backend/app/api/routes.go index 813ec26..b0a1f1c 100644 --- a/backend/app/api/routes.go +++ b/backend/app/api/routes.go @@ -65,7 +65,6 @@ func (a *app) newRouter(repos *repo.AllRepos) *chi.Mux { r.Get(v1Base("/users/self"), v1Ctrl.HandleUserSelf()) r.Put(v1Base("/users/self"), v1Ctrl.HandleUserSelfUpdate()) r.Delete(v1Base("/users/self"), v1Ctrl.HandleUserSelfDelete()) - r.Put(v1Base("/users/self/password"), v1Ctrl.HandleUserUpdatePassword()) r.Post(v1Base("/users/logout"), v1Ctrl.HandleAuthLogout()) r.Get(v1Base("/users/refresh"), v1Ctrl.HandleAuthRefresh()) r.Put(v1Base("/users/self/change-password"), v1Ctrl.HandleUserSelfChangePassword()) diff --git a/backend/app/api/v1/partials.go b/backend/app/api/v1/partials.go index 7d573aa..47249e6 100644 --- a/backend/app/api/v1/partials.go +++ b/backend/app/api/v1/partials.go @@ -9,7 +9,7 @@ import ( "github.com/rs/zerolog/log" ) -func (ctrl *V1Controller) partialRouteID(w http.ResponseWriter, r *http.Request) (uuid.UUID, error) { +func (ctrl *V1Controller) routeID(w http.ResponseWriter, r *http.Request) (uuid.UUID, error) { ID, err := uuid.Parse(chi.URLParam(r, "id")) if err != nil { log.Err(err).Msg("failed to parse id") diff --git a/backend/app/api/v1/v1_ctrl_items.go b/backend/app/api/v1/v1_ctrl_items.go index d3c963f..49fe8b6 100644 --- a/backend/app/api/v1/v1_ctrl_items.go +++ b/backend/app/api/v1/v1_ctrl_items.go @@ -139,7 +139,7 @@ func (ctrl *V1Controller) HandleItemUpdate() http.HandlerFunc { func (ctrl *V1Controller) handleItemsGeneral() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { ctx := services.NewContext(r.Context()) - ID, err := ctrl.partialRouteID(w, r) + ID, err := ctrl.routeID(w, r) if err != nil { return } diff --git a/backend/app/api/v1/v1_ctrl_items_attachments.go b/backend/app/api/v1/v1_ctrl_items_attachments.go index 5d921b5..d4e2981 100644 --- a/backend/app/api/v1/v1_ctrl_items_attachments.go +++ b/backend/app/api/v1/v1_ctrl_items_attachments.go @@ -72,7 +72,7 @@ func (ctrl *V1Controller) HandleItemAttachmentCreate() http.HandlerFunc { attachmentType = attachment.TypeAttachment.String() } - id, err := ctrl.partialRouteID(w, r) + id, err := ctrl.routeID(w, r) if err != nil { return } @@ -163,7 +163,7 @@ func (ctrl *V1Controller) HandleItemAttachmentUpdate() http.HandlerFunc { } func (ctrl *V1Controller) handleItemAttachmentsHandler(w http.ResponseWriter, r *http.Request) { - ID, err := ctrl.partialRouteID(w, r) + ID, err := ctrl.routeID(w, r) if err != nil { return } diff --git a/backend/app/api/v1/v1_ctrl_labels.go b/backend/app/api/v1/v1_ctrl_labels.go index 07e8e39..7d3c00d 100644 --- a/backend/app/api/v1/v1_ctrl_labels.go +++ b/backend/app/api/v1/v1_ctrl_labels.go @@ -98,7 +98,7 @@ func (ctrl *V1Controller) HandleLabelUpdate() http.HandlerFunc { func (ctrl *V1Controller) handleLabelsGeneral() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { ctx := services.NewContext(r.Context()) - ID, err := ctrl.partialRouteID(w, r) + ID, err := ctrl.routeID(w, r) if err != nil { return } diff --git a/backend/app/api/v1/v1_ctrl_locations.go b/backend/app/api/v1/v1_ctrl_locations.go index 2b4152f..4b8bedb 100644 --- a/backend/app/api/v1/v1_ctrl_locations.go +++ b/backend/app/api/v1/v1_ctrl_locations.go @@ -99,7 +99,7 @@ func (ctrl *V1Controller) HandleLocationUpdate() http.HandlerFunc { func (ctrl *V1Controller) handleLocationGeneral() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { ctx := services.NewContext(r.Context()) - ID, err := ctrl.partialRouteID(w, r) + ID, err := ctrl.routeID(w, r) if err != nil { return } diff --git a/backend/app/api/v1/v1_ctrl_user.go b/backend/app/api/v1/v1_ctrl_user.go index 9ea4fae..3b8fd44 100644 --- a/backend/app/api/v1/v1_ctrl_user.go +++ b/backend/app/api/v1/v1_ctrl_user.go @@ -85,7 +85,6 @@ func (ctrl *V1Controller) HandleUserSelfUpdate() http.HandlerFunc { newData, err := ctrl.svc.User.UpdateSelf(r.Context(), actor.ID, updateData) if err != nil { - server.RespondError(w, http.StatusInternalServerError, err) return } @@ -94,18 +93,6 @@ func (ctrl *V1Controller) HandleUserSelfUpdate() http.HandlerFunc { } } -// HandleUserUpdatePassword godoc -// @Summary Update the current user's password // TODO: -// @Tags User -// @Produce json -// @Success 204 -// @Router /v1/users/self/password [PUT] -// @Security Bearer -func (ctrl *V1Controller) HandleUserUpdatePassword() http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - } -} - // HandleUserSelfDelete godoc // @Summary Deletes the user account // @Tags User