-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat] 닉네임 등록 API #37
Conversation
@heoboseong7 이거 리뷰해도되는 상태에요지금~?~? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고했습니다
@ExceptionHandler(IllegalArgumentException.class) | ||
@ResponseStatus(BAD_REQUEST) | ||
public ApiResponse<?> handleIllegalArgumentException(IllegalArgumentException ex) { | ||
log.info("handleIllegalArgumentException: {}", ex.getMessage(), ex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
에러로그는 log.error로 하는게 좋아보입니당 (나중에 로그 레벨 별로 알람 처리 예정)
|
||
@PostMapping("/link") | ||
public Long createLink() { | ||
return profileService.createLink(new CreateLinkDto(4L, "hs")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기는 영기 담당??
@ResponseStatus(BAD_REQUEST) | ||
public ApiResponse<?> handleIllegalArgumentException(IllegalArgumentException ex) { | ||
log.info("handleIllegalArgumentException: {}", ex.getMessage(), ex); | ||
return ApiResponse.failure(KeeweRtnConsts.ERR400, ex.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KeeweRtnConsts가 고정된 형태가 아니라 외부에서 들어온값을 써야되는 형태가 돼야될듯한데
나중에 정리하면서 얘기해보시져 ㅎ
throw new KeeweAuthException(KeeweRtnConsts.ERR401); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else로 분기처리 돼야되는부분 -> 이건 제쪽에서 처리함.
@@ -12,6 +12,7 @@ public enum KeeweRtnConsts { | |||
ERR402(KeeweRtnGrp.Auth, 402, "토큰이 만료됐어요."), | |||
ERR403(KeeweRtnGrp.Auth, 403, "토큰이 누락됐어요."), | |||
|
|||
ERR400(KeeweRtnGrp.Validation, 400, "잘못된 요청이에요."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이건 너무 애매한 응답 메시지 같은데.. 이것도 ExceptionAdvice랑 같이 얘끼해보시져 이따가
private boolean isCreatingOrElseThrow() { | ||
if (this.profileStatus.getOrder() >= ACTIVE.getOrder()) { | ||
throw new IllegalStateException("프로필 생성이 이미 완료되었습니다."); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
private void checkNicknameLength(String nickname) { | ||
final int NICKNAME_MAX_LENGTH = 12; | ||
if (StringLengthUtil.getGraphemeLength(nickname) > NICKNAME_MAX_LENGTH) { | ||
throw new IllegalArgumentException("닉네임의 길이가 12자를 초과해요."); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이것도 향후에는 전부 KeeweRtnConsts와 KeeweException으로 관리해야됩니다
Boolean existsByLinkAndDeletedFalse(String link); | ||
|
||
default Profile findByIdAndUserIdAndDeletedFalseOrElseThrow(Long id, Long userId) { | ||
return findByIdAndUserIdAndDeletedFalse(id, userId).orElseThrow(() -> new IllegalArgumentException("허보성 바보")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
얘도 KeeweException & KeeweRtnConsts
@PostMapping | ||
public String tempLogin(@RequestBody String email) { | ||
System.out.println("email = " + email); | ||
List<String> roles = new ArrayList<>(); | ||
return jwtUtils.createToken(email, roles); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좀이따 정리대상
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거는 지워버리고 올릴게요
KeeweRtnConsts.NRM000, | ||
KeeweRtnConsts.NRM000.getDescription(), | ||
KeeweRtnConsts.NRM000.getCode(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
성공코드도 여러개가있을수있어요 외부 주입으로 변경돼야할듯한데 같이 논의대상
|
||
private void checkDuplicateLinkOrElseThrows(String link) { | ||
if (profileRepository.existsByLinkAndDeletedFalse(link)) | ||
throw new IllegalArgumentException("허보성 바보!!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
영기파트?? KeeweRtnConsts & Exception 처리 대상
#31