Skip to content

Commit 286d378

Browse files
author
Jens Kürten
committed
Enhance StartWorkflowAction with task configurations and subject handling
1 parent 0bb3af1 commit 286d378

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

csfunctions/actions/start_workflow.py

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,42 @@
1-
from typing import Literal
1+
from typing import Literal, Optional
22

33
from pydantic import BaseModel, Field
44

55
from .base import ActionNames, BaseAction
66

77

8-
class TaskParameter(BaseModel):
9-
task_id: str = Field(..., description="Identifier for the task this parameter belongs to")
10-
name: str = Field(..., description="Name of the parameter")
11-
value: str = Field(..., description="Value of the parameter")
8+
class Subject(BaseModel):
9+
subject_id: str = Field(..., description="ID of the subject, eg. a role name or personalnummer")
10+
subject_type: Literal["Person", "PCS Role", "Common Role"] = Field(
11+
..., description="Type of the subject: Person, PCS Role or Common Role"
12+
)
13+
14+
15+
class TaskConfiguration(BaseModel):
16+
task_id: str = Field(..., description="Identifier for the task")
17+
responsible: Optional[Subject] = Field(default=None, description="Responsible subject for the task")
18+
recipients: list[Subject] = Field(
19+
default_factory=list,
20+
description="List of recipients for the task (only used by information tasks)",
21+
)
1222

1323

1424
class StartWorkflowAction(BaseAction):
1525
name: Literal[ActionNames.START_WORKFLOW] = ActionNames.START_WORKFLOW
1626
template_id: str = Field(..., description="ID of the workflow template to start")
1727
cdb_project_id: str | None = Field(
18-
default=None, description="ID of the project in which the workflow should be started"
28+
default=None,
29+
description="ID of the project in which the workflow should be started",
1930
)
2031
title: str = Field(..., description="Title of the workflow")
2132
attachment_ids: list[str] = Field(
22-
default_factory=list, description="List of cdb_object_ids to attach to the workflow"
33+
default_factory=list,
34+
description="List of cdb_object_ids to attach to the workflow",
2335
)
2436
global_briefcase_object_ids: list[str] = Field(
25-
default_factory=list, description="List of cdb_object_ids to attach to the global briefcase"
37+
default_factory=list,
38+
description="List of cdb_object_ids to attach to the global briefcase",
39+
)
40+
task_configurations: list[TaskConfiguration] = Field(
41+
default_factory=list, description="List of task configurations"
2642
)
27-
task_parameters: list[TaskParameter] = Field(default_factory=list, description="List of task parameters")

0 commit comments

Comments
 (0)