From 1e115ba3dee7a63f9b2ebe4e56fb2f4a22da03f7 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Tue, 19 May 2026 11:09:01 +0000 Subject: [PATCH] =?UTF-8?q?Coordination=20Hub=20fallback=20stores=20correc?= =?UTF-8?q?t=20file=5Fsource=20in=20DB=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/pashub_fetcher/pashub_service.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/backend/pashub_fetcher/pashub_service.py b/backend/pashub_fetcher/pashub_service.py index 13498a32..f7f6ccd9 100644 --- a/backend/pashub_fetcher/pashub_service.py +++ b/backend/pashub_fetcher/pashub_service.py @@ -60,9 +60,10 @@ class PashubService: else: try: uprn = active_client.get_uprn_by_job_id(job_id) - logger.info(f"Failed to access job {job_id} with PasHub credentials") except UnauthorizedError: - logger.info(f"Trying CoordinationHub credentials for job {job_id}") + logger.info( + f"PasHub credentials unauthorized for job {job_id}; retrying with CoordinationHub credentials" + ) active_client = self._get_coordination_client() uprn = active_client.get_uprn_by_job_id(job_id) @@ -85,8 +86,13 @@ class PashubService: if uprn or hubspot_deal_id: logger.info("Uploading files to s3") + file_source = ( + FileSourceEnum.PAS_HUB + if active_client is self._pashub_client + else FileSourceEnum.COORDINATION_HUB + ) upload_records = self._upload_to_s3_and_update_db( - job_files, uprn, hubspot_deal_id + job_files, uprn, hubspot_deal_id, file_source ) self._save_site_notes(upload_records) @@ -108,6 +114,7 @@ class PashubService: job_files: List[str], uprn: Optional[str], hubspot_deal_id: Optional[str], + file_source: FileSourceEnum, ) -> List[_FileUploadRecord]: if not uprn and not hubspot_deal_id: return [] @@ -133,7 +140,7 @@ class PashubService: s3_upload_timestamp=datetime.now(timezone.utc), uprn=int(uprn) if uprn else None, hubspot_deal_id=hubspot_deal_id, - file_source=FileSourceEnum.PAS_HUB.value, + file_source=file_source.value, file_type=get_file_type_string(filename), ) file_paths.append(file_path)