486749a890
Full-stack Dutch supermarket price tracker with FastAPI backend, PostgreSQL/SQLAlchemy, Albert Heijn scraper, and Next.js frontend. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
20 lines
565 B
Python
20 lines
565 B
Python
from fastapi import APIRouter, Depends, Query
|
|
from sqlalchemy import select
|
|
from sqlalchemy.orm import Session
|
|
|
|
from ..database import get_db
|
|
from ..models import ScrapeRun
|
|
from ..schemas import ScrapeRun as ScrapeRunSchema
|
|
|
|
router = APIRouter(prefix="/api/scrape-runs", tags=["scrape-runs"])
|
|
|
|
|
|
@router.get("", response_model=list[ScrapeRunSchema])
|
|
def list_scrape_runs(
|
|
limit: int = Query(default=20, le=100),
|
|
db: Session = Depends(get_db),
|
|
):
|
|
return db.scalars(
|
|
select(ScrapeRun).order_by(ScrapeRun.started_at.desc()).limit(limit)
|
|
).all()
|