Backend: - Add home_team_dice_color and away_team_dice_color to GameState model - Extract dice_color from game metadata in StateManager (default: cc0000) - Add runners_on_base param to roll_ab for chaos check skipping Frontend - Dice Display: - Create DiceShapes.vue with SVG d6 (square) and d20 (hexagon) shapes - Apply home team's dice_color to d6 dice, white for resolution d20 - Show chaos d20 in amber only when WP/PB check triggered - Add automatic text contrast based on color luminance - Reduce blank space and remove info bubble from dice results Frontend - Player Cards: - Consolidate pitcher/batter cards to single location below diamond - Add active card highlighting based on dice roll (d6_one: 1-3=batter, 4-6=pitcher) - New card header format: [Team] Position [Name] with full card image - Remove redundant card displays from GameBoard and GameplayPanel - Enlarge PlayerCardModal on desktop (max-w-3xl at 1024px+) Tests: - Add DiceShapes.spec.ts with 34 tests for color calculations and rendering - Update DiceRoller.spec.ts for new DiceShapes integration - Fix test_roll_dice_success for new runners_on_base parameter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| .claude | ||
| .git-hooks | ||
| alembic | ||
| app | ||
| scripts | ||
| terminal_client | ||
| tests | ||
| .dockerignore | ||
| .env.dev | ||
| .env.example | ||
| .env.prod | ||
| .gitignore | ||
| alembic.ini | ||
| CLAUDE.md | ||
| clean_test_data.py | ||
| docker-compose.yml | ||
| Dockerfile | ||
| mypy.ini | ||
| pyproject.toml | ||
| pyrightconfig.json | ||
| pytest.ini | ||
| README.md | ||
| requirements-dev.txt | ||
| requirements.txt | ||
| TEST_COVERAGE_SUMMARY.md | ||
| test_db_playground.py | ||
| test_pd_api_live.py | ||
| test_pd_api_mock.py | ||
| test_redis_cache.py | ||
| uv.lock | ||
Paper Dynasty Backend
FastAPI-based real-time baseball game engine with WebSocket support.
Quick Start
# Install UV
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install dependencies
uv sync
# Apply database migrations
uv run alembic upgrade head
# Run server
uv run python -m app.main
Database Migrations
This project uses Alembic for database schema migrations.
Initial Setup (New Database)
# Apply all migrations to create schema
uv run alembic upgrade head
Creating New Migrations
# Auto-generate from model changes
uv run alembic revision --autogenerate -m "Description of changes"
# IMPORTANT: Always review the generated migration before applying!
# Then apply:
uv run alembic upgrade head
Viewing Migration Status
# Show migration history
uv run alembic history
# Show current revision
uv run alembic current
Rolling Back
# Rollback one migration
uv run alembic downgrade -1
# Rollback to specific revision
uv run alembic downgrade 001
# Rollback all (dangerous!)
uv run alembic downgrade base
Migration Best Practices
- Always review auto-generated migrations before applying - autogenerate is helpful but not perfect
- Test migrations on dev/staging before production
- Keep migrations small and focused - easier to rollback
- Never edit migrations that have been applied to shared databases
- Include both upgrade and downgrade for reversibility
Existing Migrations
| Revision | Description |
|---|---|
| 001 | Initial schema (games, plays, lineups, rolls, etc.) |
| 004 | Materialized views for statistics |
Documentation
See CLAUDE.md for full documentation.