Fix list_runs to use offset parameter

Match the router's expected signature and return type.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
giles
2026-01-11 12:22:59 +00:00
parent 0ec1de3cb7
commit 83cce09b1a

View File

@@ -26,7 +26,7 @@ class RunService:
return None return None
return json.loads(data) return json.loads(data)
async def list_runs(self, actor_id: str, page: int = 1, limit: int = 20) -> Dict[str, Any]: async def list_runs(self, actor_id: str, offset: int = 0, limit: int = 20) -> list:
"""List runs for a user with pagination.""" """List runs for a user with pagination."""
# Get all runs and filter by actor # Get all runs and filter by actor
# TODO: Use Redis index for efficient filtering # TODO: Use Redis index for efficient filtering
@@ -52,20 +52,7 @@ class RunService:
all_runs.sort(key=lambda r: r.get("created_at", ""), reverse=True) all_runs.sort(key=lambda r: r.get("created_at", ""), reverse=True)
# Paginate # Paginate
total = len(all_runs) return all_runs[offset:offset + limit]
start = (page - 1) * limit
end = start + limit
runs = all_runs[start:end]
return {
"runs": runs,
"pagination": {
"page": page,
"limit": limit,
"total": total,
"has_more": end < total,
}
}
async def create_run( async def create_run(
self, self,