Conversation
Chuseok22
requested changes
Nov 11, 2024
Comment on lines
+20
to
+26
| //중복된 경우 회원가입불가 | ||
| if (userRepository.existsByUsername(userDto.getUsername())) { | ||
| throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "이미 존재하는 아이디입니다."); | ||
| } else if (userRepository.existsByNickname(userDto.getNickname())) { | ||
| throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "이미 존재하는 닉네임입니다."); | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
확실하게 눈으로 보고싶으면 코드 작성한 것 처럼 직접 throw new 사용해서 예외처리하면 되구,
지금 엔티티 코드에서 Column unique = true설정했으니까 20~25번째 줄 없어도 DB에 저장될 때 알아서 예외 던지기도 해요
음...추천하는 방식은 둘다 좋지만 눈으로 CustomException만들어서 한번 더 던지면 좋을 것 같네요 ㅎㅎ
지금 방법 good
Comment on lines
+40
to
+42
| public String login(UserDto userDto){ | ||
| if (userRepository.existsByUsername(userDto.getUsername())&& | ||
| userRepository.existsByNickname(userDto.getNickname())) { |
Member
There was a problem hiding this comment.
로그인할때는 아이디랑 비밀번호만 받을텐데....ㅎㅎ
닉네임에는 null값 넘어올거에요
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.
No description provided.