hku-class-hub/backend/app/schemas/common.py
2026-04-11 12:52:23 +08:00

25 lines
409 B
Python

from typing import Generic, TypeVar
from pydantic import BaseModel
T = TypeVar("T")
class APIResponse(BaseModel, Generic[T]):
success: bool = True
data: T | None = None
message: str = ""
class PageParams(BaseModel):
page: int = 1
page_size: int = 20
class PageResponse(BaseModel, Generic[T]):
items: list[T]
total: int
page: int
page_size: int
total_pages: int