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) <noreply@anthropic.com>
This commit is contained in:
gongzhiyong
2026-04-08 17:21:55 +08:00
co-authored by Claude Sonnet 4.6
parent 346fa02e44
commit 433d2361a8
+2 -1
View File
@@ -7,6 +7,7 @@ Returns data in a format aligned with the frontend TicketData interface:
from __future__ import annotations from __future__ import annotations
from collections import Counter from collections import Counter
from uuid import UUID
import httpx import httpx
from litestar import get 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}") @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.""" """GET /api/tickets/:id — Get a single ticket detail."""
url = f"{settings.gongdan_api_base}/api/tickets/{ticket_id}" url = f"{settings.gongdan_api_base}/api/tickets/{ticket_id}"