feat: add language column, AI Generated category, and mine/shared filters
- Add language column (powershell/bash/python) to script_templates model and schemas - Seed 'AI Generated' script category via migration 063 - Add mine and shared query params to list_templates endpoint Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -76,6 +76,8 @@ async def list_templates(
|
||||
search: Optional[str] = Query(None),
|
||||
tags: Optional[str] = Query(None, description="Comma-separated tags"),
|
||||
managed: Optional[bool] = Query(None, description="If true, return only templates this user can edit"),
|
||||
mine: bool = Query(False, description="If true, return only templates created by the current user"),
|
||||
shared: bool = Query(False, description="If true, return only templates shared with the user's team"),
|
||||
) -> list[ScriptTemplateListItem]:
|
||||
query = (
|
||||
select(ScriptTemplate)
|
||||
@@ -116,6 +118,12 @@ async def list_templates(
|
||||
# engineers see only their own
|
||||
query = query.where(ScriptTemplate.created_by == current_user.id)
|
||||
|
||||
if mine:
|
||||
query = query.where(ScriptTemplate.created_by == current_user.id)
|
||||
|
||||
if shared:
|
||||
query = query.where(ScriptTemplate.team_id == current_user.team_id)
|
||||
|
||||
result = await db.execute(query.order_by(ScriptTemplate.name))
|
||||
templates = result.scalars().all()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user