Update code in endpoints/footing.post.py

This commit is contained in:
Backend IM Bot 2025-03-25 07:35:40 +01:00
parent 676b27b9e2
commit 67c4d2624d

View File

@ -8,22 +8,23 @@ router = APIRouter()
@router.post("/footing")
async def save_game(
name: str,
title: str,
description: str,
category: str
genre: str,
platform: str
):
"""Save a new game to the database"""
if request.method != "POST":
raise HTTPException(status_code=405, detail="Method Not Allowed")
game_id = str(uuid.uuid4())
game = {
games.append({
"id": game_id,
"name": name,
"description": description,
"category": category
}
games.append(game)
"title": title,
"description": description,
"genre": genre,
"platform": platform
})
return {
"method": "POST",
@ -34,13 +35,13 @@ async def save_game(
@router.get("/games")
async def get_games():
"""Fetch all games from the database"""
"""Fetch all saved games from the database"""
if request.method != "GET":
raise HTTPException(status_code=405, detail="Method Not Allowed")
return {
"method": "GET",
"_verb": "get",
"_verb": "get",
"games": games
}
```