Skip to content
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

Merged
merged 17 commits into from
Jul 10, 2022
Merged

[Feat] 닉네임 등록 API #37

merged 17 commits into from
Jul 10, 2022

Conversation

heoboseong7
Copy link
Collaborator

@heoboseong7 heoboseong7 commented Jul 8, 2022

#31

  • ProfileStatus order필드 추가
  • 닉네임 생성 API 추가
  • ApiResponse 추가
  • Exception Handler 추가
  • StringLengthUtil (이모지 길이 1로 계산) 추가

@heoboseong7 heoboseong7 marked this pull request as ready for review July 9, 2022 13:31
@Youhoseong
Copy link
Collaborator

@heoboseong7 이거 리뷰해도되는 상태에요지금~?~?

Copy link
Collaborator

@Youhoseong Youhoseong left a 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);
Copy link
Collaborator

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"));
Copy link
Collaborator

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());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KeeweRtnConsts가 고정된 형태가 아니라 외부에서 들어온값을 써야되는 형태가 돼야될듯한데

나중에 정리하면서 얘기해보시져 ㅎ

Comment on lines -46 to -47
throw new KeeweAuthException(KeeweRtnConsts.ERR401);

Copy link
Collaborator

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, "잘못된 요청이에요."),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이건 너무 애매한 응답 메시지 같은데.. 이것도 ExceptionAdvice랑 같이 얘끼해보시져 이따가

Comment on lines +107 to +120
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자를 초과해요.");
}
}
Copy link
Collaborator

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("허보성 바보"));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

얘도 KeeweException & KeeweRtnConsts

Comment on lines 20 to 25
@PostMapping
public String tempLogin(@RequestBody String email) {
System.out.println("email = " + email);
List<String> roles = new ArrayList<>();
return jwtUtils.createToken(email, roles);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좀이따 정리대상

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거는 지워버리고 올릴게요

Comment on lines +19 to +21
KeeweRtnConsts.NRM000,
KeeweRtnConsts.NRM000.getDescription(),
KeeweRtnConsts.NRM000.getCode(),
Copy link
Collaborator

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("허보성 바보!!");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

영기파트?? KeeweRtnConsts & Exception 처리 대상

@heoboseong7 heoboseong7 merged commit f13d888 into main Jul 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants