Open
Conversation
PFCJeong
approved these changes
Oct 21, 2023
Member
PFCJeong
left a comment
There was a problem hiding this comment.
수고하셨습니다~
다음부터는 수정이 필요한 부분만 commit해주시면 좋을 것 같아요!
|
|
||
| override fun exists(playlistId: Long, userId: Long): Boolean { | ||
| TODO() | ||
| val userEntity = userRepository.findById(userId).orElseThrow{ UserNotFoundException() } |
Member
There was a problem hiding this comment.
val userEntity = userRepository.findById(userId).orElseThrow(::UserNotFoundException)이렇게 줄여줄 수 있습니다.
| if(!exists(playlistId,userId)) throw PlaylistNeverLikedException() | ||
| val userEntity = userRepository.findById(userId).orElseThrow{ UserNotFoundException() } | ||
| val playlistEntity = playlistRepository.findById(playlistId).orElseThrow { PlaylistNotFoundException() } | ||
| playlistLikeRepository.deleteByPlaylistAndUser(playlist = playlistEntity, user = userEntity) |
Member
There was a problem hiding this comment.
취소 테스트는 IntegrationTest에 없어서 이슈가 없었을 것 같은데요
사실 요 코드는 이슈가 있습니다. @Transactional이 없기 때문에 deleteByPlaylistAndUser는 에러가 발생하게 돼요.
ServiceTest가 성공한 이유는 클래스 자체에 @Transactional이 붙어있기 때문입니다.
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.
사진은 무슨 이유에서 추가된건지 의아하네용,,