chore: fix all ruff lint errors + format — 0 errors, 306 tests pass
This commit is contained in:
+20
-8
@@ -10,7 +10,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from app.core.auth import check_permission
|
||||
from app.core.db import get_db
|
||||
from app.deps import get_current_user
|
||||
from app.schemas.workflow import WorkflowCreate, WorkflowUpdate, InstanceCreate, AdvanceRequest
|
||||
from app.schemas.workflow import AdvanceRequest, InstanceCreate, WorkflowCreate, WorkflowUpdate
|
||||
from app.services import workflow_service
|
||||
|
||||
router = APIRouter(prefix="/api/v1/workflows", tags=["workflows"])
|
||||
@@ -18,6 +18,7 @@ router = APIRouter(prefix="/api/v1/workflows", tags=["workflows"])
|
||||
|
||||
# ─── Workflow CRUD ───
|
||||
|
||||
|
||||
@router.get("")
|
||||
async def list_workflows(
|
||||
page: int = Query(1, ge=1),
|
||||
@@ -29,8 +30,10 @@ async def list_workflows(
|
||||
"""List workflows with pagination."""
|
||||
tenant_id = uuid.UUID(current_user["tenant_id"])
|
||||
return await workflow_service.list_workflows(
|
||||
db, tenant_id,
|
||||
page=page, page_size=page_size,
|
||||
db,
|
||||
tenant_id,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
is_active=is_active,
|
||||
)
|
||||
|
||||
@@ -67,8 +70,10 @@ async def list_instances(
|
||||
"""List workflow instances with optional status filter."""
|
||||
tenant_id = uuid.UUID(current_user["tenant_id"])
|
||||
return await workflow_service.list_instances(
|
||||
db, tenant_id,
|
||||
page=page, page_size=page_size,
|
||||
db,
|
||||
tenant_id,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
status_filter=status,
|
||||
)
|
||||
|
||||
@@ -146,6 +151,7 @@ async def delete_workflow(
|
||||
|
||||
# ─── Instance endpoints ───
|
||||
|
||||
|
||||
@router.post("/{workflow_id}/instances", status_code=status.HTTP_201_CREATED)
|
||||
async def create_instance(
|
||||
workflow_id: str,
|
||||
@@ -158,7 +164,9 @@ async def create_instance(
|
||||
user_id = uuid.UUID(current_user["user_id"])
|
||||
|
||||
result = await workflow_service.create_instance(
|
||||
db, tenant_id, user_id,
|
||||
db,
|
||||
tenant_id,
|
||||
user_id,
|
||||
workflow_id=workflow_id,
|
||||
context=body.context,
|
||||
timeout_hours=body.timeout_hours,
|
||||
@@ -204,7 +212,9 @@ async def advance_instance(
|
||||
user_id = uuid.UUID(current_user["user_id"])
|
||||
|
||||
result = await workflow_service.advance_instance(
|
||||
db, tenant_id, user_id,
|
||||
db,
|
||||
tenant_id,
|
||||
user_id,
|
||||
instance_id=instance_id,
|
||||
decision=body.decision,
|
||||
comment=body.comment,
|
||||
@@ -233,7 +243,9 @@ async def cancel_instance(
|
||||
user_id = uuid.UUID(current_user["user_id"])
|
||||
|
||||
result = await workflow_service.cancel_instance(
|
||||
db, tenant_id, user_id,
|
||||
db,
|
||||
tenant_id,
|
||||
user_id,
|
||||
instance_id=instance_id,
|
||||
)
|
||||
if result is None:
|
||||
|
||||
Reference in New Issue
Block a user