Skip to content

Commit

Permalink
feat: added maximum pagesize and default order
Browse files Browse the repository at this point in the history
  • Loading branch information
JordenReuter committed Jun 12, 2024
1 parent 5fb2e0c commit 686f223
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/main/java/org/tkit/onecx/theme/domain/daos/ThemeDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public PageResult<Theme> findThemesByCriteria(ThemeSearchCriteria criteria) {
if (criteria.getName() != null && !criteria.getName().isBlank()) {
cq.where(cb.like(root.get(Theme_.name), QueryCriteriaUtil.wildcard(criteria.getName())));
}
cq.orderBy(cb.desc(root.get(TraceableEntity_.CREATION_DATE)));

return createPageQuery(cq, Page.of(criteria.getPageNumber(), criteria.getPageSize())).getPageResult();
} catch (Exception ex) {
Expand All @@ -101,7 +102,8 @@ public PageResult<Theme> findAll(Integer pageNumber, Integer pageSize) {
try {
var cb = this.getEntityManager().getCriteriaBuilder();
var cq = cb.createQuery(Theme.class);
cq.from(Theme.class);
var root = cq.from(Theme.class);
cq.orderBy(cb.desc(root.get(TraceableEntity_.CREATION_DATE)));
return createPageQuery(cq, Page.of(pageNumber, pageSize)).getPageResult();
} catch (Exception ex) {
throw new DAOException(ErrorKeys.ERROR_FIND_ALL_THEME_PAGE, ex);
Expand Down
3 changes: 2 additions & 1 deletion src/main/openapi/onecx-theme-internal-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ components:
pageSize:
format: int32
description: The size of page
default: 10
default: 100
maximum: 1000
type: integer
ThemeInfoList:
type: object
Expand Down

0 comments on commit 686f223

Please sign in to comment.