Establishes foundation for migrating baseball simulation from Discord bot to web application using service-oriented architecture pattern. Key components: - FastAPI application structure with dependency injection - Service layer foundation with base classes and container - Comprehensive directory documentation with README files - PostgreSQL containerization with Docker Compose - Testing structure for unit/integration/e2e tests - Migration planning documentation - Rotating log configuration per user requirements Architecture follows Model/Service/Controller pattern to improve testability, maintainability, and scalability over original monolithic Discord app. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
30 lines
873 B
Python
30 lines
873 B
Python
"""
|
|
HTML page routes using Jinja2 templates.
|
|
Uses services following Model/Service Architecture.
|
|
"""
|
|
|
|
import logging
|
|
from fastapi import APIRouter, Request, Depends
|
|
from fastapi.templating import Jinja2Templates
|
|
from fastapi.responses import HTMLResponse
|
|
|
|
|
|
logger = logging.getLogger(f'{__name__}.pages_router')
|
|
router = APIRouter()
|
|
templates = Jinja2Templates(directory="app/templates")
|
|
|
|
|
|
@router.get("/", response_class=HTMLResponse)
|
|
async def home_page(request: Request):
|
|
"""Home page."""
|
|
return templates.TemplateResponse("home.html", {"request": request})
|
|
|
|
|
|
@router.get("/game/{game_id}", response_class=HTMLResponse)
|
|
async def game_page(request: Request, game_id: int):
|
|
"""Game interface page."""
|
|
# TODO: Get game data using GameService
|
|
return templates.TemplateResponse("game.html", {
|
|
"request": request,
|
|
"game_id": game_id
|
|
}) |