mirror of
https://github.com/hay-kot/homebox.git
synced 2024-12-18 21:16:31 +00:00
18488f5b15
* cleanup items endpoints * refactor group routes * refactor labels routes * remove old partial * refactor location routes * formatting * update names * cleanup func * speedup test runner with disable hasher * remove duplicate code
21 lines
467 B
Go
21 lines
467 B
Go
package v1
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/go-chi/chi/v5"
|
|
"github.com/google/uuid"
|
|
"github.com/hay-kot/homebox/backend/pkgs/server"
|
|
"github.com/rs/zerolog/log"
|
|
)
|
|
|
|
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")
|
|
server.RespondError(w, http.StatusBadRequest, err)
|
|
return uuid.Nil, err
|
|
}
|
|
|
|
return ID, nil
|
|
}
|