27 lines
900 B
Python
27 lines
900 B
Python
"""Collection/franchise 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.collection import CollectionDetailOut
|
||
|
|
from app.services import collection_service
|
||
|
|
|
||
|
|
router = APIRouter(
|
||
|
|
prefix="/collections", tags=["collections"], dependencies=[Depends(enforce_rate_limit)]
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
@router.get("/{aurora_id}", response_model=CollectionDetailOut)
|
||
|
|
async def get_collection(
|
||
|
|
aurora_id: str, session: AsyncSession = Depends(get_db)
|
||
|
|
) -> CollectionDetailOut:
|
||
|
|
try:
|
||
|
|
return await collection_service.get_collection_detail(session, aurora_id)
|
||
|
|
except collection_service.CollectionNotFoundError as exc:
|
||
|
|
raise not_found("collection", aurora_id) from exc
|