Skip to content

Commit

Permalink
feat: 회원가입시 닉네임 중복 확인 기능 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kjungw1025 committed Dec 12, 2023
1 parent b25ee40 commit edf6012
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import com.taba.nimonaemo.member.model.dto.response.ResponseSignupTokenDto;
import com.taba.nimonaemo.member.service.MemberService;
import com.taba.nimonaemo.member.service.SignupService;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
Expand Down Expand Up @@ -72,6 +74,19 @@ public ResponseRefreshTokenDto refreshToken(HttpServletRequest request,
return memberService.refreshToken(request, refreshToken);
}

/**
* 닉네임 중복 확인
* @param nickname 닉네임
*/
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "중복되는 닉네임이 없습니다."),
@ApiResponse(responseCode = "500", description = "already.nickname")
})
@PostMapping("/signup/verify/{nickname}")
public void verifyNickname(@PathVariable("nickname") String nickname) {
signupService.checkAlreadyNickname(nickname);
}

// /**
// * 회원탈퇴
// * <p>회원은 바로 삭제되지 않고, 일정 기간 뒤에 삭제됩니다. 삭제시에도 개인 정보만 삭제됩니다.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private void checkAlreadyName(String name) {
}
}

private void checkAlreadyNickname(String nickname) {
public void checkAlreadyNickname(String nickname) {
Optional<Member> alreadyMember = memberRepository.findByNickname(nickname);
if (alreadyMember.isPresent()) {
throw new AlreadyNicknameException();
Expand Down

0 comments on commit edf6012

Please sign in to comment.