Loading src/open_exposure_gateway/core/state.py +2 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ from typing import Protocol from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession, async_sessionmaker from open_exposure_gateway.ports.databus_port import DataBusPort from open_exposure_gateway.ports.qod_callback_port import QodCallbackDeliveryPort from open_exposure_gateway.ports.srm_port import SRMClientPort Loading @@ -11,3 +12,4 @@ class AppState(Protocol): publisher: DataBusPort db_engine: AsyncEngine session_maker: async_sessionmaker[AsyncSession] qod_callback_client: QodCallbackDeliveryPort src/open_exposure_gateway/dependencies.py +30 −2 Original line number Diff line number Diff line Loading @@ -12,6 +12,9 @@ from open_exposure_gateway.adapters.database.repos.app_instances import ( from open_exposure_gateway.adapters.database.repos.app_registrations import ( SqlAppRegistrationRepository, ) from open_exposure_gateway.adapters.database.repos.callback_deliveries import ( SqlCallbackDeliveryRepository, ) from open_exposure_gateway.adapters.database.repos.callback_registrations import ( SqlCallbackRegistrationRepository, ) Loading @@ -29,12 +32,16 @@ from open_exposure_gateway.application.services.quality_on_demand_service import QualityOnDemandService, ) from open_exposure_gateway.core.state import AppState from open_exposure_gateway.ports.database.callbacks import CallbackRegistrationRepository from open_exposure_gateway.ports.database.callbacks import ( CallbackDeliveryRepository, CallbackRegistrationRepository, ) from open_exposure_gateway.ports.database.instances import AppInstanceRepository from open_exposure_gateway.ports.database.operations import OperationRepository from open_exposure_gateway.ports.database.qod_sessions import QodSessionRepository from open_exposure_gateway.ports.database.registration import AppRegistrationRepository from open_exposure_gateway.ports.databus_port import DataBusPort from open_exposure_gateway.ports.qod_callback_port import QodCallbackDeliveryPort from open_exposure_gateway.ports.srm_port import SRMClientPort Loading Loading @@ -119,6 +126,14 @@ def get_qod_session_repo(session: SessionDep) -> QodSessionRepository: return SqlQodSessionRepository(session) def get_callback_delivery_repo(session: SessionDep) -> CallbackDeliveryRepository: return SqlCallbackDeliveryRepository(session) def get_qod_callback_client(request: Request) -> QodCallbackDeliveryPort: return get_app_state(request=request).qod_callback_client def get_edge_app_service( srm: SRMClientPort = Depends(get_client), publisher: DataBusPort = Depends(get_publisher), Loading @@ -144,5 +159,18 @@ def get_qod_service( publisher: DataBusPort = Depends(get_publisher), operation_repo: OperationRepository = Depends(get_operation_repo), qod_session_repo: QodSessionRepository = Depends(get_qod_session_repo), callback_registration_repo: CallbackRegistrationRepository = Depends( get_callback_registration_repo ), callback_delivery_repo: CallbackDeliveryRepository = Depends(get_callback_delivery_repo), callback_delivery_port: QodCallbackDeliveryPort = Depends(get_qod_callback_client), ) -> QualityOnDemandService: return QualityOnDemandService(srm, publisher, operation_repo, qod_session_repo) return QualityOnDemandService( srm, publisher, operation_repo, qod_session_repo, callback_registration_repo, callback_delivery_repo, callback_delivery_port, ) Loading
src/open_exposure_gateway/core/state.py +2 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ from typing import Protocol from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession, async_sessionmaker from open_exposure_gateway.ports.databus_port import DataBusPort from open_exposure_gateway.ports.qod_callback_port import QodCallbackDeliveryPort from open_exposure_gateway.ports.srm_port import SRMClientPort Loading @@ -11,3 +12,4 @@ class AppState(Protocol): publisher: DataBusPort db_engine: AsyncEngine session_maker: async_sessionmaker[AsyncSession] qod_callback_client: QodCallbackDeliveryPort
src/open_exposure_gateway/dependencies.py +30 −2 Original line number Diff line number Diff line Loading @@ -12,6 +12,9 @@ from open_exposure_gateway.adapters.database.repos.app_instances import ( from open_exposure_gateway.adapters.database.repos.app_registrations import ( SqlAppRegistrationRepository, ) from open_exposure_gateway.adapters.database.repos.callback_deliveries import ( SqlCallbackDeliveryRepository, ) from open_exposure_gateway.adapters.database.repos.callback_registrations import ( SqlCallbackRegistrationRepository, ) Loading @@ -29,12 +32,16 @@ from open_exposure_gateway.application.services.quality_on_demand_service import QualityOnDemandService, ) from open_exposure_gateway.core.state import AppState from open_exposure_gateway.ports.database.callbacks import CallbackRegistrationRepository from open_exposure_gateway.ports.database.callbacks import ( CallbackDeliveryRepository, CallbackRegistrationRepository, ) from open_exposure_gateway.ports.database.instances import AppInstanceRepository from open_exposure_gateway.ports.database.operations import OperationRepository from open_exposure_gateway.ports.database.qod_sessions import QodSessionRepository from open_exposure_gateway.ports.database.registration import AppRegistrationRepository from open_exposure_gateway.ports.databus_port import DataBusPort from open_exposure_gateway.ports.qod_callback_port import QodCallbackDeliveryPort from open_exposure_gateway.ports.srm_port import SRMClientPort Loading Loading @@ -119,6 +126,14 @@ def get_qod_session_repo(session: SessionDep) -> QodSessionRepository: return SqlQodSessionRepository(session) def get_callback_delivery_repo(session: SessionDep) -> CallbackDeliveryRepository: return SqlCallbackDeliveryRepository(session) def get_qod_callback_client(request: Request) -> QodCallbackDeliveryPort: return get_app_state(request=request).qod_callback_client def get_edge_app_service( srm: SRMClientPort = Depends(get_client), publisher: DataBusPort = Depends(get_publisher), Loading @@ -144,5 +159,18 @@ def get_qod_service( publisher: DataBusPort = Depends(get_publisher), operation_repo: OperationRepository = Depends(get_operation_repo), qod_session_repo: QodSessionRepository = Depends(get_qod_session_repo), callback_registration_repo: CallbackRegistrationRepository = Depends( get_callback_registration_repo ), callback_delivery_repo: CallbackDeliveryRepository = Depends(get_callback_delivery_repo), callback_delivery_port: QodCallbackDeliveryPort = Depends(get_qod_callback_client), ) -> QualityOnDemandService: return QualityOnDemandService(srm, publisher, operation_repo, qod_session_repo) return QualityOnDemandService( srm, publisher, operation_repo, qod_session_repo, callback_registration_repo, callback_delivery_repo, callback_delivery_port, )