23 lines
806 B
Python
23 lines
806 B
Python
"""Season endpoints (section 17)."""
|
|||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from fastapi import APIRouter, Depends
|
||
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||
|
|
|
||
|
|
from app.api.deps import not_found
|
||
|
|
from app.core.database import get_db
|
||
|
|
from app.core.security import enforce_rate_limit
|
||
|
|
from app.schemas.tv import SeasonDetailOut
|
||
|
|
from app.services import tv_service
|
||
|
|
|
||
|
|
router = APIRouter(prefix="/seasons", tags=["seasons"], dependencies=[Depends(enforce_rate_limit)])
|
||
|
|
|
||
|
|
|
||
|
|
@router.get("/{aurora_id}", response_model=SeasonDetailOut)
|
||
|
|
async def get_season(aurora_id: str, session: AsyncSession = Depends(get_db)) -> SeasonDetailOut:
|
||
|
|
try:
|
||
|
|
return await tv_service.get_season_detail(session, aurora_id)
|
||
|
|
except tv_service.SeasonNotFoundError as exc:
|
||
|
|
raise not_found("season", aurora_id) from exc
|