Refactor data fetching hooks, add page size lint test
- Simplify useFetchData: remove unused URL building logic - Add usePolledData initial implementation - Add router page_size param validation test - Update API reference docs - Clean up tasks doc
This commit is contained in:
@@ -22,7 +22,7 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import APIRouter, Body, Path, status
|
||||
from fastapi import APIRouter, Body, Path, Query, status
|
||||
|
||||
from app.dependencies import (
|
||||
AuthDep,
|
||||
@@ -43,6 +43,7 @@ from app.models.jail import (
|
||||
JailListResponse,
|
||||
)
|
||||
from app.services import jail_service
|
||||
from app.utils.constants import DEFAULT_PAGE_SIZE
|
||||
|
||||
router: APIRouter = APIRouter(prefix="/api/v1/jails", tags=["Jails"])
|
||||
|
||||
@@ -521,8 +522,8 @@ async def get_jail_banned_ips(
|
||||
socket_path: Fail2BanSocketDep,
|
||||
http_session: HttpSessionDep,
|
||||
geo_cache: GeoCacheDep,
|
||||
page: int = 1,
|
||||
page_size: int = 25,
|
||||
page: int = Query(default=1, ge=1, description="1-based page number."),
|
||||
page_size: int = Query(default=DEFAULT_PAGE_SIZE, ge=1, le=100, description="Items per page (max 100)."),
|
||||
search: str | None = None,
|
||||
) -> JailBannedIpsResponse:
|
||||
"""Return a paginated list of IPs currently banned by a specific jail.
|
||||
@@ -539,7 +540,7 @@ async def get_jail_banned_ips(
|
||||
http_session: Shared HTTP session for geolocation.
|
||||
geo_cache: Geolocation cache instance.
|
||||
page: 1-based page number (default 1, min 1).
|
||||
page_size: Items per page (default 25, max 100).
|
||||
page_size: Items per page (default 100, max 100).
|
||||
search: Optional case-insensitive substring filter on the IP address.
|
||||
|
||||
Returns:
|
||||
|
||||
Reference in New Issue
Block a user