Merge pull request 'fix(delivery): bind kindbox id path param and benefactor id' (#186) from stage/erfan/fix-get-kindbox-by-benefactor into develop

Reviewed-on: ebhomengo/niki#186
This commit is contained in:
hossein 2024-09-25 05:27:39 +00:00
commit b25edc44eb
2 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package benefactorkindboxhandler package benefactorkindboxhandler
import ( import (
"git.gocasts.ir/ebhomengo/niki/pkg/claim"
"net/http" "net/http"
param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box" 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 { if bErr := c.Bind(&req); bErr != nil {
return echo.NewHTTPError(http.StatusBadRequest) return echo.NewHTTPError(http.StatusBadRequest)
} }
claims := claim.GetClaimsFromEchoContext(c)
req.BenefactorID = claims.UserID
resp, sErr := h.benefactorKindBoxSvc.Get(c.Request().Context(), req) resp, sErr := h.benefactorKindBoxSvc.Get(c.Request().Context(), req)
if sErr != nil { if sErr != nil {

View File

@ -1,8 +1,8 @@
package benefactorkindboxparam package benefactorkindboxparam
type KindBoxGetRequest struct { type KindBoxGetRequest struct {
BenefactorID uint BenefactorID uint `json:"-"`
KindBoxID uint KindBoxID uint `param:"id"`
} }
type KindBoxGetResponse struct { type KindBoxGetResponse struct {