fix products listing
This commit is contained in:
@@ -10,8 +10,8 @@ import (
|
||||
)
|
||||
|
||||
type Paging struct {
|
||||
Page uint `json:"page_number" example:"5"`
|
||||
Elements uint `json:"elements_per_page" example:"30"`
|
||||
Page uint `json:"p" example:"5"`
|
||||
Elements uint `json:"elems" example:"30"`
|
||||
}
|
||||
|
||||
func (p Paging) Offset() int {
|
||||
|
||||
@@ -59,5 +59,8 @@ func ParseFieldFilters[T any](c fiber.Ctx, formColumnMapping ...map[string]strin
|
||||
func ParsePagination(c fiber.Ctx) (uint, uint) {
|
||||
pageNum, _ := strconv.ParseInt(c.Query("p", "1"), 10, 64)
|
||||
pageSize, _ := strconv.ParseInt(c.Query("elems", "30"), 10, 64)
|
||||
if pageSize > 100 {
|
||||
pageSize = 100
|
||||
}
|
||||
return uint(pageNum), uint(pageSize)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user