reformat & fix types

This commit is contained in:
Elizabeth Esswein 2022-12-15 11:39:28 -05:00
parent 33f34ca51d
commit 1859e0cf42
3 changed files with 7 additions and 4 deletions

View File

@ -2041,6 +2041,7 @@ def update_task_data(
mimetype="application/json",
)
def send_bpmn_event(process_instance_id: str, body: Dict) -> Response:
process_instance = ProcessInstanceModel.query.filter(
ProcessInstanceModel.id == int(process_instance_id)

View File

@ -705,15 +705,17 @@ class ProcessInstanceProcessor:
db.session.delete(at)
db.session.commit()
def serialize_task_spec(self, task_spec: SpiffTask) -> dict[str, Any]:
def serialize_task_spec(self, task_spec: SpiffTask) -> Any:
return self._serializer.spec_converter.convert(task_spec)
def send_bpmn_event(self, event_data: dict[str,Any]) -> None:
def send_bpmn_event(self, event_data: dict[str, Any]) -> None:
payload = event_data.pop("payload", None)
event_definition = self._event_serializer.restore(event_data)
if payload is not None:
event_definition.payload = payload
current_app.logger.info(f"Event of type {event_definition.event_type} sent to process instance {self.process_instance_model.id}")
current_app.logger.info(
f"Event of type {event_definition.event_type} sent to process instance {self.process_instance_model.id}"
)
self.bpmn_process_instance.catch(event_definition)
self.do_engine_steps(save=True)

View File

@ -279,7 +279,7 @@ class ProcessInstanceService:
def spiff_task_to_api_task(
processor: ProcessInstanceProcessor,
spiff_task: SpiffTask,
add_docs_and_forms: bool = False
add_docs_and_forms: bool = False,
) -> Task:
"""Spiff_task_to_api_task."""
task_type = spiff_task.task_spec.spec_type