Add MAX_LIMIT=500 cap across all list endpoints, empty string
stripping middleware, and limit/offset to /transactions. Resolves#98.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
aiohttp follows 307 redirects but converts POST to GET, silently
dropping the request body. Standardize all @router.post('') to
@router.post('/') so the canonical URL always has a trailing slash,
preventing 307 redirects when clients POST with trailing slashes.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Peewee's order_by() returns a new queryset and does not sort in place.
Both branches were discarding the result, so the sort parameter had no
effect. Assign back to all_games so the query is actually ordered.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Major database enhancement implementing fast-querying season batting stats:
Database Schema:
- Created seasonbattingstats table with composite primary key (player_id, season)
- All batting stats (counting + calculated): pa, ab, avg, obp, slg, ops, woba, etc.
- Proper foreign key constraints and performance indexes
- Production-ready SQL creation script included
Selective Update System:
- update_season_batting_stats() function with PostgreSQL upsert logic
- Triggers on game PATCH operations to update affected player stats
- Recalculates complete season stats from stratplay data
- Efficient updates of only players who participated in modified games
API Enhancements:
- Enhanced SeasonBattingStats.get_top_hitters() with full filtering support
- New /api/v3/views/season-stats/batting/refresh endpoint for season rebuilds
- Updated views endpoint to use centralized get_top_hitters() method
- Support for team, player, min PA, and pagination filtering
Infrastructure:
- Production database sync Docker service with SSH automation
- Comprehensive error handling and logging throughout
- Fixed Peewee model to match actual table structure (no auto-id)
- Updated CLAUDE.md with dev server info and sync commands
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>