add carts

This commit is contained in:
Daniel Goc
2026-03-24 14:47:20 +01:00
49 changed files with 1926 additions and 3374 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)
}