This commit is contained in:
aditya.siregar 2024-07-26 22:47:37 +07:00
parent 105bda67a3
commit dfed117d90
2 changed files with 4 additions and 3 deletions

View File

@ -2,7 +2,6 @@ package order
import (
"furtuna-be/internal/common/errors"
"furtuna-be/internal/common/mycontext"
"furtuna-be/internal/entity"
"furtuna-be/internal/handlers/request"
"furtuna-be/internal/handlers/response"
@ -177,7 +176,7 @@ func (h *Handler) GetAllHistoryOrders(c *gin.Context) {
return
}
ctx := mycontext.NewContext(c.Request.Context())
ctx := request.GetMyContext(c)
orders, total, err := h.service.GetAllHistoryOrders(ctx, req.ToEntity(ctx))
if err != nil {
response.ErrorWrapper(c, err)

View File

@ -105,8 +105,10 @@ func (b *OrderRepository) GetAllHystoryOrders(ctx context.Context, req entity.Hi
return nil, 0, err
}
page := (req.Offset - 1) * req.Limit
if req.Offset > 0 {
query = query.Offset(req.Offset)
query = query.Offset(page)
}
if req.Limit > 0 {