refactor: replace DefaultLimitOffsetPage with LimitOffsetPage in multiple files and update timezone handling to use UTC
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TypeVar
|
||||
from typing import TYPE_CHECKING, TypeVar
|
||||
|
||||
from fastapi import Query
|
||||
from fastapi_pagination.customization import CustomizedPage, UseParamsFields
|
||||
@@ -14,10 +14,15 @@ T = TypeVar("T")
|
||||
# Project-wide default pagination response model.
|
||||
# - Keep `limit` / `offset` naming (matches existing API conventions).
|
||||
# - Cap list endpoints to 200 items per request (matches prior route-level constraints).
|
||||
DefaultLimitOffsetPage = CustomizedPage[
|
||||
LimitOffsetPage[T],
|
||||
UseParamsFields(
|
||||
limit=Query(200, ge=1, le=200),
|
||||
offset=Query(0, ge=0),
|
||||
),
|
||||
]
|
||||
if TYPE_CHECKING:
|
||||
# Type checkers treat this as a normal generic page type.
|
||||
DefaultLimitOffsetPage = LimitOffsetPage
|
||||
else:
|
||||
# Runtime uses project-default query param bounds for all list endpoints.
|
||||
DefaultLimitOffsetPage = CustomizedPage[
|
||||
LimitOffsetPage[T],
|
||||
UseParamsFields(
|
||||
limit=Query(200, ge=1, le=200),
|
||||
offset=Query(0, ge=0),
|
||||
),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user