From 274ac6aae1d7d763bd52f30e882d612e3bd4c098 Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Thu, 2 Jan 2025 14:52:11 +0800 Subject: [PATCH] refactor: remove duplicated code --- .../org/gotson/komga/infrastructure/jooq/BookSearchHelper.kt | 3 +-- .../org/gotson/komga/infrastructure/jooq/main/BookDtoDao.kt | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookSearchHelper.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookSearchHelper.kt index a6c0d851b..0b157ed90 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookSearchHelper.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookSearchHelper.kt @@ -61,8 +61,7 @@ class BookSearchHelper( when (searchCondition.operator) { // for IS condition we have to do a join, so as to order the books by readList number is SearchOperator.Is -> - Tables.READLIST_BOOK - .`as`("RLB_${searchCondition.operator.value}") + rlbAlias(searchCondition.operator.value) .READLIST_ID .eq(searchCondition.operator.value) to setOf(RequiredJoin.ReadList(searchCondition.operator.value)) is SearchOperator.IsNot -> { diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/main/BookDtoDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/main/BookDtoDao.kt index b72f80bd7..a446bdf64 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/main/BookDtoDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/main/BookDtoDao.kt @@ -134,7 +134,7 @@ class BookDtoDao( } else { if (it.property == "readList.number") { val readListId = joins.filterIsInstance().firstOrNull()?.readListId ?: return@mapNotNull null - val f = rlb.`as`("RLB_$readListId").NUMBER + val f = rlbAlias(readListId).NUMBER if (it.isAscending) f.asc() else f.desc() } else { it.toSortField(sorts)