diff --git a/backend/forum.py b/backend/forum.py index a526450..b715e7f 100644 --- a/backend/forum.py +++ b/backend/forum.py @@ -1,6 +1,6 @@ from fastapi import FastAPI import models -from database import engine +from database import engine, SessionLocal from pydantic import BaseModel app = FastAPI() @@ -8,6 +8,14 @@ app = FastAPI() models.Base.metadata.create_all(bind=engine) +def get_db(): + db = SessionLocal() + try: + yield db + finally: + db.close() + + class Post: """Post is a single forum post or reply""" id: int