major-domo-database/app/services
Cal Corum 56fca1fa03 fix: Fix CSV export, season filtering, and position matching in refactored services
Integration testing revealed three issues with the refactored service layer:

1. CSV Export Format
   - Nested team/sbaplayer dicts were being dumped as strings
   - Now flattens team to abbreviation, sbaplayer to ID
   - Matches original CSV format from pre-refactor code

2. Season=0 Filter
   - season=0 was filtering for WHERE season=0 (returns nothing)
   - Now correctly returns all seasons when season=0 or None
   - Affects 13,266 total players across all seasons

3. Generic Position "P"
   - pos=P returned no results (players have SP/RP/CP, not P)
   - Now expands P to match SP, RP, CP pitcher positions
   - Applied to both DB filtering and Python mock filtering

4. Roster Endpoint Enhancement
   - Added default /teams/{id}/roster endpoint (assumes 'current')
   - Existing /teams/{id}/roster/{which} endpoint unchanged

All changes maintain backward compatibility and pass integration tests.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-04 11:06:58 -06:00
..
__init__.py refactor: Extract services layer for testability 2026-02-03 15:38:34 +00:00
base.py Fix linting and formatting issues 2026-02-04 08:44:12 -06:00
interfaces.py fix: Complete dependency injection for PlayerService 2026-02-03 16:49:50 +00:00
mocks.py fix: Complete dependency injection refactor and restore caching 2026-02-04 01:13:46 -06:00
player_service.py fix: Fix CSV export, season filtering, and position matching in refactored services 2026-02-04 11:06:58 -06:00
team_service.py Fix linting and formatting issues 2026-02-04 08:44:12 -06:00