chore: fix all ruff lint errors + format — 0 errors, 306 tests pass
This commit is contained in:
@@ -7,6 +7,7 @@ from pydantic import BaseModel, Field
|
||||
|
||||
class WorkflowStep(BaseModel):
|
||||
"""A single step in a workflow definition."""
|
||||
|
||||
name: str = Field(..., min_length=1, max_length=200)
|
||||
type: str = Field(..., pattern="^(action|approval|notification|condition)$")
|
||||
config: dict = Field(default_factory=dict)
|
||||
@@ -15,6 +16,7 @@ class WorkflowStep(BaseModel):
|
||||
|
||||
class WorkflowCreate(BaseModel):
|
||||
"""Create a new workflow definition."""
|
||||
|
||||
name: str = Field(..., min_length=1, max_length=200)
|
||||
description: str | None = None
|
||||
trigger_event: str | None = None
|
||||
@@ -24,6 +26,7 @@ class WorkflowCreate(BaseModel):
|
||||
|
||||
class WorkflowUpdate(BaseModel):
|
||||
"""Update an existing workflow definition."""
|
||||
|
||||
name: str | None = Field(None, max_length=200)
|
||||
description: str | None = None
|
||||
trigger_event: str | None = None
|
||||
@@ -33,6 +36,7 @@ class WorkflowUpdate(BaseModel):
|
||||
|
||||
class WorkflowResponse(BaseModel):
|
||||
"""Workflow definition response."""
|
||||
|
||||
id: str
|
||||
name: str
|
||||
description: str | None = None
|
||||
@@ -46,6 +50,7 @@ class WorkflowResponse(BaseModel):
|
||||
|
||||
class WorkflowListResponse(BaseModel):
|
||||
"""Paginated workflow list."""
|
||||
|
||||
items: list[WorkflowResponse]
|
||||
total: int
|
||||
page: int
|
||||
@@ -54,12 +59,14 @@ class WorkflowListResponse(BaseModel):
|
||||
|
||||
class InstanceCreate(BaseModel):
|
||||
"""Create a new workflow instance."""
|
||||
|
||||
context: dict = Field(default_factory=dict)
|
||||
timeout_hours: int | None = None
|
||||
|
||||
|
||||
class InstanceResponse(BaseModel):
|
||||
"""Workflow instance response with current state and history."""
|
||||
|
||||
id: str
|
||||
workflow_id: str
|
||||
status: str
|
||||
@@ -75,12 +82,14 @@ class InstanceResponse(BaseModel):
|
||||
|
||||
class InstanceDetailResponse(InstanceResponse):
|
||||
"""Instance with step history."""
|
||||
|
||||
history: list[dict] = Field(default_factory=list)
|
||||
workflow_name: str | None = None
|
||||
|
||||
|
||||
class InstanceListResponse(BaseModel):
|
||||
"""Paginated instance list."""
|
||||
|
||||
items: list[InstanceResponse]
|
||||
total: int
|
||||
page: int
|
||||
@@ -89,12 +98,14 @@ class InstanceListResponse(BaseModel):
|
||||
|
||||
class AdvanceRequest(BaseModel):
|
||||
"""Advance or reject a workflow instance step."""
|
||||
|
||||
decision: str = Field(..., pattern="^(approve|reject)$")
|
||||
comment: str | None = None
|
||||
|
||||
|
||||
class StepHistoryResponse(BaseModel):
|
||||
"""Step history entry."""
|
||||
|
||||
id: str
|
||||
instance_id: str
|
||||
step_index: int
|
||||
|
||||
Reference in New Issue
Block a user