diff --git a/backend/export/property_scenarios/input_schema.py b/backend/export/property_scenarios/input_schema.py index 2d925fc0..f6fa5965 100644 --- a/backend/export/property_scenarios/input_schema.py +++ b/backend/export/property_scenarios/input_schema.py @@ -34,3 +34,7 @@ class ExportRequest(BaseModel): object.__setattr__(self, "_scenario_ids_ignored", False) return self + + @property + def scenario_ids_ignored(self) -> bool: + return self._scenario_ids_ignored diff --git a/backend/export/property_scenarios/main.py b/backend/export/property_scenarios/main.py index 50754f6f..50fd808b 100644 --- a/backend/export/property_scenarios/main.py +++ b/backend/export/property_scenarios/main.py @@ -100,15 +100,7 @@ def process_export(payload: ExportRequest, session: Session) -> Dict[Union[str, def handler(event: Mapping[str, Any], context: Optional[Any]) -> Mapping[str, Union[int, str]]: """ - Lambda event should have the following structure: - 1) task id - unique identifier for the export task (optional, can be used for tracking/logging) - 2) subtask id - unique identifier for the specific export operation (optional, can be used for tracking/logging) - 2) portfolio id - id of the portfolio to export - 3) scenario ids - list of scenario ids to export - 4) default_plans_only - flag indicating if we should only consider default plans for export (optional, - defaults to False) - - Exxample event: + Example event: body_dict = { "task_id": "test", "subtask_id": "test", @@ -127,7 +119,7 @@ def handler(event: Mapping[str, Any], context: Optional[Any]) -> Mapping[str, Un logger.debug("Validating request body") payload = ExportRequest.model_validate(body_dict) - if getattr(payload, "_scenario_ids_ignored", False): + if payload.scenario_ids_ignored: logger.warning( "Received scenario_ids in request body but they will be ignored " "because default_plans_only is set to True"