diff --git a/src/main/java/com/j9/bestmoments/dto/request/MemberUpdateDto.java b/src/main/java/com/j9/bestmoments/dto/request/MemberUpdateDto.java index 9edf338..42d1c3f 100644 --- a/src/main/java/com/j9/bestmoments/dto/request/MemberUpdateDto.java +++ b/src/main/java/com/j9/bestmoments/dto/request/MemberUpdateDto.java @@ -11,12 +11,10 @@ public record MemberUpdateDto ( @ImageTypeCheck MultipartFile file, - @NotNull @NotBlank @Size(max = 20, message = "이름은 20자 이내로 입력해주세요.") String name, - @NotNull @NotBlank @Size(max = 1000, message = "자기소개는 1000자 이내로 입력해주세요.") String description diff --git a/src/main/java/com/j9/bestmoments/service/MemberService.java b/src/main/java/com/j9/bestmoments/service/MemberService.java index f2559d2..74d9dd9 100644 --- a/src/main/java/com/j9/bestmoments/service/MemberService.java +++ b/src/main/java/com/j9/bestmoments/service/MemberService.java @@ -58,10 +58,16 @@ private Member create(OAuthUserInfoDto oAuthUserInfoDto) { @Transactional public Member update(Member member, MemberUpdateDto memberUpdateDto) { - member.setName(memberUpdateDto.name()); - member.setDescription(memberUpdateDto.description()); - String profileImageUrl = googleCloudStorageService.uploadFile(memberUpdateDto.file()); - member.setProfileImageUrl(profileImageUrl); + if (memberUpdateDto.name() != null) { + member.setName(memberUpdateDto.name()); + } + if (memberUpdateDto.description() != null) { + member.setDescription(memberUpdateDto.description()); + } + if (memberUpdateDto.file() != null) { + String profileImageUrl = googleCloudStorageService.uploadFile(memberUpdateDto.file()); + member.setProfileImageUrl(profileImageUrl); + } return memberRepository.save(member); }