From 9de9fc8e45a5704fff700a92ebae519df619cad6 Mon Sep 17 00:00:00 2001 From: ErfanTech Date: Sat, 27 Apr 2024 03:25:26 +0330 Subject: [PATCH] fix(benefactor): fix path parameter binding in kind box request GetByID handler --- delivery/http_server/benefactor/kind_box_req/get.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/delivery/http_server/benefactor/kind_box_req/get.go b/delivery/http_server/benefactor/kind_box_req/get.go index fe858de..6c3f4d4 100644 --- a/delivery/http_server/benefactor/kind_box_req/get.go +++ b/delivery/http_server/benefactor/kind_box_req/get.go @@ -1,6 +1,7 @@ package benefactorkindboxreqhandler import ( + "git.gocasts.ir/ebhomengo/niki/pkg/claim" "net/http" param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box_req" @@ -10,9 +11,12 @@ import ( func (h Handler) Get(c echo.Context) error { var req param.KindBoxReqGetRequest - if bErr := c.Bind(&req); bErr != nil { + if bErr := echo.PathParamsBinder(c).Uint("id", &req.KindBoxReqID).BindError(); bErr != nil { return echo.NewHTTPError(http.StatusBadRequest) } + claims := claim.GetClaimsFromEchoContext(c) + req.BenefactorID = claims.UserID + if fieldErrors, err := h.benefactorKindBoxReqVld.ValidateGetRequest(req); err != nil { msg, code := httpmsg.Error(err)