From 433d2361a8ceb2cb1c6bb0006c889b29cd0d0d65 Mon Sep 17 00:00:00 2001 From: gongzhiyong Date: Wed, 8 Apr 2026 17:21:55 +0800 Subject: [PATCH] fix(backend): use UUID type for ticket_id parameter in get_ticket handler Litestar's {ticket_id:uuid} path parameter requires the handler parameter to be typed as UUID, not str. This caused a 400 validation error on GET /api/tickets/{uuid}. Co-Authored-By: Claude Sonnet 4.6 (1M context) --- backend/app/api/tickets.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/app/api/tickets.py b/backend/app/api/tickets.py index acb2f2b..e6cc1ec 100644 --- a/backend/app/api/tickets.py +++ b/backend/app/api/tickets.py @@ -7,6 +7,7 @@ Returns data in a format aligned with the frontend TicketData interface: from __future__ import annotations from collections import Counter +from uuid import UUID import httpx from litestar import get @@ -116,7 +117,7 @@ async def list_tickets(page: int = 1, page_size: int = 20) -> list[dict]: @get("/api/tickets/{ticket_id:uuid}") -async def get_ticket(ticket_id: str) -> dict: +async def get_ticket(ticket_id: UUID) -> dict: """GET /api/tickets/:id — Get a single ticket detail.""" url = f"{settings.gongdan_api_base}/api/tickets/{ticket_id}"