is_saved_task parameter for workflows (#526)

This commit is contained in:
Kerem Yilmaz
2024-06-27 12:53:08 -07:00
committed by GitHub
parent c44a3076c0
commit 63adc860ef
8 changed files with 69 additions and 10 deletions

View File

@@ -44,6 +44,7 @@ class Workflow(BaseModel):
title: str
workflow_permanent_id: str
version: int
is_saved_task: bool
description: str | None = None
workflow_definition: WorkflowDefinition
proxy_location: ProxyLocation | None = None

View File

@@ -194,3 +194,4 @@ class WorkflowCreateYAMLRequest(BaseModel):
proxy_location: ProxyLocation | None = None
webhook_callback_url: str | None = None
workflow_definition: WorkflowDefinitionYAML
is_saved_task: bool = False

View File

@@ -281,6 +281,7 @@ class WorkflowService:
webhook_callback_url: str | None = None,
workflow_permanent_id: str | None = None,
version: int | None = None,
is_saved_task: bool = False,
) -> Workflow:
return await app.DATABASE.create_workflow(
title=title,
@@ -291,6 +292,7 @@ class WorkflowService:
webhook_callback_url=webhook_callback_url,
workflow_permanent_id=workflow_permanent_id,
version=version,
is_saved_task=is_saved_task,
)
async def get_workflow(self, workflow_id: str, organization_id: str | None = None) -> Workflow:
@@ -319,6 +321,8 @@ class WorkflowService:
organization_id: str,
page: int = 1,
page_size: int = 10,
only_saved_tasks: bool = False,
only_workflows: bool = False,
) -> list[Workflow]:
"""
Get all workflows with the latest version for the organization.
@@ -327,6 +331,8 @@ class WorkflowService:
organization_id=organization_id,
page=page,
page_size=page_size,
only_saved_tasks=only_saved_tasks,
only_workflows=only_workflows,
)
async def update_workflow(
@@ -773,6 +779,7 @@ class WorkflowService:
webhook_callback_url=request.webhook_callback_url,
workflow_permanent_id=workflow_permanent_id,
version=existing_version + 1,
is_saved_task=request.is_saved_task,
)
else:
workflow = await self.create_workflow(
@@ -782,6 +789,7 @@ class WorkflowService:
organization_id=organization_id,
proxy_location=request.proxy_location,
webhook_callback_url=request.webhook_callback_url,
is_saved_task=request.is_saved_task,
)
# Create parameters from the request
parameters: dict[str, PARAMETER_TYPE] = {}