Skip to content

Commit

Permalink
refactor: 주문 페이징 조회 상한 개수 조정
Browse files Browse the repository at this point in the history
  • Loading branch information
TaeyeonRoyce committed May 17, 2024
1 parent 3e02fba commit bac405f
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package com.petqua.domain.order

import com.petqua.common.domain.dto.DEFAULT_LAST_VIEWED_ID
import com.petqua.common.domain.dto.PADDING_FOR_HAS_NEXT_PAGE
import com.petqua.common.domain.dto.PAGING_LIMIT_CEILING

private const val ORDER_PAGING_LIMIT_CEILING = 5

data class OrderPaging(
val lastViewedId: Long? = null,
val limit: Int = PAGING_LIMIT_CEILING,
val limit: Int = ORDER_PAGING_LIMIT_CEILING,
val lastViewedOrderNumber: OrderNumber? = null,
) {

Expand All @@ -17,7 +18,7 @@ data class OrderPaging(
lastViewedOrderNumber: OrderNumber?,
): OrderPaging {
val adjustedLastViewedId = if (lastViewedId == DEFAULT_LAST_VIEWED_ID) null else lastViewedId
val adjustedLimit = if (limit > PAGING_LIMIT_CEILING) PAGING_LIMIT_CEILING else limit
val adjustedLimit = if (limit > ORDER_PAGING_LIMIT_CEILING) ORDER_PAGING_LIMIT_CEILING else limit
return OrderPaging(adjustedLastViewedId, adjustedLimit + PADDING_FOR_HAS_NEXT_PAGE, lastViewedOrderNumber)
}
}
Expand Down

0 comments on commit bac405f

Please sign in to comment.