Added auth

This commit is contained in:
2022-05-29 00:31:32 +02:00
parent 36bb9eeefa
commit 23d514050d
19 changed files with 815 additions and 59 deletions

14
api/schema/extensions.py Normal file
View File

@@ -0,0 +1,14 @@
from strawberry.extensions import Extension
from api.database import SessionLocal
class SQLAlchemySession(Extension):
def on_request_start(self):
self.execution_context.context["db"] = SessionLocal()
def on_request_end(self):
self.execution_context.context["db"].close()
extensions = (SQLAlchemySession,)