fix products listing

This commit is contained in:
2026-03-24 14:39:13 +01:00
parent 3b80fa6dbe
commit 73cc936d56
8 changed files with 22 additions and 108 deletions

View File

@@ -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 {

View File

@@ -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)
}