mirror of
https://github.com/gotson/komga.git
synced 2026-04-16 12:01:09 +02:00
parent
8f08ce82e1
commit
16dfe91140
2 changed files with 20 additions and 1 deletions
|
|
@ -62,7 +62,7 @@ class SeriesController(
|
||||||
val pageRequest = PageRequest.of(
|
val pageRequest = PageRequest.of(
|
||||||
page.pageNumber,
|
page.pageNumber,
|
||||||
page.pageSize,
|
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())
|
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.model.makeSeries
|
||||||
import org.gotson.komga.domain.persistence.LibraryRepository
|
import org.gotson.komga.domain.persistence.LibraryRepository
|
||||||
import org.gotson.komga.domain.persistence.SeriesRepository
|
import org.gotson.komga.domain.persistence.SeriesRepository
|
||||||
|
import org.hamcrest.Matchers
|
||||||
import org.junit.jupiter.api.AfterAll
|
import org.junit.jupiter.api.AfterAll
|
||||||
import org.junit.jupiter.api.AfterEach
|
import org.junit.jupiter.api.AfterEach
|
||||||
import org.junit.jupiter.api.BeforeAll
|
import org.junit.jupiter.api.BeforeAll
|
||||||
|
|
@ -80,6 +81,24 @@ class SeriesControllerTest(
|
||||||
jsonPath("$.content[1].metadata.title") { value("Beta") }
|
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
|
@Nested
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue