diff --git a/sql_app/main.py b/sql_app/main.py index 61ffeea..1f7f63b 100644 --- a/sql_app/main.py +++ b/sql_app/main.py @@ -4,6 +4,9 @@ from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine +from typing import List + + models.Base.metadata.create_all(bind=engine) app = FastAPI() @@ -26,7 +29,7 @@ def create_user(user: schemas.UserCreate, db: Session = Depends(get_db)): return crud.create_user(db=db, user=user) -@app.get("/users/", response_model=list[schemas.User]) +@app.get("/users/", response_model=List[schemas.User]) def read_users(skip: int = 0, limit: int = 100, db: Session = Depends(get_db)): users = crud.get_users(db, skip=skip, limit=limit) return users