2026-07-22 13:22:32 +08:00
|
|
|
from typing import Annotated
|
|
|
|
|
|
|
|
|
|
from fastapi import Depends
|
|
|
|
|
from sqlalchemy.orm import Session
|
|
|
|
|
|
|
|
|
|
from database import engine
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_session():
|
|
|
|
|
with Session(engine, expire_on_commit=False) as session:
|
|
|
|
|
yield session
|
|
|
|
|
|
|
|
|
|
SessionDep = Annotated[
|
2026-07-23 13:18:39 +08:00
|
|
|
Session,
|
|
|
|
|
Depends(get_session)
|
|
|
|
|
]
|
|
|
|
|
|