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
|
from fastapi import APIRouter, HTTPException
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
@ -9,7 +8,6 @@ router = APIRouter()
|
|||||||
@router.post("/footing")
|
@router.post("/footing")
|
||||||
async def save_game(
|
async def save_game(
|
||||||
title: str,
|
title: str,
|
||||||
description: str,
|
|
||||||
genre: str,
|
genre: str,
|
||||||
platform: str
|
platform: str
|
||||||
):
|
):
|
||||||
@ -18,13 +16,13 @@ async def save_game(
|
|||||||
raise HTTPException(status_code=405, detail="Method Not Allowed")
|
raise HTTPException(status_code=405, detail="Method Not Allowed")
|
||||||
|
|
||||||
game_id = str(uuid.uuid4())
|
game_id = str(uuid.uuid4())
|
||||||
games.append({
|
game = {
|
||||||
"id": game_id,
|
"id": game_id,
|
||||||
"title": title,
|
"title": title,
|
||||||
"description": description,
|
|
||||||
"genre": genre,
|
"genre": genre,
|
||||||
"platform": platform
|
"platform": platform
|
||||||
})
|
}
|
||||||
|
games.append(game)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"method": "POST",
|
"method": "POST",
|
||||||
@ -44,4 +42,3 @@ async def get_games():
|
|||||||
"_verb": "get",
|
"_verb": "get",
|
||||||
"games": games
|
"games": games
|
||||||
}
|
}
|
||||||
```
|
|
Loading…
x
Reference in New Issue
Block a user