diff --git a/openapi_first/templates/vet_app/routes.py b/openapi_first/templates/vet_app/routes.py index 2f75307..9804380 100644 --- a/openapi_first/templates/vet_app/routes.py +++ b/openapi_first/templates/vet_app/routes.py @@ -69,7 +69,7 @@ def list_parents(limit: int = 20, offset: int = 0): Paginated response with ``total`` and ``items``. """ items = _list_parents() - return {"total": len(items), "items": items[offset:offset + limit]} + return {"total": len(items), "items": items[offset:offset + limit] if limit else items[offset:]} def create_parent(payload: ParentCreate, response: Response): @@ -168,7 +168,7 @@ def delete_parent(id: int, response: Response): def list_vets(limit: int = 20, offset: int = 0): """List vets (paginated).""" items = _list_vets() - return {"total": len(items), "items": items[offset:offset + limit]} + return {"total": len(items), "items": items[offset:offset + limit] if limit else items[offset:]} def create_vet(payload: VetCreate, response: Response): @@ -259,7 +259,7 @@ def delete_treatment(id: int, response: Response): def list_pets(limit: int = 20, offset: int = 0): """List pets (paginated).""" items = _list_pets() - return {"total": len(items), "items": items[offset:offset + limit]} + return {"total": len(items), "items": items[offset:offset + limit] if limit else items[offset:]} def create_pet(payload: PetCreate, response: Response): @@ -330,7 +330,7 @@ def list_appointments(limit: int = 20, offset: int = 0, date: str = None, vet: i if pet is not None: items = [a for a in items if a.pet.id == pet] - return {"total": len(items), "items": items[offset:offset + limit]} + return {"total": len(items), "items": items[offset:offset + limit] if limit else items[offset:]} def create_appointment(payload: AppointmentCreate, response: Response):