Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
♻️ Use new SQLModel session
  • Loading branch information
tiangolo committed Nov 24, 2023
commit 0cf8be981fdccac9f581b77e888c36ebdfc57491
9 changes: 3 additions & 6 deletions src/backend/app/app/api/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,16 @@
from app import crud, models, schemas
from app.core import security
from app.core.config import settings
from app.db.session import SessionLocal
from app.db.engine import engine

reusable_oauth2 = OAuth2PasswordBearer(
tokenUrl=f"{settings.API_V1_STR}/login/access-token"
)


def get_db() -> Generator:
try:
db = SessionLocal()
yield db
finally:
db.close()
with Session(engine) as session:
yield session


def get_current_user(
Expand Down