Update code in endpoints/footing.post.py
This commit is contained in:
parent
f7bb75eda8
commit
676b27b9e2
@ -8,20 +8,20 @@ router = APIRouter()
|
||||
|
||||
@router.post("/footing")
|
||||
async def save_game(
|
||||
game_name: str,
|
||||
name: str,
|
||||
description: str,
|
||||
developer: str
|
||||
category: 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 = {
|
||||
"id": game_id,
|
||||
"name": game_name,
|
||||
"description": description,
|
||||
"developer": developer
|
||||
"name": name,
|
||||
"description": description,
|
||||
"category": category
|
||||
}
|
||||
games.append(game)
|
||||
|
||||
@ -34,12 +34,12 @@ async def save_game(
|
||||
|
||||
@router.get("/games")
|
||||
async def get_games():
|
||||
"""Fetch all saved games"""
|
||||
"""Fetch all games from the database"""
|
||||
if request.method != "GET":
|
||||
raise HTTPException(status_code=405, detail="Method Not Allowed")
|
||||
|
||||
return {
|
||||
"method": "GET",
|
||||
"method": "GET",
|
||||
"_verb": "get",
|
||||
"games": games
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user