Fix: Add pagination to admin appointments endpoint

- Added pagination with page/per_page query params
- Fixed N+1 query by using eager-loaded user relationship
- Removed unused _get_user_email helper function
- Updated frontend to handle paginated response
- Regenerated API types
This commit is contained in:
counterweight 2025-12-21 17:32:25 +01:00
parent 1cd60b4bbc
commit 77e7f98e1e
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
4 changed files with 70 additions and 28 deletions

View file

@ -716,8 +716,13 @@ class TestAdminViewAppointments:
assert response.status_code == 200
data = response.json()
assert len(data) >= 1
assert any(apt["note"] == "Test" for apt in data)
# Paginated response
assert "records" in data
assert "total" in data
assert "page" in data
assert "per_page" in data
assert len(data["records"]) >= 1
assert any(apt["note"] == "Test" for apt in data["records"])
@pytest.mark.asyncio
async def test_regular_user_cannot_view_all_appointments(self, client_factory, regular_user):