briga-core-api / app /api /debug_admin.py
yabeskn's picture
feat: sync briga-backend — 2026 fallback chain (Gemini->OpenRouter :free->Groq), per-agent tier override, supabase JWT auth, agents router, retry columns
3a006a3 verified
Raw History Blame Contribute Delete
1.03 kB
from fastapi import APIRouter, Depends, Request, HTTPException
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy import select
from app.database import get_db
from app.models.system import WorkflowConfig
router = APIRouter(prefix="/v1/debug", tags=["Debug"])
@router.get("/workflows")
async def debug_list_workflows(request: Request, db: AsyncSession = Depends(get_db)):
"""Debug endpoint: admin-only workflow listing."""
role = getattr(request.state, "user_role", None)
if role not in ("admin", "ADMIN"):
raise HTTPException(status_code=403, detail="Admin role required")
result = await db.execute(select(WorkflowConfig))
rows = result.scalars().all()
return {"success": True, "workflows": [
{
"workflow_name": r.workflow_name,
"is_active": r.is_active,
"schedule_cron": r.schedule_cron,
"last_run": r.last_run,
"updated_at": r.updated_at,
}
for r in rows
]}