mirror of
https://github.com/gotson/komga.git
synced 2025-12-16 13:33:49 +01: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(
|
||||
"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? =
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ class ReadListController(
|
|||
@Parameter(hidden = true) page: Pageable,
|
||||
): Page<ReadListDto> {
|
||||
val sort = when {
|
||||
page.sort.isSorted -> page.sort
|
||||
!searchTerm.isNullOrBlank() -> Sort.by("relevance")
|
||||
else -> Sort.by(Sort.Order.asc("name"))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue