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