From 78c6d23295b8e81425c321186f2cda71eb02eb6e Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Thu, 10 Jun 2021 14:56:00 +0800 Subject: [PATCH] fix(api): publisher and authors were not sorted lowercase --- .../komga/infrastructure/jooq/ReferentialDao.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReferentialDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReferentialDao.kt index b32977813..0b103f98e 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReferentialDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReferentialDao.kt @@ -38,7 +38,7 @@ class ReferentialDao( .apply { filterOnLibraryIds?.let { leftJoin(b).on(a.BOOK_ID.eq(b.ID)) } } .where(a.NAME.containsIgnoreCase(search)) .apply { filterOnLibraryIds?.let { and(b.LIBRARY_ID.`in`(it)) } } - .orderBy(a.NAME, a.ROLE) + .orderBy(lower(a.NAME), a.ROLE) .fetchInto(a) .map { it.toDomain() } @@ -49,7 +49,7 @@ class ReferentialDao( .where(bmaa.NAME.containsIgnoreCase(search)) .and(s.LIBRARY_ID.eq(libraryId)) .apply { filterOnLibraryIds?.let { and(s.LIBRARY_ID.`in`(it)) } } - .orderBy(bmaa.NAME, bmaa.ROLE) + .orderBy(lower(bmaa.NAME), bmaa.ROLE) .fetchInto(bmaa) .map { it.toDomain() } @@ -61,7 +61,7 @@ class ReferentialDao( .where(bmaa.NAME.containsIgnoreCase(search)) .and(cs.COLLECTION_ID.eq(collectionId)) .apply { filterOnLibraryIds?.let { and(s.LIBRARY_ID.`in`(it)) } } - .orderBy(bmaa.NAME, bmaa.ROLE) + .orderBy(lower(bmaa.NAME), bmaa.ROLE) .fetchInto(bmaa) .map { it.toDomain() } @@ -72,7 +72,7 @@ class ReferentialDao( .where(bmaa.NAME.containsIgnoreCase(search)) .and(bmaa.SERIES_ID.eq(seriesId)) .apply { filterOnLibraryIds?.let { and(s.LIBRARY_ID.`in`(it)) } } - .orderBy(bmaa.NAME, bmaa.ROLE) + .orderBy(lower(bmaa.NAME), bmaa.ROLE) .fetchInto(bmaa) .map { it.toDomain() } @@ -124,7 +124,7 @@ class ReferentialDao( val count = dsl.fetchCount(query) val items = query - .orderBy(bmaa.NAME, bmaa.ROLE) + .orderBy(lower(bmaa.NAME), bmaa.ROLE) .apply { if (pageable.isPaged) limit(pageable.pageSize).offset(pageable.offset) } .fetchInto(a) .map { it.toDomain() } @@ -301,7 +301,7 @@ class ReferentialDao( .apply { filterOnLibraryIds?.let { leftJoin(s).on(sd.SERIES_ID.eq(s.ID)) } } .where(sd.PUBLISHER.ne("")) .apply { filterOnLibraryIds?.let { and(s.LIBRARY_ID.`in`(it)) } } - .orderBy(sd.PUBLISHER) + .orderBy(lower(sd.PUBLISHER)) .fetchSet(sd.PUBLISHER) override fun findAllPublishersByLibrary(libraryId: String, filterOnLibraryIds: Collection?): Set = @@ -311,7 +311,7 @@ class ReferentialDao( .where(sd.PUBLISHER.ne("")) .and(s.LIBRARY_ID.eq(libraryId)) .apply { filterOnLibraryIds?.let { and(s.LIBRARY_ID.`in`(it)) } } - .orderBy(sd.PUBLISHER) + .orderBy(lower(sd.PUBLISHER)) .fetchSet(sd.PUBLISHER) override fun findAllPublishersByCollection(collectionId: String, filterOnLibraryIds: Collection?): Set = @@ -322,7 +322,7 @@ class ReferentialDao( .where(sd.PUBLISHER.ne("")) .and(cs.COLLECTION_ID.eq(collectionId)) .apply { filterOnLibraryIds?.let { and(s.LIBRARY_ID.`in`(it)) } } - .orderBy(sd.PUBLISHER) + .orderBy(lower(sd.PUBLISHER)) .fetchSet(sd.PUBLISHER) override fun findAllAgeRatings(filterOnLibraryIds: Collection?): Set =