Implemented CLEAN architecture with clear separation of concerns: - Domain layer with entities (Player, Team, Stats, FantasyTeam) and repository interfaces - Application layer with use case implementations - Infrastructure layer with NHL API and Yahoo Fantasy API adapters - Presentation layer with FastAPI configuration and dependency injection Key features: - Swappable data source adapters (NHL API, Yahoo Fantasy API) - Repository pattern for data access abstraction - Dependency injection for loose coupling - FastAPI framework with async support - PostgreSQL database configuration - Environment-based configuration management Technology stack: Python 3.11+, FastAPI, PostgreSQL, nhl-api-py, yfpy 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
32 lines
980 B
Python
32 lines
980 B
Python
"""Fantasy team repository interface."""
|
|
from abc import ABC, abstractmethod
|
|
from typing import List, Optional
|
|
|
|
from src.domain.entities import FantasyTeam
|
|
|
|
|
|
class FantasyRepository(ABC):
|
|
"""Abstract interface for Yahoo Fantasy Hockey data access."""
|
|
|
|
@abstractmethod
|
|
async def get_fantasy_team(
|
|
self, league_id: str, team_id: str
|
|
) -> Optional[FantasyTeam]:
|
|
"""Retrieves a specific fantasy team from a league."""
|
|
pass
|
|
|
|
@abstractmethod
|
|
async def get_user_teams(self, user_id: str) -> List[FantasyTeam]:
|
|
"""Retrieves all fantasy teams for a user."""
|
|
pass
|
|
|
|
@abstractmethod
|
|
async def get_team_roster(self, league_id: str, team_id: str) -> List[str]:
|
|
"""Retrieves the player IDs on a fantasy team's roster."""
|
|
pass
|
|
|
|
@abstractmethod
|
|
async def get_league_standings(self, league_id: str) -> List[FantasyTeam]:
|
|
"""Retrieves all teams in a league ordered by standings."""
|
|
pass
|