refactor: replace DefaultLimitOffsetPage with LimitOffsetPage in multiple files and update timezone handling to use UTC

This commit is contained in:
Abhimanyu Saharan
2026-02-09 20:40:17 +05:30
parent 1f105c19ab
commit 020d02fa22
51 changed files with 302 additions and 192 deletions

View File

@@ -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),
),
]