feat(api): Add app_id field to HumanInputForm model

This ensures that `HumanInputForm` could be associated to a specific
application without relying on `WorkflowRun`, providing us a smoother
migration path if we want to implement test form.
This commit is contained in:
QuantumGhost
2026-01-14 16:58:17 +08:00
parent 25cc2ab738
commit f1b2e1cfb4
15 changed files with 73 additions and 29 deletions

View File

@ -67,6 +67,7 @@ def _build_form_params(delivery_methods: list[EmailDeliveryMethod]) -> FormCreat
user_actions=[UserAction(id="approve", title="Approve")],
)
return FormCreateParams(
app_id="app-1",
workflow_execution_id=str(uuid4()),
node_id="human-input-node",
form_config=form_config,
@ -174,6 +175,7 @@ class TestHumanInputFormRepositoryImplWithContainers:
repository = HumanInputFormRepositoryImpl(session_factory=engine, tenant_id=tenant.id)
resolved_values = {"greeting": "Hello!"}
params = FormCreateParams(
app_id="app-1",
workflow_execution_id=str(uuid4()),
node_id="human-input-node",
form_config=HumanInputNodeData(
@ -209,6 +211,7 @@ class TestHumanInputFormRepositoryImplWithContainers:
repository = HumanInputFormRepositoryImpl(session_factory=engine, tenant_id=tenant.id)
params = FormCreateParams(
app_id="app-1",
workflow_execution_id=str(uuid4()),
node_id="human-input-node",
form_config=HumanInputNodeData(

View File

@ -123,6 +123,7 @@ def create_human_input_message_fixture(db_session) -> HumanInputMessageFixture:
)
form = HumanInputForm(
tenant_id=tenant.id,
app_id=app.id,
workflow_run_id=workflow_run_id,
node_id="node-id",
form_definition=form_definition.model_dump_json(),

View File

@ -88,6 +88,7 @@ def _build_form(db_session_with_containers, tenant, account):
engine = db_session_with_containers.get_bind()
repo = HumanInputFormRepositoryImpl(session_factory=engine, tenant_id=tenant.id)
params = FormCreateParams(
app_id="app-1",
workflow_execution_id=str(uuid.uuid4()),
node_id="node-1",
form_config=node_data,