Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6/12 배포 작업 #78

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
package backend.itracker.tracker.controller.request

private const val DEFAULT_PAGE_SIZE = 10

private const val DEFAULT_PAGE_START_NUMBER = 1

class PageParams(
private var page: Int = 1,
var limit: Int = 8
private var page: Int = DEFAULT_PAGE_START_NUMBER,
var limit: Int = DEFAULT_PAGE_SIZE
) {

init {
require(page >= 1) { throw IllegalArgumentException("page는 1이상 입력해주세요. page=$page") }
require(limit >= 1) { throw IllegalArgumentException("limit는 1이상 입력해주세요. limit=$limit") }
require(page >= DEFAULT_PAGE_START_NUMBER) { throw IllegalArgumentException("page는 ${DEFAULT_PAGE_START_NUMBER}이상 입력해주세요. page=$page") }
require(limit >= DEFAULT_PAGE_START_NUMBER) { throw IllegalArgumentException("limit는 ${DEFAULT_PAGE_START_NUMBER}이상 입력해주세요. limit=$limit") }
}

val offset: Int
get() = page - 1
get() = page - DEFAULT_PAGE_START_NUMBER
}



Loading