Skip to content

Commit 60dc799

Browse files
committed
CLAP-331 Feat: 프로필 이미지 삭제 로직 추가
<footer> - 관련: #420
1 parent 6a14ae2 commit 60dc799

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

src/main/java/clap/server/adapter/inbound/web/dto/member/request/UpdateMemberInfoRequest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
import io.swagger.v3.oas.annotations.media.Schema;
44
import jakarta.validation.constraints.NotBlank;
5+
import jakarta.validation.constraints.NotNull;
56

67
public record UpdateMemberInfoRequest(
78
@NotBlank @Schema(description = "이름")
89
String name,
10+
@NotNull @Schema(description = "이미지 수정이 있을 시에는 false을, 이미지를 삭제할 때에는 true을 보냅니다.")
11+
Boolean isProfileImageDeleted,
912
@Schema(description = "아지트 알림 수신 여부")
1013
boolean agitNotification,
1114
@Schema(description = "이메일 알림 수신 여부")

src/main/java/clap/server/application/service/member/UpdateMemberInfoService.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,17 @@ class UpdateMemberInfoService implements UpdateMemberInfoUsecase {
2323
private final CommandMemberPort commandMemberPort;
2424

2525
@Override
26-
public void updateMemberInfo(Long memberId, UpdateMemberInfoRequest request, MultipartFile profileImage) throws IOException {
26+
public void updateMemberInfo(Long memberId, UpdateMemberInfoRequest request, MultipartFile profileImage) {
2727
Member member = memberService.findActiveMember(memberId);
28-
String profileImageUrl = profileImage != null ? s3UploadPort.uploadSingleFile(FilePathPolicyConstants.MEMBER_IMAGE, profileImage) : null;
28+
if(request.isProfileImageDeleted()){
29+
member.setImageUrl(null);
30+
}
31+
else {
32+
String profileImageUrl = profileImage != null ? s3UploadPort.uploadSingleFile(FilePathPolicyConstants.MEMBER_IMAGE, profileImage) : member.getImageUrl();
33+
member.setImageUrl(profileImageUrl);
34+
}
2935
member.updateMemberInfo(request.name(), request.agitNotification(), request.emailNotification(),
30-
request.kakaoWorkNotification(), profileImageUrl);
36+
request.kakaoWorkNotification());
3137
commandMemberPort.save(member);
3238
}
3339
}

src/main/java/clap/server/domain/model/member/Member.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,17 @@ public void changeToApproveRequested() {
7979
this.status = MemberStatus.APPROVAL_REQUEST;
8080
}
8181

82-
public void updateMemberInfo(String name, Boolean agitNotificationEnabled, Boolean emailNotificationEnabled, Boolean kakaoWorkNotificationEnabled, String imageUrl) {
82+
public void updateMemberInfo(String name, Boolean agitNotificationEnabled, Boolean emailNotificationEnabled, Boolean kakaoWorkNotificationEnabled) {
8383
this.memberInfo.updateName(name);
8484
this.agitNotificationEnabled = agitNotificationEnabled;
8585
this.emailNotificationEnabled = emailNotificationEnabled;
8686
this.kakaoworkNotificationEnabled = kakaoWorkNotificationEnabled;
87-
if (imageUrl != null) {
88-
this.imageUrl = imageUrl;
89-
}
9087
}
88+
89+
public void setImageUrl(String imageUrl) {
90+
this.imageUrl = imageUrl;
91+
}
92+
9193
public void setStatusDeleted() {
9294
this.status = MemberStatus.DELETED;
9395
}

0 commit comments

Comments
 (0)