Add refund order

This commit is contained in:
aditya.siregar
2025-06-14 21:17:13 +07:00
parent 58d3b32c40
commit ebb33186b8
42 changed files with 1152 additions and 2094 deletions
+11 -2
View File
@@ -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,
}
}