mirror of
https://github.com/gotson/komga.git
synced 2025-01-07 03:07:16 +08:00
default sort series by name ignoring case
This commit is contained in:
parent
43daabde6b
commit
04351224e0
@ -38,13 +38,20 @@ class SerieController(
|
||||
searchTerm: String?,
|
||||
|
||||
page: Pageable
|
||||
): Page<SerieDto> =
|
||||
if (!searchTerm.isNullOrEmpty()) {
|
||||
val spec = Serie::name.likeLower("%$searchTerm%")
|
||||
serieRepository.findAll(spec, page)
|
||||
} else {
|
||||
serieRepository.findAll(page)
|
||||
}.map { it.toDto() }
|
||||
): Page<SerieDto> {
|
||||
val pageRequest = PageRequest.of(
|
||||
page.pageNumber,
|
||||
page.pageSize,
|
||||
if (page.sort.isSorted) page.sort
|
||||
else Sort.by(Sort.Order.asc("name").ignoreCase())
|
||||
)
|
||||
return if (!searchTerm.isNullOrEmpty()) {
|
||||
val spec = Serie::name.likeLower("%$searchTerm%")
|
||||
serieRepository.findAll(spec, pageRequest)
|
||||
} else {
|
||||
serieRepository.findAll(pageRequest)
|
||||
}.map { it.toDto() }
|
||||
}
|
||||
|
||||
@GetMapping("/latest")
|
||||
fun getLatestSeries(
|
||||
|
Loading…
Reference in New Issue
Block a user