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
|
|
|
|
|
|
2026-07-23 13:18:39 +08:00
|
|
|
|
2026-07-27 13:09:41 +08:00
|
|
|
SessionDep = Annotated[Session, Depends(get_session)]
|