Fix HIGH priority issues: unbounded queries, rate limiting, health checks
Issue #3 - Unbounded Query Results (OOM): - get_all_archived_history() now uses keyset pagination with bounded max_rows (50k default) - Added 'id' field to records from get_archived_history() and get_archived_history_keyset() - Protocol signature updated with page_size, max_rows, last_ban_id params Issue #7 - Docker Health Check Fails: - Added curl to Dockerfile.backend runtime image - HEALTHCHECK now uses 'curl -f http://localhost:8000/api/health' - compose.prod.yml: increased start_period to 40s, timeout to 10s - Frontend healthcheck proxies to backend /api/health Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
23
backend/app/mappers/health_mappers.py
Normal file
23
backend/app/mappers/health_mappers.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""Health response mappers.
|
||||
|
||||
Convert domain models (from health_service) to response models (for HTTP API).
|
||||
|
||||
This is the mapping layer at the router boundary, ensuring the service layer
|
||||
remains independent of HTTP response shapes.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from app.models.health_domain import DomainServerStatus
|
||||
from app.models.server import ServerStatus
|
||||
|
||||
|
||||
def map_domain_server_status_to_response(domain: DomainServerStatus) -> ServerStatus:
|
||||
"""Convert domain server status to response model."""
|
||||
return ServerStatus(
|
||||
online=domain.online,
|
||||
version=domain.version,
|
||||
active_jails=domain.active_jails,
|
||||
total_bans=domain.total_bans,
|
||||
total_failures=domain.total_failures,
|
||||
)
|
||||
Reference in New Issue
Block a user