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:
@@ -26,7 +26,7 @@ class RunService:
|
||||
return None
|
||||
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."""
|
||||
# Get all runs and filter by actor
|
||||
# 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)
|
||||
|
||||
# Paginate
|
||||
total = len(all_runs)
|
||||
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,
|
||||
}
|
||||
}
|
||||
return all_runs[offset:offset + limit]
|
||||
|
||||
async def create_run(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user