Update code in endpoints/footing.post.py
This commit is contained in:
parent
67c4d2624d
commit
7964799af1
@ -1,4 +1,3 @@
|
||||
```python
|
||||
from fastapi import APIRouter, HTTPException
|
||||
import uuid
|
||||
|
||||
@ -9,7 +8,6 @@ router = APIRouter()
|
||||
@router.post("/footing")
|
||||
async def save_game(
|
||||
title: str,
|
||||
description: str,
|
||||
genre: str,
|
||||
platform: str
|
||||
):
|
||||
@ -18,13 +16,13 @@ async def save_game(
|
||||
raise HTTPException(status_code=405, detail="Method Not Allowed")
|
||||
|
||||
game_id = str(uuid.uuid4())
|
||||
games.append({
|
||||
game = {
|
||||
"id": game_id,
|
||||
"title": title,
|
||||
"description": description,
|
||||
"genre": genre,
|
||||
"genre": genre,
|
||||
"platform": platform
|
||||
})
|
||||
}
|
||||
games.append(game)
|
||||
|
||||
return {
|
||||
"method": "POST",
|
||||
@ -38,10 +36,9 @@ async def get_games():
|
||||
"""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",
|
||||
"method": "GET",
|
||||
"_verb": "get",
|
||||
"games": games
|
||||
}
|
||||
```
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user