Pagination contract is not standardized across endpoints
This commit is contained in:
@@ -10,7 +10,7 @@ from enum import StrEnum
|
||||
|
||||
from pydantic import AnyHttpUrl, Field
|
||||
|
||||
from app.models.response import BanGuiBaseModel
|
||||
from app.models.response import BanGuiBaseModel, PaginatedListResponse
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -69,14 +69,14 @@ class ImportLogEntry(BanGuiBaseModel):
|
||||
ips_skipped: int
|
||||
errors: str | None
|
||||
|
||||
class ImportLogListResponse(BanGuiBaseModel):
|
||||
"""Response for ``GET /api/blocklists/log``."""
|
||||
class ImportLogListResponse(PaginatedListResponse[ImportLogEntry]):
|
||||
"""Response for ``GET /api/blocklists/log``.
|
||||
|
||||
items: list[ImportLogEntry] = Field(default_factory=list)
|
||||
total: int = Field(..., ge=0)
|
||||
page: int = Field(default=1, ge=1)
|
||||
page_size: int = Field(default=50, ge=1)
|
||||
total_pages: int = Field(default=1, ge=1)
|
||||
Paginated list of all blocklist import runs with timestamps, source info,
|
||||
and per-source import/skip counts.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Schedule
|
||||
|
||||
@@ -7,7 +7,7 @@ from __future__ import annotations
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
from app.models.response import BanGuiBaseModel
|
||||
from app.models.response import BanGuiBaseModel, PaginatedListResponse
|
||||
|
||||
from app.models.ban import TimeRange
|
||||
|
||||
@@ -56,13 +56,15 @@ class HistoryBanItem(BanGuiBaseModel):
|
||||
description="Organisation name associated with the IP.",
|
||||
)
|
||||
|
||||
class HistoryListResponse(BanGuiBaseModel):
|
||||
"""Paginated history ban-list response."""
|
||||
class HistoryListResponse(PaginatedListResponse[HistoryBanItem]):
|
||||
"""Paginated history ban-list response.
|
||||
|
||||
items: list[HistoryBanItem] = Field(default_factory=list)
|
||||
total: int = Field(..., ge=0, description="Total matching records.")
|
||||
page: int = Field(..., ge=1)
|
||||
page_size: int = Field(..., ge=1)
|
||||
Request: ``GET /api/history`` with optional time-range, jail, IP, and
|
||||
origin filters plus pagination parameters.
|
||||
Response: Paginated collection of historical ban records with geolocation.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Per-IP timeline
|
||||
|
||||
Reference in New Issue
Block a user