12345678910111213141516171819202122 |
- from fastapi import APIRouter, Depends
- from sqlalchemy.orm import Session
- from app.api.dependencies.db import get_db
- from app.crud.crud_item import get_items
- from app.schemas.item import Item
- router = APIRouter()
- @router.get("/", response_model=list[Item])
- def read_items(
- skip: int = 0,
- limit: int = 100,
- db: Session = Depends(get_db),
- ):
- """
- Retrieve items.
- """
- items = get_items(db, skip=skip, limit=limit)
- return items
|