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

♻️ 닉네임 변경 API #115

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ public interface MemberService {

SecurityUserDto getUserInfo();

Member changeNickName(String nickname);
Member updateNickname(String nickname);

}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public SecurityUserDto getUserInfo() {


@Override
public Member changeNickName(String newNickname) {
public Member updateNickname(String newNickname) {
// 닉네임 입력 체크
isNicknameExist(newNickname);
// 닉네임 중복 체크
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
import aromanticcat.umcproject.service.MemberService;
import aromanticcat.umcproject.web.dto.MemberResponseDTO;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
public class MemberController {
@Autowired
private MemberService service;

private final MemberService service;

@PostMapping("/signUp")
@Operation(summary = "회원가입 API", description = "회원가입 API입니다.")
Expand All @@ -31,11 +32,11 @@ public ApiResponse<MemberResponseDTO.MemberJoinResultDTO> signup(@RequestBody St
}
}

@PostMapping("/mypage/changeNickname")
@PostMapping("/mypage/nickname")
@Operation(summary = "닉네임 변경 API", description = "닉네임 변경 API입니다.")
public ApiResponse<MemberResponseDTO.MemberJoinResultDTO> changeNickName(@RequestBody String nickname) {
public ApiResponse<MemberResponseDTO.MemberJoinResultDTO> updateNickname(@RequestBody String nickname) {
try {
Member user = service.changeNickName(nickname);
Member user = service.updateNickname(nickname);

return ApiResponse.onSuccess(MemberConverter.toMemberDTO(user));
} catch (Exception e) {
Expand Down
Loading