From babf46ce8b2e843d9dd96b1e3b153aab795cd7fb Mon Sep 17 00:00:00 2001 From: meohin Date: Mon, 22 Sep 2025 16:44:19 +0900 Subject: [PATCH 1/3] =?UTF-8?q?refactor:=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20DTO=EC=97=90=EC=84=9C=20=EC=9D=B4=EB=A9=94?= =?UTF-8?q?=EC=9D=BC=20=ED=95=84=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/back/domain/profile/dto/ProfileUpdateRequestDto.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/com/back/domain/profile/dto/ProfileUpdateRequestDto.java b/src/main/java/com/back/domain/profile/dto/ProfileUpdateRequestDto.java index 1a1cf1aa..bbbb434f 100644 --- a/src/main/java/com/back/domain/profile/dto/ProfileUpdateRequestDto.java +++ b/src/main/java/com/back/domain/profile/dto/ProfileUpdateRequestDto.java @@ -1,6 +1,5 @@ package com.back.domain.profile.dto; -import jakarta.validation.constraints.Email; import jakarta.validation.constraints.Size; import lombok.Getter; import lombok.Setter; @@ -11,7 +10,4 @@ public class ProfileUpdateRequestDto { @Size(min = 1, max = 10, message = "닉네임은 1~10자") private String nickname; - - @Email(message = "이메일 형식이 아닙니다") - private String email; } From 68a48bb42abe0bb26f0a679c56d0e96f2063fcd2 Mon Sep 17 00:00:00 2001 From: meohin Date: Mon, 22 Sep 2025 16:44:50 +0900 Subject: [PATCH 2/3] =?UTF-8?q?refactor:=20ProfileService=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `ProfileService`의 `updateProfile` 메서드에서 이메일 관련 업데이트 로직을 삭제 - 이는 프로필 수정 DTO(ProfileUpdateRequestDto)에서 이메일 필드를 제거한 변경사항에 맞춘 후속 조치 --- .../java/com/back/domain/profile/service/ProfileService.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/main/java/com/back/domain/profile/service/ProfileService.java b/src/main/java/com/back/domain/profile/service/ProfileService.java index c48cd155..5e307c4f 100644 --- a/src/main/java/com/back/domain/profile/service/ProfileService.java +++ b/src/main/java/com/back/domain/profile/service/ProfileService.java @@ -50,11 +50,6 @@ public ProfileResponseDto updateProfile(Long id, ProfileUpdateRequestDto profile user.setNickname(nickname); } - if (profileUpdateRequestDto.getEmail() != null) { - String email = profileUpdateRequestDto.getEmail().trim(); - user.setEmail(email.isEmpty() ? null : email); - } - userRepository.save(user); return getProfile(id); From d0c19cedae920bf9937bc3caa6090b60180655f0 Mon Sep 17 00:00:00 2001 From: meohin Date: Mon, 22 Sep 2025 16:45:33 +0900 Subject: [PATCH 3/3] =?UTF-8?q?refactor:=20ProfileController=20API=20?= =?UTF-8?q?=EC=97=94=EB=93=9C=ED=8F=AC=EC=9D=B8=ED=8A=B8=20=EB=B0=8F=20HTT?= =?UTF-8?q?P=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `ProfileController`의 기본 API 엔드포인트를 `/me/profile`에서 `/api/me/profile`로 변경 - 프로필 수정에 사용되던 **`PUT` 메서드를 제거하고,** 부분 업데이트에 더 적합한 `PATCH` 메서드를 도입 --- .../profile/controller/ProfileController.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/back/domain/profile/controller/ProfileController.java b/src/main/java/com/back/domain/profile/controller/ProfileController.java index c572924e..686bfbbb 100644 --- a/src/main/java/com/back/domain/profile/controller/ProfileController.java +++ b/src/main/java/com/back/domain/profile/controller/ProfileController.java @@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.*; @RestController -@RequestMapping("/me/profile") +@RequestMapping("/api/me/profile") @RequiredArgsConstructor public class ProfileController { @@ -24,9 +24,14 @@ public RsData getProfile(@AuthenticationPrincipal(expression return RsData.successOf(body); // code=200, message="success" } - @PutMapping - public RsData updateProfile(@AuthenticationPrincipal(expression = "id") Long userId, @Valid @RequestBody ProfileUpdateRequestDto profileUpdateRequestDto) { - ProfileResponseDto body = profileService.updateProfile(userId, profileUpdateRequestDto); - return RsData.successOf(body); // code=200 + // PUT 제거: PATCH 전용으로 운영 + + @PatchMapping + public RsData patchNickname( + @AuthenticationPrincipal(expression = "id") Long userId, + @Valid @RequestBody ProfileUpdateRequestDto request + ) { + ProfileResponseDto body = profileService.updateProfile(userId, request); + return RsData.successOf(body); } }