Skip to content

Commit

Permalink
pageable validation 설정 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
dennis0405 committed Jan 16, 2025
1 parent fbc1494 commit 1b421de
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import com.example.toyTeam6Airbnb.user.UserNotFoundException
import com.example.toyTeam6Airbnb.user.controller.User
import com.example.toyTeam6Airbnb.user.persistence.UserRepository
import com.example.toyTeam6Airbnb.validatePageable
import com.example.toyTeam6Airbnb.validateSortedPageable
import org.springframework.dao.DataIntegrityViolationException
import org.springframework.data.domain.Page
import org.springframework.data.domain.Pageable
Expand Down Expand Up @@ -68,7 +69,7 @@ class ReviewServiceImpl(
override fun getReviewsByRoom(roomId: Long, pageable: Pageable): Page<ReviewByRoomDTO> {
roomRepository.findByIdOrNull(roomId) ?: throw RoomNotFoundException()

val reviewEntities = reviewRepository.findAllByRoomId(roomId, validatePageable(pageable))
val reviewEntities = reviewRepository.findAllByRoomId(roomId, validateSortedPageable(pageable))

val reviews = reviewEntities.map { ReviewByRoomDTO.fromEntity(it) }
return reviews
Expand Down

0 comments on commit 1b421de

Please sign in to comment.