Spaces:
Running
Running
feat: add /flow/tickets fake API
Browse files- backend/main.py +20 -0
backend/main.py
CHANGED
|
@@ -91,6 +91,26 @@ async def health_check():
|
|
| 91 |
raise HTTPException(status_code=500, detail="Database connection failed")
|
| 92 |
|
| 93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
@app.get("/api/pois")
|
| 95 |
async def list_pois(city_id: Optional[int] = Query(None), district_id: Optional[int] = Query(None)):
|
| 96 |
try:
|
|
|
|
| 91 |
raise HTTPException(status_code=500, detail="Database connection failed")
|
| 92 |
|
| 93 |
|
| 94 |
+
# Flow tickets (fake data)
|
| 95 |
+
FAKE_TICKETS = [
|
| 96 |
+
{"id": 1, "title": "ticket 1", "detail": ""},
|
| 97 |
+
{"id": 2, "title": "ticket 2", "detail": ""},
|
| 98 |
+
]
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
@app.get("/flow/tickets")
|
| 102 |
+
async def list_flow_tickets():
|
| 103 |
+
return [{"id": t["id"], "title": t["title"]} for t in FAKE_TICKETS]
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
@app.get("/flow/tickets/{ticket_id}")
|
| 107 |
+
async def get_flow_ticket(ticket_id: int):
|
| 108 |
+
for t in FAKE_TICKETS:
|
| 109 |
+
if t["id"] == ticket_id:
|
| 110 |
+
return t
|
| 111 |
+
raise HTTPException(status_code=404, detail="Ticket not found")
|
| 112 |
+
|
| 113 |
+
|
| 114 |
@app.get("/api/pois")
|
| 115 |
async def list_pois(city_id: Optional[int] = Query(None), district_id: Optional[int] = Query(None)):
|
| 116 |
try:
|