paper-dynasty-gameplay-webapp/app/config/constants.py
Cal Corum c09f9d1302 CLAUDE: Initialize Paper Dynasty web app with Model/Service Architecture
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>
2025-09-27 21:44:12 -05:00

122 lines
4.1 KiB
Python

"""
Application constants and configuration values.
Migrated from Discord app constants.py
"""
import os
from typing import Optional, Literal
class Settings:
"""Application settings and configuration."""
# Database settings
DATABASE_URL: str = os.getenv(
"DATABASE_URL",
"postgresql+psycopg://paper_dynasty_user:paper_dynasty_dev_password@localhost:5432/paper_dynasty"
)
DATABASE_TEST_URL: str = os.getenv(
"DATABASE_TEST_URL",
"postgresql+psycopg://paper_dynasty_user:paper_dynasty_dev_password@localhost:5432/paper_dynasty_test"
)
# Discord OAuth settings
DISCORD_CLIENT_ID: Optional[str] = os.getenv("DISCORD_CLIENT_ID")
DISCORD_CLIENT_SECRET: Optional[str] = os.getenv("DISCORD_CLIENT_SECRET")
DISCORD_REDIRECT_URI: Optional[str] = os.getenv("DISCORD_REDIRECT_URI")
# Security settings
SECRET_KEY: str = os.getenv("SECRET_KEY", "development-secret-key-change-in-production")
SESSION_EXPIRE_HOURS: int = int(os.getenv("SESSION_EXPIRE_HOURS", "24"))
# Application settings
DEBUG: bool = os.getenv("DEBUG", "false").lower() == "true"
ENVIRONMENT: str = os.getenv("ENVIRONMENT", "development")
# Game settings
MAX_CONCURRENT_GAMES: int = int(os.getenv("MAX_CONCURRENT_GAMES", "100"))
GAME_TIMEOUT_HOURS: int = int(os.getenv("GAME_TIMEOUT_HOURS", "4"))
# Global settings instance
settings = Settings()
# Constants migrated from Discord app
class GameConstants:
"""Game constants migrated from Discord app constants.py"""
# Season Configuration (from Discord app)
SBA_SEASON = 11
PD_SEASON = 9
LIVE_CARDSET_ID = 24
LIVE_PROMO_CARDSET_ID = 25
MAX_CARDSET_ID = 30
# Ranked cardsets for web app
RANKED_CARDSETS = [20, 21, 22, 17, 18, 19]
# Application Configuration
SBA_COLOR = 'a6ce39'
PD_PLAYERS = 'Paper Dynasty Players'
# External URLs and Resources
PD_IMAGE_BUCKET = 'https://paper-dynasty.s3.us-east-1.amazonaws.com/static-images'
# Player Rarity Values (from Discord app)
RARITY = {
'HoF': 8,
'MVP': 5,
'All-Star': 3,
'Starter': 2,
'Reserve': 1,
'Replacement': 0
}
# Color Definitions
COLORS = {
'sba': int('a6ce39', 16),
'yellow': int('FFEA00', 16),
'red': int('C70039', 16),
'white': int('FFFFFF', 16)
}
# MLB Teams Lookup (migrated from Discord app)
ALL_MLB_TEAMS = {
'Arizona Diamondbacks': ['ARI', 'Diamondbacks'],
'Atlanta Braves': ['ATL', 'MLN', 'Braves'],
'Baltimore Orioles': ['BAL', 'Orioles'],
'Boston Red Sox': ['BOS', 'Red Sox'],
'Chicago Cubs': ['CHC', 'Cubs'],
'Chicago White Sox': ['CHW', 'White Sox'],
'Cincinnati Reds': ['CIN', 'Reds'],
'Cleveland Guardians': ['CLE', 'Guardians'],
'Colorado Rockies': ['COL', 'Rockies'],
'Detroit Tigers': ['DET', 'Tigers'],
'Houston Astros': ['HOU', 'Astros'],
'Kansas City Royals': ['KCR', 'Royals'],
'Los Angeles Angels': ['LAA', 'CAL', 'Angels'],
'Los Angeles Dodgers': ['LAD', 'Dodgers'],
'Miami Marlins': ['MIA', 'Marlins'],
'Milwaukee Brewers': ['MIL', 'MKE', 'Brewers'],
'Minnesota Twins': ['MIN', 'Twins'],
'New York Mets': ['NYM', 'Mets'],
'New York Yankees': ['NYY', 'Yankees'],
'Oakland Athletics': ['OAK', 'Athletics'],
'Philadelphia Phillies': ['PHI', 'Phillies'],
'Pittsburgh Pirates': ['PIT', 'Pirates'],
'San Diego Padres': ['SDP', 'Padres'],
'Seattle Mariners': ['SEA', 'Mariners'],
'San Francisco Giants': ['SFG', 'Giants'],
'St Louis Cardinals': ['STL', 'Cardinals'],
'Tampa Bay Rays': ['TBR', 'Rays'],
'Texas Rangers': ['TEX', 'Senators', 'Rangers'],
'Toronto Blue Jays': ['TOR', 'Jays'],
'Washington Nationals': ['WSN', 'WAS', 'Nationals'],
}
# Type Definitions (from Discord app)
DEFENSE_LITERAL = Literal['Pitcher', 'Catcher', 'First Base', 'Second Base', 'Third Base', 'Shortstop', 'Left Field', 'Center Field', 'Right Field']
DEFENSE_NO_PITCHER_LITERAL = Literal['Catcher', 'First Base', 'Second Base', 'Third Base', 'Shortstop', 'Left Field', 'Center Field', 'Right Field']