Fixes to translation services

This commit is contained in:
Vasilije 2024-07-24 16:59:58 +02:00
parent 36e156e80a
commit e7b0e712b7
2 changed files with 4 additions and 12 deletions

View file

@ -83,9 +83,6 @@ app.include_router(
)
app.include_router(permission_router, prefix="/manage", tags=["management"])
@app.get("/authenticated-route")
async def authenticated_route(user: User = Depends(current_active_user)):
return {"message": f"Hello {user.email}!"}
@asynccontextmanager
async def lifespan(app: FastAPI):

View file

@ -9,25 +9,20 @@ class SQLAlchemyAdapter():
# self.engine = create_engine(f"{db_type}:///{self.db_location}")
if db_type == "duckdb":
self.engine = create_engine(f"duckdb:///{self.db_location}")
self.Session = sessionmaker(bind=self.engine)
self.sessionmaker = sessionmaker(bind=self.engine)
else:
print("Name: ", db_name)
print("User: ", db_user)
print("Password: ", db_password)
print("Host: ", db_host)
print("Port: ", db_port)
self.engine = create_async_engine(f"postgresql+asyncpg://{db_user}:{db_password}@{db_host}:{db_port}/{db_name}")
self.Session = sessionmaker(bind=self.engine, class_=AsyncSession, expire_on_commit=False)
self.sessionmaker = sessionmaker(bind=self.engine, class_=AsyncSession, expire_on_commit=False)
async def get_async_session(self):
async_session_maker = self.Session
async_session_maker = self.sessionmaker
async with async_session_maker() as session:
yield session
def get_session(self):
session_maker = self.Session
session_maker = self.sessionmaker
with session_maker() as session:
yield session