diff --git a/src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/ExposedPaginationExtension.kt b/src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/ExposedPaginationExtension.kt index 796ab0c6..f00d9dcb 100644 --- a/src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/ExposedPaginationExtension.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/infrastructure/exposed/ExposedPaginationExtension.kt @@ -1,25 +1,11 @@ package dev.usbharu.hideout.application.infrastructure.exposed -import org.jetbrains.exposed.dao.id.EntityID import org.jetbrains.exposed.sql.ExpressionWithColumnType import org.jetbrains.exposed.sql.Query import org.jetbrains.exposed.sql.SortOrder import org.jetbrains.exposed.sql.andWhere -fun Query.pagination(page: Page, exp: ExpressionWithColumnType): Query { - if (page.minId != null) { - page.maxId?.let { andWhere { exp.less(it) } } - page.minId?.let { andWhere { exp.greater(it) } } - } else { - page.maxId?.let { andWhere { exp.less(it) } } - page.sinceId?.let { andWhere { exp.greater(it) } } - this.orderBy(exp, SortOrder.DESC) - } - page.limit?.let { limit(it) } - return this -} - -fun Query.pagination(page: Page, exp: ExpressionWithColumnType>): Query { +fun Query.pagination(page: Page, exp: ExpressionWithColumnType): Query { if (page.minId != null) { page.maxId?.let { andWhere { exp.less(it) } } page.minId?.let { andWhere { exp.greater(it) } }