diff --git a/src/calculation_time_constrains/router.py b/src/calculation_time_constrains/router.py index 82004f3..e48f2e7 100644 --- a/src/calculation_time_constrains/router.py +++ b/src/calculation_time_constrains/router.py @@ -2,7 +2,9 @@ from typing import List, Optional, Union from fastapi import APIRouter from fastapi.params import Query +import requests +from src import config from src.auth.service import CurrentUser, InternalKey, Token from src.config import DEFAULT_TC_ID from src.database.core import DbSession @@ -93,6 +95,10 @@ async def get_calculation_results(db_session: DbSession, calculation_id, token:I results = await get_calculation_result( db_session=db_session, calculation_id=calculation_id, token=token, include_risk_cost=include_risk_cost ) + + requests.post(f"{config.AUTH_SERVICE_API}/sign-out", headers={ + "Authorization": f"Bearer {token}" + }) return StandardResponse( data=results, diff --git a/src/overhaul_scope/service.py b/src/overhaul_scope/service.py index dd1291e..4803132 100644 --- a/src/overhaul_scope/service.py +++ b/src/overhaul_scope/service.py @@ -161,7 +161,7 @@ async def get_overview_overhaul(*, db_session: DbSession): ) ) ongoing_result = await db_session.execute(ongoing_query.options(selectinload(OverhaulScope.maintenance_type))) - ongoing_overhaul = ongoing_result.first() + ongoing_overhaul = ongoing_result.scalar_one_or_none() # 2. If no ongoing overhaul, get the closest scheduled overhaul if ongoing_overhaul is None: