Fix list_recipes 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:43:54 +00:00
parent d19d6d6e42
commit b372d02df2

View File

@@ -34,7 +34,7 @@ class RecipeService:
return None
async def list_recipes(self, actor_id: str = None, page: int = 1, limit: int = 20) -> Dict[str, Any]:
async def list_recipes(self, actor_id: str = None, offset: int = 0, limit: int = 20) -> list:
"""List available recipes with pagination."""
recipes = []
cursor = 0
@@ -59,20 +59,7 @@ class RecipeService:
recipes.sort(key=lambda r: r.get("name", ""))
# Paginate
total = len(recipes)
start = (page - 1) * limit
end = start + limit
page_recipes = recipes[start:end]
return {
"recipes": page_recipes,
"pagination": {
"page": page,
"limit": limit,
"total": total,
"has_more": end < total,
}
}
return recipes[offset:offset + limit]
async def save_recipe(self, recipe_id: str, recipe_data: Dict[str, Any]) -> None:
"""Save a recipe to Redis."""