Skip to content

Commit

Permalink
Pagination: page parameter renamed to currentPage
Browse files Browse the repository at this point in the history
  • Loading branch information
mobreza committed Jul 31, 2023
1 parent d4d4640 commit 170d038
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public BaseResult(T result, int currentPage, int pageSize, long totalCount)
public BaseResult(T result, int currentPage, int pageSize, long totalCount, int totalPages)
{
this.result = result;
metadata.setPagination(new Pagination().setPage(currentPage).setPageSize(pageSize).setTotalCount(totalCount).setTotalPages(totalPages));
metadata.setPagination(new Pagination().setCurrentPage(currentPage).setPageSize(pageSize).setTotalCount(totalCount).setTotalPages(totalPages));
}

public BaseResult(T result, List<Status> status)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package uk.ac.hutton.ics.brapi.resource.base;

import com.fasterxml.jackson.annotation.JsonValue;

import lombok.*;
import lombok.experimental.Accessors;

Expand All @@ -10,14 +12,14 @@
public class Pagination
{
private int pageSize;
private int page;
private int currentPage;
private long totalCount;
private int totalPages;

public Pagination(int pageSize, int page, long totalCount, int desiredPageSize)
{
this.pageSize = pageSize;
this.page = page;
this.currentPage = page;
this.totalCount = totalCount;
this.totalPages = (int) Math.ceil(totalCount / (float) desiredPageSize);
}
Expand Down

0 comments on commit 170d038

Please sign in to comment.