CI / lint (push) Canceled after 0s
CI / typecheck (push) Canceled after 0s
CI / unit-tests (push) Canceled after 0s
CI / integration-tests (push) Canceled after 0s
CI / container-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
Production-grade media metadata backend per docs/aurora-core-spec.md: Aurora-owned UUIDv7 identity system, normalized movie/TV/people/credits schema, provider abstraction with a TMDb adapter, an idempotent async ingestion pipeline (normalize -> match -> upsert -> provenance), a Postgres FTS/trigram search layer, a stateless FastAPI v1 API with Redis caching/rate-limiting, arq workers, dev/prod Docker Compose topologies, unit + integration + load tests, CI, and architecture/ database/API/ERD documentation. Co-Authored-By: Claude Sonnet 5 <[email protected]>
26 lines
912 B
Python
26 lines
912 B
Python
"""Search endpoint (section 16, section 17)."""
|
|
|
|
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.search import SearchResultsOut
|
|
from app.services.search.postgresql_provider import PostgreSQLSearchProvider
|
|
from app.services.search.service import SearchService
|
|
|
|
router = APIRouter(prefix="/search", tags=["search"], dependencies=[Depends(enforce_rate_limit)])
|
|
|
|
_search_service = SearchService(PostgreSQLSearchProvider())
|
|
|
|
|
|
@router.get("", response_model=SearchResultsOut)
|
|
async def search(
|
|
q: str = Query(..., min_length=1, max_length=300),
|
|
limit: int = Query(10, ge=1, le=50),
|
|
session: AsyncSession = Depends(get_db),
|
|
) -> SearchResultsOut:
|
|
return await _search_service.search(session, q, limit_per_type=limit)
|