diff --git a/backend/app/api/endpoints/steps.py b/backend/app/api/endpoints/steps.py index 874dc82f..d5c8d279 100644 --- a/backend/app/api/endpoints/steps.py +++ b/backend/app/api/endpoints/steps.py @@ -40,7 +40,7 @@ async def get_step_or_404( select(StepLibrary).where( StepLibrary.id == step_id, StepLibrary.is_active == True - ) + ).options(selectinload(StepLibrary.source_tree)) ) step = result.scalar_one_or_none() if not step: @@ -157,7 +157,7 @@ async def search_steps( StepLibrary.is_active == True, build_step_visibility_filter(current_user), func.to_tsvector('english', StepLibrary.title).match(search_query) - ).order_by(desc(StepLibrary.rating_average)).limit(limit) + ).options(selectinload(StepLibrary.source_tree)).order_by(desc(StepLibrary.rating_average)).limit(limit) result = await db.execute(query) steps = result.scalars().all() @@ -177,6 +177,8 @@ async def search_steps( "is_featured": step.is_featured, "created_by": step.created_by, "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, } if step.category_id: