fix: add is_flow_synced and source_tree_name to step list response

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-02-25 13:30:57 -05:00
parent b1c44535af
commit d36e48ed7f
2 changed files with 6 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ from decimal import Decimal
from fastapi import APIRouter, Depends, HTTPException, Query from fastapi import APIRouter, Depends, HTTPException, Query
from sqlalchemy import select, func, desc, Integer, case from sqlalchemy import select, func, desc, Integer, case
from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import selectinload
from app.core.database import get_db from app.core.database import get_db
from app.api.deps import get_current_active_user, require_engineer_or_admin from app.api.deps import get_current_active_user, require_engineer_or_admin
@@ -72,7 +73,7 @@ async def list_steps(
query = select(StepLibrary).where( query = select(StepLibrary).where(
StepLibrary.is_active == True, StepLibrary.is_active == True,
build_step_visibility_filter(current_user) build_step_visibility_filter(current_user)
) ).options(selectinload(StepLibrary.source_tree))
# Apply filters # Apply filters
if visibility: if visibility:
@@ -117,6 +118,8 @@ async def list_steps(
"is_featured": step.is_featured, "is_featured": step.is_featured,
"created_by": step.created_by, "created_by": step.created_by,
"created_at": step.created_at, "created_at": step.created_at,
"is_flow_synced": step.is_flow_synced,
"source_tree_name": step.source_tree.name if step.source_tree else None,
} }
# Get category name if exists # Get category name if exists

View File

@@ -82,6 +82,8 @@ class StepLibraryListResponse(BaseModel):
created_by: UUID created_by: UUID
author_name: Optional[str] = None author_name: Optional[str] = None
created_at: datetime created_at: datetime
is_flow_synced: bool = False
source_tree_name: Optional[str] = None
class Config: class Config:
from_attributes = True from_attributes = True