from collections.abc import Iterable from dataclasses import dataclass from anydi import singleton from dmp.app_connections.enums import AppConnectionPlatform from dmp.app_connections.services import AppConnectionService from dmp.google.repositories import GoogleAdReportingConnectionRepository @dataclass class SyncGoogleFivetranTablesStateRequest: fivetran_connection_id: str | None @singleton class SyncGoogleFivetranTablesStateHandler: def __init__( self, ad_reporting_connection_repository: GoogleAdReportingConnectionRepository, app_connection_service: AppConnectionService, ) -> None: self.ad_reporting_connection_repository = ad_reporting_connection_repository self.app_connection_service = app_connection_service def handle(self, request: SyncGoogleFivetranTablesStateRequest) -> Iterable[str]: return self.app_connection_service.sync_fivetran_tables_state( platform=AppConnectionPlatform.GOOGLE, connection_repository=self.ad_reporting_connection_repository, fivetran_connection_id=request.fivetran_connection_id, )