mirror of
https://github.com/gotson/komga.git
synced 2025-12-20 23:45:11 +01:00
parent
8f08ce82e1
commit
16dfe91140
2 changed files with 20 additions and 1 deletions
|
|
@ -62,7 +62,7 @@ class SeriesController(
|
|||
val pageRequest = PageRequest.of(
|
||||
page.pageNumber,
|
||||
page.pageSize,
|
||||
if (page.sort.isSorted) page.sort
|
||||
if (page.sort.isSorted) Sort.by(page.sort.map { it.ignoreCase() }.toList())
|
||||
else Sort.by(Sort.Order.asc("metadata.titleSort").ignoreCase())
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import org.gotson.komga.domain.model.makeLibrary
|
|||
import org.gotson.komga.domain.model.makeSeries
|
||||
import org.gotson.komga.domain.persistence.LibraryRepository
|
||||
import org.gotson.komga.domain.persistence.SeriesRepository
|
||||
import org.hamcrest.Matchers
|
||||
import org.junit.jupiter.api.AfterAll
|
||||
import org.junit.jupiter.api.AfterEach
|
||||
import org.junit.jupiter.api.BeforeAll
|
||||
|
|
@ -80,6 +81,24 @@ class SeriesControllerTest(
|
|||
jsonPath("$.content[1].metadata.title") { value("Beta") }
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@WithMockCustomUser
|
||||
fun `given series when requesting via api then series are sorted insensitive of case`() {
|
||||
val series = listOf("a", "b", "B", "C").map { makeSeries(it).also { it.library = library } }
|
||||
seriesRepository.saveAll(series)
|
||||
|
||||
mockMvc.get("/api/v1/series") {
|
||||
param("sort", "metadata.titleSort,asc")
|
||||
}
|
||||
.andExpect {
|
||||
status { isOk }
|
||||
jsonPath("$.content[0].metadata.title") { value("a") }
|
||||
jsonPath("$.content[1].metadata.title") { value(Matchers.equalToIgnoringCase("b")) }
|
||||
jsonPath("$.content[2].metadata.title") { value(Matchers.equalToIgnoringCase("b")) }
|
||||
jsonPath("$.content[3].metadata.title") { value("C") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
|
|
|||
Loading…
Reference in a new issue