# Stratplay Router (sub-package) Play-by-play data for Strat-o-Matic games. Mounted at `/api/v3/plays`. ## Structure | File | Purpose | |------|---------| | `__init__.py` | Assembles sub-routers into parent `router` | | `common.py` | Shared `build_season_games()` filter builder | | `models.py` | Pydantic models (`PlayModel`, `POS_LIST` literal) | | `plays.py` | General play queries | | `batting.py` | Batting stats aggregated from plays | | `pitching.py` | Pitching stats aggregated from plays | | `fielding.py` | Fielding stats aggregated from plays | | `crud.py` | POST/PATCH/DELETE operations (auth required) | ## Key Patterns - All stat endpoints use `build_season_games()` from `common.py` for consistent filtering - Filter params: `season`, `week`, `s_type` (regular/post), `week_start`/`week_end`, `manager_id` - `week` and `s_type` are mutually exclusive; `week` and `week_start`/`week_end` are mutually exclusive - Stats aggregate from `StratPlay` joined to `StratGame` via `game_id` - CRUD writes trigger `update_season_batting_stats()` / `update_season_pitching_stats()` from `dependencies.py`