Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/btrixcloud/colls.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ async def list_collection_all(
collections, total = await colls.list_collections(
org.id, page_size=pageSize, page=page
)
return paginated_format(collections, total, page)
return paginated_format(collections, total, page, pageSize)

@router.get("/$all")
async def get_collection_all(org: Organization = Depends(org_viewer_dep)):
Expand Down
8 changes: 4 additions & 4 deletions backend/btrixcloud/crawlconfigs.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ async def get_crawl_configs(
sort_by=sortBy,
sort_direction=sortDirection,
)
return paginated_format(crawl_configs, total, page)
return paginated_format(crawl_configs, total, page, pageSize)

@router.get("/tags")
async def get_crawl_config_tags(org: Organization = Depends(org_viewer_dep)):
Expand All @@ -954,12 +954,12 @@ async def get_crawl_config(cid: str, org: Organization = Depends(org_viewer_dep)
dependencies=[Depends(org_viewer_dep)],
)
async def get_crawl_config_revisions(
cid: str, page_size: int = DEFAULT_PAGE_SIZE, page: int = 1
cid: str, pageSize: int = DEFAULT_PAGE_SIZE, page: int = 1
):
revisions, total = await ops.get_crawl_config_revs(
uuid.UUID(cid), page_size=page_size, page=page
uuid.UUID(cid), page_size=pageSize, page=page
)
return paginated_format(revisions, total, page)
return paginated_format(revisions, total, page, pageSize)

@router.post("/")
async def add_crawl_config(
Expand Down
4 changes: 2 additions & 2 deletions backend/btrixcloud/crawls.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ async def list_crawls_admin(
sort_by=sortBy,
sort_direction=sortDirection,
)
return paginated_format(crawls, total, page)
return paginated_format(crawls, total, page, pageSize)

@app.get("/orgs/{oid}/crawls", tags=["crawls"])
async def list_crawls(
Expand Down Expand Up @@ -853,7 +853,7 @@ async def list_crawls(
sort_by=sortBy,
sort_direction=sortDirection,
)
return paginated_format(crawls, total, page)
return paginated_format(crawls, total, page, pageSize)

@app.post(
"/orgs/{oid}/crawls/{crawl_id}/cancel",
Expand Down
4 changes: 2 additions & 2 deletions backend/btrixcloud/orgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ async def get_orgs(
serialized_results = [
await res.serialize_for_user(user, user_manager) for res in results
]
return paginated_format(serialized_results, total, page)
return paginated_format(serialized_results, total, page, pageSize)

@app.post("/orgs/create", tags=["organizations"])
async def create_org(
Expand Down Expand Up @@ -517,7 +517,7 @@ async def get_pending_org_invites(
pending_invites, total = await user_manager.invites.get_pending_invites(
org, page_size=pageSize, page=page
)
return paginated_format(pending_invites, total, page)
return paginated_format(pending_invites, total, page, pageSize)

@router.post("/invites/delete", tags=["invites"])
async def delete_invite(
Expand Down
9 changes: 7 additions & 2 deletions backend/btrixcloud/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
DEFAULT_PAGE_SIZE = 1_000


def paginated_format(items: Optional[List[Any]], total: int, page: int = 1):
def paginated_format(
items: Optional[List[Any]],
total: int,
page: int = 1,
page_size: int = DEFAULT_PAGE_SIZE,
):
"""Return items in paged format."""
return {"items": items, "total": total, "page": page}
return {"items": items, "total": total, "page": page, "pageSize": page_size}
2 changes: 1 addition & 1 deletion backend/btrixcloud/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ async def list_profiles(
profiles, total = await ops.list_profiles(
org, userid, page_size=pageSize, page=page
)
return paginated_format(profiles, total, page)
return paginated_format(profiles, total, page, pageSize)

@router.post("", response_model=Profile)
async def commit_browser_to_new(
Expand Down
2 changes: 1 addition & 1 deletion backend/btrixcloud/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ async def get_pending_invites(
pending_invites, total = await user_manager.invites.get_pending_invites(
page_size=pageSize, page=page
)
return paginated_format(pending_invites, total, page)
return paginated_format(pending_invites, total, page, pageSize)

app.include_router(users_router, prefix="/users", tags=["users"])

Expand Down