Fix critical bug and deprecation warnings
- Fixed bug in games_router.py: player_result -> player_stmt in create_game - Updated main.py lifespan from generator to @asynccontextmanager (FastAPI deprecation) - security.py already uses datetime.now(timezone.utc) - no change needed - All 28 tests pass
This commit is contained in:
+3
-2
@@ -15,7 +15,7 @@ Mounts all consolidated routers and provides centralized configuration.
|
||||
"""
|
||||
import asyncio
|
||||
import logging
|
||||
from typing import AsyncGenerator
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
@@ -36,7 +36,8 @@ from app.core.logging import configure_logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
"""Application lifespan events for startup and shutdown."""
|
||||
config = get_config()
|
||||
|
||||
|
||||
@@ -346,7 +346,7 @@ async def create_game(
|
||||
|
||||
# Fetch players for response
|
||||
player_stmt = select(GamePlayer).where(GamePlayer.game_id == new_game.id)
|
||||
player_result = await db.execute(player_result)
|
||||
player_result = await db.execute(player_stmt)
|
||||
players = player_result.scalars().all()
|
||||
|
||||
new_game.players = [GamePlayerResponse.model_validate(p) for p in players]
|
||||
|
||||
Reference in New Issue
Block a user