fix(api): exception on unpaged empty content

This commit is contained in:
Gauthier Roebroeck 2020-06-30 08:40:49 +08:00
parent 4ed35d2764
commit 2cc27f244c
2 changed files with 3 additions and 3 deletions

View file

@ -65,7 +65,7 @@ class SeriesCollectionDao(
return PageImpl(
items,
if (pageable.isPaged) PageRequest.of(pageable.pageNumber, pageable.pageSize, pageSort)
else PageRequest.of(0, count.toInt(), pageSort),
else PageRequest.of(0, maxOf(count.toInt(), 20), pageSort),
count.toLong()
)
}
@ -95,7 +95,7 @@ class SeriesCollectionDao(
return PageImpl(
items,
if (pageable.isPaged) PageRequest.of(pageable.pageNumber, pageable.pageSize, pageSort)
else PageRequest.of(0, count.toInt(), pageSort),
else PageRequest.of(0, maxOf(count, 20), pageSort),
count.toLong()
)
}

View file

@ -132,7 +132,7 @@ class SeriesDtoDao(
return PageImpl(
dtos,
if (pageable.isPaged) PageRequest.of(pageable.pageNumber, pageable.pageSize, pageSort)
else PageRequest.of(0, count.toInt(), pageSort),
else PageRequest.of(0, maxOf(count, 20), pageSort),
count.toLong()
)
}