Update code in endpoints/aid.post.py

This commit is contained in:
Backend IM Bot 2025-03-25 10:15:36 +01:00
parent 55727b0160
commit 20f75765e3

36
endpoints/aid.post.py Normal file
View File

@ -0,0 +1,36 @@
```python
from fastapi import APIRouter, HTTPException
import uuid
games = [] # In-memory storage
router = APIRouter()
@router.post("/aid")
async def save_games(
games_list: list
):
"""Save list of games to the database"""
if request.method != "POST":
raise HTTPException(status_code=405, detail="Method Not Allowed")
for game in games_list:
game_id = str(uuid.uuid4())
games.append({
"id": game_id,
"game": game
})
return {
"method": "POST",
"_verb": "post",
"message": "Games saved successfully",
"games_saved": len(games_list)
}
```
```
# requirements.txt
fastapi
uvicorn
```