Merged
Conversation
99hyuk
reviewed
Jul 14, 2025
src/main/java/com/sumte/guesthouse/controller/GuesthouseController.java
Outdated
Show resolved
Hide resolved
| @Transactional | ||
| public void activateAdvertisement(Long guesthouseId) { | ||
| Guesthouse guesthouse = guesthouseRepository.findById(guesthouseId) | ||
| .orElseThrow(() -> new SumteException(CommonErrorCode.NOT_EXIST)); |
Contributor
There was a problem hiding this comment.
게스트하우스 전용 예외처리를 사용하면 더 좋을 것 같습니다!
| Optional.ofNullable(roomRepository.findEarliestCheckinByGuesthouseId(gh.getId())).orElse("00:00"), | ||
| Optional.ofNullable(roomRepository.findMinPriceByGuesthouseId(gh.getId())).orElse(0L) | ||
| )); | ||
| } |
Contributor
There was a problem hiding this comment.
체크인 시간과, 가격 같은 경우 0으로 제공되는 것보단 null이나 -1같은 특별한 값으로 프론트에서 처리할 수 있도록 하는 것이 좋아 보입니다. (관련 설명을 스웨거에도 기입해주면 좋겠죠?)
| Double findAverageScoreByGuesthouseId(@Param("guesthouseId") Long guesthouseId); | ||
|
|
||
| @Query("SELECT COUNT(r) FROM Review r WHERE r.room.guesthouse.id = :guesthouseId") | ||
| int countByGuesthouseId(@Param("guesthouseId") Long guesthouseId); |
Contributor
There was a problem hiding this comment.
int countByRoomGuesthouseId(Long guesthouseId); 처럼 @Query 없이 메서드 쿼리로 구현 가능해 보입니다!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 관련 이슈
✨ PR 세부 내용
💬 리뷰 요청 사항
✅ 체크리스트