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

@@ -34,11 +34,13 @@ class BoardBase(SQLModel):
class BoardCreate(BoardBase):
"""Payload for creating a board."""
gateway_id: UUID
gateway_id: UUID | None = None
@model_validator(mode="after")
def validate_goal_fields(self) -> Self:
"""Require goal details when creating a confirmed goal board."""
"""Require gateway and goal details when creating a confirmed goal board."""
if self.gateway_id is None:
raise ValueError(_ERR_GATEWAY_REQUIRED)
if (
self.board_type == "goal"
and self.goal_confirmed

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