Add refund order
This commit is contained in:
@@ -55,7 +55,6 @@ func (h *Handler) Create(c *gin.Context) {
|
||||
}
|
||||
|
||||
req.PartnerID = *ctx.GetPartnerID()
|
||||
req.SiteID = *ctx.GetSiteID()
|
||||
|
||||
res, err := h.service.Create(ctx, req.ToEntity())
|
||||
|
||||
@@ -140,7 +139,9 @@ func (h *Handler) GetAll(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
products, total, err := h.service.GetAll(c.Request.Context(), req.ToEntity())
|
||||
ctx := request.GetMyContext(c)
|
||||
|
||||
products, total, err := h.service.GetAll(ctx, req.ToEntity(*ctx.GetPartnerID()))
|
||||
if err != nil {
|
||||
response.ErrorWrapper(c, err)
|
||||
return
|
||||
@@ -266,6 +267,13 @@ func (h *Handler) GetByID(c *gin.Context) {
|
||||
}
|
||||
|
||||
func (h *Handler) toProductResponse(resp *entity.Product) response.Product {
|
||||
category := response.Category{}
|
||||
|
||||
if resp.Category != nil {
|
||||
category.ID = resp.Category.ID
|
||||
category.Name = resp.Category.Name
|
||||
}
|
||||
|
||||
return response.Product{
|
||||
ID: resp.ID,
|
||||
Name: resp.Name,
|
||||
@@ -274,6 +282,7 @@ func (h *Handler) toProductResponse(resp *entity.Product) response.Product {
|
||||
Status: resp.Status,
|
||||
Description: resp.Description,
|
||||
Image: resp.Image,
|
||||
Category: category,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user