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 @@ -2,10 +2,13 @@

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

public record UpdateMemberInfoRequest(
@NotBlank @Schema(description = "이름")
String name,
@NotNull @Schema(description = "이미지 수정이 있을 시에는 false을, 이미지를 삭제할 때에는 true을 보냅니다.")
Boolean isProfileImageDeleted,
@Schema(description = "아지트 알림 수신 여부")
boolean agitNotification,
@Schema(description = "이메일 알림 수신 여부")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@ class UpdateMemberInfoService implements UpdateMemberInfoUsecase {
private final CommandMemberPort commandMemberPort;

@Override
public void updateMemberInfo(Long memberId, UpdateMemberInfoRequest request, MultipartFile profileImage) throws IOException {
public void updateMemberInfo(Long memberId, UpdateMemberInfoRequest request, MultipartFile profileImage) {
Member member = memberService.findActiveMember(memberId);
String profileImageUrl = profileImage != null ? s3UploadPort.uploadSingleFile(FilePathPolicyConstants.MEMBER_IMAGE, profileImage) : null;
if(request.isProfileImageDeleted()){
member.setImageUrl(null);
}
else {
String profileImageUrl = profileImage != null ? s3UploadPort.uploadSingleFile(FilePathPolicyConstants.MEMBER_IMAGE, profileImage) : member.getImageUrl();
member.setImageUrl(profileImageUrl);
}
member.updateMemberInfo(request.name(), request.agitNotification(), request.emailNotification(),
request.kakaoWorkNotification(), profileImageUrl);
request.kakaoWorkNotification());
commandMemberPort.save(member);
}
}
10 changes: 6 additions & 4 deletions src/main/java/clap/server/domain/model/member/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,17 @@ public void changeToApproveRequested() {
this.status = MemberStatus.APPROVAL_REQUEST;
}

public void updateMemberInfo(String name, Boolean agitNotificationEnabled, Boolean emailNotificationEnabled, Boolean kakaoWorkNotificationEnabled, String imageUrl) {
public void updateMemberInfo(String name, Boolean agitNotificationEnabled, Boolean emailNotificationEnabled, Boolean kakaoWorkNotificationEnabled) {
this.memberInfo.updateName(name);
this.agitNotificationEnabled = agitNotificationEnabled;
this.emailNotificationEnabled = emailNotificationEnabled;
this.kakaoworkNotificationEnabled = kakaoWorkNotificationEnabled;
if (imageUrl != null) {
this.imageUrl = imageUrl;
}
}

public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}

public void setStatusDeleted() {
this.status = MemberStatus.DELETED;
}
Expand Down