Skip to content

Commit

Permalink
add per_page parameter to get all cres (#541)
Browse files Browse the repository at this point in the history
  • Loading branch information
northdpole authored Jul 30, 2024
1 parent 431cdd4 commit 6a31c53
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion application/web/web_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,11 +651,18 @@ def logout():
def all_cres() -> Any:
database = db.Node_collection()
page = 1
per_page = ITEMS_PER_PAGE
if request.args.get("page") is not None and int(request.args.get("page")) > 0:
page = request.args.get("page")

if (
request.args.get("per_page") is not None
and int(request.args.get("per_page")) > 0
):
per_page = request.args.get("per_page")

documents, page, total_pages = database.all_cres_with_pagination(
page, ITEMS_PER_PAGE
page, per_page=per_page
)
if documents:
res = [doc.todict() for doc in documents]
Expand Down

0 comments on commit 6a31c53

Please sign in to comment.