# Services Layer Business logic extracted from routers for testability. Uses dependency injection. ## Architecture - `interfaces.py` — Protocol classes (`AbstractPlayerRepository`, `AbstractTeamRepository`, `AbstractCacheService`) - `base.py` — `BaseService` with lazy-loaded default repos (imports from `db_engine` on first access) - `mocks.py` — Mock implementations for testing without DB/Redis - `player_service.py`, `team_service.py` — Domain services (class methods, no instance needed for reads) ## Key Patterns - Services use `@staticmethod`/`@classmethod` for read operations (no instantiation needed) - Default repos are created lazily inside `@property` methods to avoid circular imports with `db_engine` - For testing: pass mock repos via `ServiceConfig` or constructor kwargs - Only `players` and `teams` routers currently use the service layer; others call `db_engine` directly