mirror of
https://github.com/gotson/komga.git
synced 2026-05-08 04:22:28 +02:00
feat(api): allow readlist custom sorting
This commit is contained in:
parent
cc5ced63be
commit
b9e69a1c9a
2 changed files with 3 additions and 0 deletions
|
|
@ -37,6 +37,8 @@ class ReadListDao(
|
||||||
|
|
||||||
private val sorts = mapOf(
|
private val sorts = mapOf(
|
||||||
"name" to rl.NAME.collate(SqliteUdfDataSource.collationUnicode3),
|
"name" to rl.NAME.collate(SqliteUdfDataSource.collationUnicode3),
|
||||||
|
"createdDate" to rl.CREATED_DATE,
|
||||||
|
"lastModifiedDate" to rl.LAST_MODIFIED_DATE,
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun findByIdOrNull(readListId: String, filterOnLibraryIds: Collection<String>?, restrictions: ContentRestrictions): ReadList? =
|
override fun findByIdOrNull(readListId: String, filterOnLibraryIds: Collection<String>?, restrictions: ContentRestrictions): ReadList? =
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@ class ReadListController(
|
||||||
@Parameter(hidden = true) page: Pageable,
|
@Parameter(hidden = true) page: Pageable,
|
||||||
): Page<ReadListDto> {
|
): Page<ReadListDto> {
|
||||||
val sort = when {
|
val sort = when {
|
||||||
|
page.sort.isSorted -> page.sort
|
||||||
!searchTerm.isNullOrBlank() -> Sort.by("relevance")
|
!searchTerm.isNullOrBlank() -> Sort.by("relevance")
|
||||||
else -> Sort.by(Sort.Order.asc("name"))
|
else -> Sort.by(Sort.Order.asc("name"))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue