fix: add selectinload and sync fields to search and get_step endpoints

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-02-25 13:32:43 -05:00
parent d36e48ed7f
commit cdaa96ad49

View File

@@ -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: