refactor: reformat code

This commit is contained in:
maxDorninger
2025-05-29 13:54:18 +02:00
parent b7c32f24b9
commit a51716db7d
28 changed files with 806 additions and 337 deletions

View File

@@ -12,8 +12,19 @@ from backend.src.database.config import DbConfig
log = logging.getLogger(__name__)
config = DbConfig()
db_url = "postgresql+psycopg" + "://" + config.USER + ":" + config.PASSWORD + "@" + config.HOST + ":" + str(
config.PORT) + "/" + config.DBNAME
db_url = (
"postgresql+psycopg"
+ "://"
+ config.USER
+ ":"
+ config.PASSWORD
+ "@"
+ config.HOST
+ ":"
+ str(config.PORT)
+ "/"
+ config.DBNAME
)
engine = create_engine(db_url, echo=False)
log.debug("initializing sqlalchemy declarative base")
@@ -21,7 +32,6 @@ Base = declarative_base()
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
def init_db() -> None:
log.debug("initializing database with following tables")
for table in Base.metadata.tables:
@@ -41,7 +51,7 @@ def get_session() -> Generator[Session, Any, None]:
db.close()
db_session: ContextVar[Session] = ContextVar('db_session')
db_session: ContextVar[Session] = ContextVar("db_session")
DbSessionDependency = Annotated[Session, Depends(get_session)]