- Add response_model to all 8 route endpoints for runtime validation and correct Swagger docs - Remove global KeyError handler (routes catch it explicitly) - Add catch-all Exception handler with logging for 500 responses - Remove dead code in service.py get_case_graph (unused bucket variable) - Explicit graph_backend validation in cmd_serve (memory|neo4j, else exit) - Sanitise comma-separated query params (strip whitespace, filter empty) - Move HTTPException to top-level import in routes.py - Remove unused imports (Depends in dependencies.py, all_persona_names) - Fix deprecated asyncio.get_event_loop() in test fixture Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
13 lines
356 B
Python
13 lines
356 B
Python
"""FastAPI dependency providers."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from aucourt_ingest.api.service import QueryService
|
|
|
|
_query_service: QueryService | None = None
|
|
|
|
|
|
def get_query_service() -> QueryService:
|
|
if _query_service is None:
|
|
raise RuntimeError("QueryService not initialised — call create_app() first")
|
|
return _query_service
|