Commit 8fe2a7bb authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

fix

parent 37a5d2c0
......@@ -62,10 +62,16 @@ Base = declarative_base()
Session = scoped_session(SessionLocal)
from contextlib import contextmanager
# Dependency
def get_db():
def get_session():
db = SessionLocal()
try:
yield db
finally:
db.close()
get_db = contextmanager(get_session)
......@@ -119,6 +119,7 @@ class ToolsTable:
return None
def get_tools(self) -> List[ToolModel]:
with get_db() as db:
return [ToolModel.model_validate(tool) for tool in db.query(Tool).all()]
def get_tool_valves_by_id(self, id: str) -> Optional[dict]:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment