diff --git a/src/main/java/com/offer/member/MemberController.java b/src/main/java/com/offer/member/MemberController.java index c1f60bd..25e8c65 100644 --- a/src/main/java/com/offer/member/MemberController.java +++ b/src/main/java/com/offer/member/MemberController.java @@ -7,6 +7,7 @@ import com.offer.common.response.ApiResponse; import com.offer.common.response.ResponseMessage; import com.offer.member.request.MemberUpdateRequest; +import com.offer.member.request.NicknameQueryRequest; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.security.SecurityRequirement; @@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -32,8 +34,8 @@ public class MemberController { @Operation(summary = "닉네임 중복 조회") @PostMapping("/nickname-duplicate") - public ResponseEntity>> getNicknameDuplication(String nickname) { - boolean exists = memberService.hasNickname(nickname); + public ResponseEntity>> getNicknameDuplication(@RequestBody NicknameQueryRequest request) { + boolean exists = memberService.hasNickname(request.getNickname()); HashMap result = new HashMap<>(); result.put("duplicate", exists); return ResponseEntity.ok( @@ -63,7 +65,7 @@ public ResponseEntity> getMember(@PathVariabl @PutMapping("/member/{memberId}") public ResponseEntity> updateMember( @Schema(hidden = true) @AuthenticationPrincipal LoginMember loginMember, - @PathVariable Long memberId, MemberUpdateRequest request) { + @PathVariable Long memberId, @RequestBody MemberUpdateRequest request) { log.info("getMember = {}", loginMember); if (loginMember.getId() == null) { throw new IllegalArgumentException("잘못된 토큰"); diff --git a/src/main/java/com/offer/member/MemberService.java b/src/main/java/com/offer/member/MemberService.java index 4ccf237..98ca8ab 100644 --- a/src/main/java/com/offer/member/MemberService.java +++ b/src/main/java/com/offer/member/MemberService.java @@ -56,7 +56,7 @@ public Long updateMember(Long memberId, MemberUpdateRequest request) { if (StringUtils.hasText(profileImageUrl)) { member.changeProfileImageUrl(profileImageUrl); } - if (StringUtils.hasText(nickname)) { + if (!StringUtils.hasText(nickname)) { throw new IllegalArgumentException("닉네임이 비어있음"); } member.changeNickname(nickname); diff --git a/src/main/java/com/offer/member/request/NicknameQueryRequest.java b/src/main/java/com/offer/member/request/NicknameQueryRequest.java new file mode 100644 index 0000000..40db09c --- /dev/null +++ b/src/main/java/com/offer/member/request/NicknameQueryRequest.java @@ -0,0 +1,11 @@ +package com.offer.member.request; + +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@NoArgsConstructor +public class NicknameQueryRequest { + + private String nickname; +}