You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
424 B
Python

# backend/app/routers/people.py
from fastapi import APIRouter, Depends
from sqlmodel import Session, select
from ..db import get_session
from ..models import Person
from ..schemas import PersonOut
router = APIRouter() # prefix 없음. main.py 에서 prefix="/api" 등록.
@router.get("/people", response_model=list[PersonOut])
def list_people(s: Session = Depends(get_session)):
return s.exec(select(Person)).all()