From b641ac6c5531bb23c1f1cee72eec72ad64f98721 Mon Sep 17 00:00:00 2001 From: chihlasm Date: Fri, 10 Apr 2026 06:44:17 +0000 Subject: [PATCH] fix: set account_id on session_supporting_data, session_resolution_outputs, maintenance_schedules, psa_post_log constructors Co-Authored-By: Claude Sonnet 4.6 --- backend/app/api/endpoints/maintenance_schedules.py | 1 + backend/app/api/endpoints/supporting_data.py | 1 + backend/app/services/psa_documentation_service.py | 2 ++ backend/app/services/resolution_output_generator.py | 1 + 4 files changed, 5 insertions(+) diff --git a/backend/app/api/endpoints/maintenance_schedules.py b/backend/app/api/endpoints/maintenance_schedules.py index 506da0e3..d43980a9 100644 --- a/backend/app/api/endpoints/maintenance_schedules.py +++ b/backend/app/api/endpoints/maintenance_schedules.py @@ -69,6 +69,7 @@ async def create_schedule( schedule = MaintenanceSchedule( tree_id=data.tree_id, + account_id=current_user.account_id, created_by=current_user.id, cron_expression=data.cron_expression, timezone=data.timezone, diff --git a/backend/app/api/endpoints/supporting_data.py b/backend/app/api/endpoints/supporting_data.py index b7d0a33a..ae8c5d79 100644 --- a/backend/app/api/endpoints/supporting_data.py +++ b/backend/app/api/endpoints/supporting_data.py @@ -103,6 +103,7 @@ async def create_supporting_data( item = SessionSupportingData( session_id=session_id, + account_id=session.account_id, label=data.label, data_type=data.data_type, content=data.content, diff --git a/backend/app/services/psa_documentation_service.py b/backend/app/services/psa_documentation_service.py index 17a62587..558f21c5 100644 --- a/backend/app/services/psa_documentation_service.py +++ b/backend/app/services/psa_documentation_service.py @@ -371,6 +371,7 @@ async def push_documentation( # Log success log_entry = PsaPostLog( id=uuid.uuid4(), + account_id=session.account_id, ai_session_id=session.id, psa_connection_id=session.psa_connection_id, ticket_id=session.psa_ticket_id, @@ -394,6 +395,7 @@ async def push_documentation( # Log failure with retry scheduling log_entry = PsaPostLog( id=uuid.uuid4(), + account_id=session.account_id, ai_session_id=session.id, psa_connection_id=session.psa_connection_id, ticket_id=session.psa_ticket_id, diff --git a/backend/app/services/resolution_output_generator.py b/backend/app/services/resolution_output_generator.py index 1b317d5c..022f658e 100644 --- a/backend/app/services/resolution_output_generator.py +++ b/backend/app/services/resolution_output_generator.py @@ -45,6 +45,7 @@ class ResolutionOutputGenerator: output = SessionResolutionOutput( session_id=session_id, + account_id=session.account_id, output_type=output_type, generated_content=content, status="draft",