major-domo-database/app/routers_v3/stratplay/CLAUDE.md
Cal Corum bcdde572e8 docs: Add subdirectory CLAUDE.md files for routers, stratplay, and services
Provide targeted context for each app subdirectory so Claude Code
understands local patterns without relying on the root CLAUDE.md.
Also simplifies root CLAUDE.md dev/prod environment sections.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 17:32:25 -06:00

1.1 KiB

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