Commit Graph

16 Commits

Author SHA1 Message Date
Cal Corum
16f3f8d8de Fix unbounded API queries causing Gunicorn worker timeouts
All checks were successful
Build Docker Image / build (pull_request) Successful in 2m32s
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>
2026-04-01 17:23:25 -05:00
Cal Corum
9ec69f9f2c fix: standardize all collection POST routes to use trailing slash
All checks were successful
Build Docker Image / build (pull_request) Successful in 3m38s
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>
2026-03-09 19:34:28 -05:00
Cal Corum
8143913aa2 fix: assign order_by() return value in GET /api/v3/games (#24)
All checks were successful
Build Docker Image / build (pull_request) Successful in 4m41s
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>
2026-03-02 19:03:21 -06:00
Cal Corum
2c3835c8ac Added SeasonPitchingStats 2025-08-26 00:17:57 -05:00
Cal Corum
54a1a407d0 CLAUDE: Season batting stats table and selective update system
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>
2025-08-23 22:18:27 -05:00
Cal Corum
c05d00d60e DB Error Handling
Added error handling wrapper and fixed SQLite -> Postgres issues
2025-08-20 19:33:40 -05:00
Cal Corum
cd1321553e Logging updates 2024-12-16 09:03:23 -06:00
Cal Corum
4380c26319 Add Swagger support 2024-07-14 13:23:37 -05:00
Cal Corum
fae1439365 Season 9 Additions 2024-01-14 22:44:23 -06:00
Cal Corum
85c8b441fa Update standings calculations 2023-08-11 09:32:35 -05:00
Cal Corum
505d0a1a8a Add divisions, update standings 2023-08-05 00:28:00 -05:00
Cal Corum
302d3fe3ac add game_id param to decisions 2023-07-31 23:02:13 -05:00
Cal Corum
cc3ff1d071 Add managers to /games 2023-07-31 00:29:04 -05:00
Cal Corum
2d235eb6f0 add /wipe/game 2023-07-29 01:35:39 -05:00
Cal Corum
5a5146c1cf Added logging to each router 2023-07-26 14:06:21 -05:00
Cal Corum
dd027f7fa0 Added /games 2023-07-25 00:19:33 -05:00