From 1166c11b6f6597a5198c980ac1b30b1d7e6a677d Mon Sep 17 00:00:00 2001 From: "Mohammadi, Erfan" Date: Sun, 22 Sep 2024 01:13:31 +0330 Subject: [PATCH] fix(delivery): bind kindbox id path param and benefactor id --- delivery/http_server/benefactor/kind_box/get.go | 3 +++ param/benefactor/kind_box/get.go | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/delivery/http_server/benefactor/kind_box/get.go b/delivery/http_server/benefactor/kind_box/get.go index 161121c..8178c21 100644 --- a/delivery/http_server/benefactor/kind_box/get.go +++ b/delivery/http_server/benefactor/kind_box/get.go @@ -1,6 +1,7 @@ package benefactorkindboxhandler import ( + "git.gocasts.ir/ebhomengo/niki/pkg/claim" "net/http" param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box" @@ -24,6 +25,8 @@ func (h Handler) Get(c echo.Context) error { if bErr := c.Bind(&req); bErr != nil { return echo.NewHTTPError(http.StatusBadRequest) } + claims := claim.GetClaimsFromEchoContext(c) + req.BenefactorID = claims.UserID resp, sErr := h.benefactorKindBoxSvc.Get(c.Request().Context(), req) if sErr != nil { diff --git a/param/benefactor/kind_box/get.go b/param/benefactor/kind_box/get.go index c85cf4e..5fbf1ea 100644 --- a/param/benefactor/kind_box/get.go +++ b/param/benefactor/kind_box/get.go @@ -1,8 +1,8 @@ package benefactorkindboxparam type KindBoxGetRequest struct { - BenefactorID uint - KindBoxID uint + BenefactorID uint `json:"-"` + KindBoxID uint `param:"id"` } type KindBoxGetResponse struct {