Skip to content
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 @@ -11,7 +11,7 @@
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/me/profile")
@RequestMapping("/api/me/profile")
@RequiredArgsConstructor
public class ProfileController {

Expand All @@ -24,9 +24,14 @@ public RsData<ProfileResponseDto> getProfile(@AuthenticationPrincipal(expression
return RsData.successOf(body); // code=200, message="success"
}

@PutMapping
public RsData<ProfileResponseDto> 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<ProfileResponseDto> patchNickname(
@AuthenticationPrincipal(expression = "id") Long userId,
@Valid @RequestBody ProfileUpdateRequestDto request
) {
ProfileResponseDto body = profileService.updateProfile(userId, request);
return RsData.successOf(body);
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,7 +10,4 @@ public class ProfileUpdateRequestDto {

@Size(min = 1, max = 10, message = "닉네임은 1~10자")
private String nickname;

@Email(message = "이메일 형식이 아닙니다")
private String email;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down