diff --git a/endpoints/api/v1/endpoint.post.py b/endpoints/api/v1/endpoint.post.py new file mode 100644 index 0000000..144a11c --- /dev/null +++ b/endpoints/api/v1/endpoint.post.py @@ -0,0 +1,32 @@ +from fastapi import APIRouter, Depends, HTTPException +from core.database import fake_users_db + +router = APIRouter() + +# Demo sports database +fake_sports_db = { + "1": {"id": "1", "name": "Football", "type": "Team Sport"}, + "2": {"id": "2", "name": "Basketball", "type": "Team Sport"}, + "3": {"id": "3", "name": "Tennis", "type": "Individual Sport"}, + "4": {"id": "4", "name": "Swimming", "type": "Individual Sport"} +} + +@router.post("/api/v1/endpoint") +async def get_sports_list(): + """Get list of all sports""" + try: + sports_list = list(fake_sports_db.values()) + + return { + "message": "Sports list retrieved successfully", + "data": sports_list, + "metadata": { + "total_count": len(sports_list), + "categories": ["Team Sport", "Individual Sport"] + } + } + except Exception as e: + raise HTTPException( + status_code=500, + detail="Error retrieving sports list" + ) \ No newline at end of file