diff --git a/packetserver/http/routers/dashboard.py b/packetserver/http/routers/dashboard.py index 449ef5e..8bebd37 100644 --- a/packetserver/http/routers/dashboard.py +++ b/packetserver/http/routers/dashboard.py @@ -4,16 +4,26 @@ from fastapi.responses import HTMLResponse from packetserver.http.dependencies import get_current_http_user from packetserver.http.auth import HttpUser -from packetserver.http.server import templates # for TemplateResponse +from packetserver.http.server import templates router = APIRouter(tags=["dashboard"]) +# Import the function at module level (safe now that circular import is fixed) +from packetserver.http.routers.messages import get_messages as api_get_messages + @router.get("/dashboard", response_class=HTMLResponse) -async def dashboard(request: Request, current_user: HttpUser = Depends(get_current_http_user)): - # Fetch messages via internal API call (reuse list logic) - from packetserver.http.routers.messages import get_messages as api_get_messages - messages_resp = await api_get_messages(current_user=current_user, type="all", limit=100) +async def dashboard( + request: Request, + current_user: HttpUser = Depends(get_current_http_user) +): + # Internal call – pass explicit defaults to avoid Query object injection + messages_resp = await api_get_messages( + current_user=current_user, + type="all", + limit=100, + since=None # prevents Query wrapper + ) messages = messages_resp["messages"] return templates.TemplateResponse(