25 lines
925 B
Python
25 lines
925 B
Python
"""Keyword endpoints (section 17: additive) -- a directory for the
|
|||
|
|
`keyword` filter GET /movies and GET /series accept, with no prior way to
|
||
|
|
discover what those ids are. Mirrors app/api/v1/genres.py exactly."""
|
||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from fastapi import APIRouter, Depends, Query
|
||
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||
|
|
|
||
|
|
from app.core.database import get_db
|
||
|
|
from app.core.security import enforce_rate_limit
|
||
|
|
from app.schemas.common import KeywordListOut
|
||
|
|
from app.services import keyword_service
|
||
|
|
|
||
|
|
router = APIRouter(prefix="/keywords", tags=["keywords"], dependencies=[Depends(enforce_rate_limit)])
|
||
|
|
|
||
|
|
|
||
|
|
@router.get("", response_model=KeywordListOut)
|
||
|
|
async def list_keywords(
|
||
|
|
page: int = Query(1, ge=1),
|
||
|
|
page_size: int = Query(50, ge=1, le=200),
|
||
|
|
session: AsyncSession = Depends(get_db),
|
||
|
|
) -> KeywordListOut:
|
||
|
|
return await keyword_service.list_keywords(session, page=page, page_size=page_size)
|