From 1eac7f5c4a6fb6253bc168393c3c56fb71354410 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Mon, 12 Aug 2024 00:33:08 +0900 Subject: [PATCH 01/11] =?UTF-8?q?feat:=20Profile=EC=9D=84=20=EC=9D=B8?= =?UTF-8?q?=EC=9E=90=EB=A1=9C=20=EB=B0=9B=EB=8A=94=20deleteShareGroup=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/shareGroup/service/ShareGroupService.java | 1 + .../shareGroup/service/ShareGroupServiceImpl.java | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupService.java b/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupService.java index 03938aa..fbf6d0a 100644 --- a/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupService.java +++ b/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupService.java @@ -14,6 +14,7 @@ public interface ShareGroupService { ShareGroup joinShareGroup(Long shareGroupId, Long profileId, Member member); ShareGroup getInviteInfo(Long shareGroupId, Member member); ShareGroup deleteShareGroup(Long shareGroupId, Member member); + ShareGroup deleteShareGroup(Profile profile); Page getMyShareGroupList(Member member, Pageable pageable); ShareGroup findShareGroup(Long shareGroupId); ShareGroup findShareGroup(String inviteCode); diff --git a/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java b/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java index 512fe9c..7e62079 100644 --- a/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java @@ -134,6 +134,16 @@ public ShareGroup deleteShareGroup(Long shareGroupId, Member member) { return shareGroup; } + @Override + public ShareGroup deleteShareGroup(Profile profile) { + if (!profile.getRole().equals(Role.CREATOR)) { + throw new BusinessException(ShareGroupErrorCode.UNAUTHORIZED_DELETE); + } + ShareGroup shareGroup = profile.getShareGroup(); + shareGroup.delete(); + return shareGroup; + } + @Override public ShareGroup findShareGroup(Long shareGroupId) { return shareGroupRepository.findById(shareGroupId) From 803aee10793dc56e8a786935433386d50f7b7a8b Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 14 Aug 2024 18:18:55 +0900 Subject: [PATCH 02/11] rebasing --- .../member/controller/MemberController.java | 15 +++++++++++ .../member/converter/MemberConverter.java | 6 +++++ .../domain/member/dto/MemberResponse.java | 12 +++++++++ .../domain/member/service/MemberService.java | 2 +- .../member/service/MemberServiceImpl.java | 26 +++++++++++++++++++ .../global/result/code/MemberResultCode.java | 3 ++- 6 files changed, 62 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/member/controller/MemberController.java b/src/main/java/com/umc/naoman/domain/member/controller/MemberController.java index 4dbf64b..b599792 100644 --- a/src/main/java/com/umc/naoman/domain/member/controller/MemberController.java +++ b/src/main/java/com/umc/naoman/domain/member/controller/MemberController.java @@ -77,4 +77,19 @@ public ResultResponse getMarketingAgreed(@PathVa public ResultResponse hasSamplePhoto(@LoginMember Member member) { return ResultResponse.of(CHECK_HAS_SAMPLE_PHOTO, memberService.hasSamplePhoto(member)); } + + @DeleteMapping + @Operation(summary = "회원 탈퇴 API", description = "[request]\n" + + "[response]\n 탈퇴 memberId, 탈퇴 시간") + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "SM007", description = "회원 탈퇴 성공."), + @io.swagger.v3.oas.annotations.responses.ApiResponse + (responseCode = "EM001", description = "해당 memberId를 가진 회원이 존재하지 않습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + }) + public ResultResponse deleteMember(@LoginMember Member member){ + return ResultResponse.of(MemberResultCode.DELETE_MEMBER, memberConverter.toDeleteMemberInfo(member)); + + } + } diff --git a/src/main/java/com/umc/naoman/domain/member/converter/MemberConverter.java b/src/main/java/com/umc/naoman/domain/member/converter/MemberConverter.java index e1fece0..0132bee 100644 --- a/src/main/java/com/umc/naoman/domain/member/converter/MemberConverter.java +++ b/src/main/java/com/umc/naoman/domain/member/converter/MemberConverter.java @@ -71,4 +71,10 @@ public MarketingAgreed toMarketingAgreed(Member member) { .build(); } + public MemberResponse.deleteMemberInfo toDeleteMemberInfo(Member member) { + return MemberResponse.deleteMemberInfo.builder() + .memberId(member.getId()) + .deletedAt(member.getDeletedAt()) + .build(); + } } diff --git a/src/main/java/com/umc/naoman/domain/member/dto/MemberResponse.java b/src/main/java/com/umc/naoman/domain/member/dto/MemberResponse.java index 1bd72b8..a9d045b 100644 --- a/src/main/java/com/umc/naoman/domain/member/dto/MemberResponse.java +++ b/src/main/java/com/umc/naoman/domain/member/dto/MemberResponse.java @@ -1,9 +1,12 @@ package com.umc.naoman.domain.member.dto; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; +import java.time.LocalDateTime; + public abstract class MemberResponse { @Getter @AllArgsConstructor @@ -43,6 +46,15 @@ public static class MarketingAgreed { private Boolean marketingAgreed; } + @Builder + @Getter + @AllArgsConstructor + public static class deleteMemberInfo { + private Long memberId; + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDateTime deletedAt; + } + @Getter @AllArgsConstructor public static class HasSamplePhoto { diff --git a/src/main/java/com/umc/naoman/domain/member/service/MemberService.java b/src/main/java/com/umc/naoman/domain/member/service/MemberService.java index 6526b89..5fba3ca 100644 --- a/src/main/java/com/umc/naoman/domain/member/service/MemberService.java +++ b/src/main/java/com/umc/naoman/domain/member/service/MemberService.java @@ -21,5 +21,5 @@ public interface MemberService { MemberId getMyMemberId(Member member); Member findMember(Long memberId); Member findMember(SocialType socialType, String authId); - + Member deleteMember(Long memberId); } diff --git a/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java b/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java index 3f40c18..506804f 100644 --- a/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java @@ -14,6 +14,10 @@ import com.umc.naoman.domain.member.repository.MemberRepository; import com.umc.naoman.domain.member.service.redis.RefreshTokenService; import com.umc.naoman.domain.photo.service.PhotoService; +import com.umc.naoman.domain.shareGroup.entity.Profile; +import com.umc.naoman.domain.shareGroup.entity.Role; +import com.umc.naoman.domain.shareGroup.entity.ShareGroup; +import com.umc.naoman.domain.shareGroup.service.ShareGroupService; import com.umc.naoman.global.error.BusinessException; import com.umc.naoman.global.security.util.JwtUtils; import io.jsonwebtoken.Claims; @@ -22,6 +26,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.List; + import static com.umc.naoman.global.error.code.MemberErrorCode.*; @Service @@ -32,6 +38,8 @@ public class MemberServiceImpl implements MemberService { private final PhotoService photoService; private final MemberRepository memberRepository; private final MemberConverter memberConverter; + private final ShareGroupService shareGroupService; + private final JwtUtils jwtUtils; @Value("${jwt.access-token-validity-in-seconds}") private Long ACCESS_TOKEN_VALIDITY_IN_SECONDS; @@ -69,7 +77,9 @@ public LoginInfo signup(SignupRequest request) { @Override public LoginInfo login(LoginRequest request) { Member member = findMember(request.getSocialType(), request.getAuthId()); + Long memberId = member.getId(); + String email = member.getEmail(); String role = "ROLE_DEFAULT"; return createJwtAndGetLoginInfo(memberId, role); @@ -116,4 +126,20 @@ public Member findMember(SocialType socialType, String authId) { return memberRepository.findBySocialTypeAndAuthId(socialType, authId) .orElseThrow(() -> new BusinessException(MEMBER_NOT_FOUND_BY_AUTH_ID_AND_SOCIAL_TYPE)); } + + @Override + public Member deleteMember(Long memberId) { + Member member = findMember(memberId); + List profileListByMemberId = shareGroupService.findProfileListByMemberId(memberId); + for (Profile profile : profileListByMemberId) { + if (profile.getRole().equals(Role.CREATOR)) { + ShareGroup shareGroup = shareGroupService.findShareGroup(profile.getId()); + shareGroupService.deleteShareGroup(profile); + } else { // creator가 아닌 경우 + + } + } + member.delete(); + return member; + } } diff --git a/src/main/java/com/umc/naoman/global/result/code/MemberResultCode.java b/src/main/java/com/umc/naoman/global/result/code/MemberResultCode.java index 3ab97ab..6d9567a 100644 --- a/src/main/java/com/umc/naoman/global/result/code/MemberResultCode.java +++ b/src/main/java/com/umc/naoman/global/result/code/MemberResultCode.java @@ -13,7 +13,8 @@ public enum MemberResultCode implements ResultCode { EDIT_MYPAGE_INFO(200, "SM002", "내 정보를 성공적으로 수정하였습니다."), CHECK_MEMBER_REGISTRATION(200, "SM000", "해당 정보에 대응하는 회원의 가입 여부를 성공적으로 조회하였습니다."), MEMBER_INFO (200,"SM005","회원 정보를 성공적으로 조회하였습니다."), - CHECK_MARKETING_AGREED(200,"SM006","마케팅 동의 여부를 성공적으로 조회하였습니다."), + CHECK_MARKETING_AGREED(200,"SM006","마케팅동의여부를 성공적으로 조회하였습니다."), + DELETE_MEMBER(200,"SM007","성공적으로 탈퇴하였습니다."), GET_MY_MEMBERID(200,"SM000","자신의 memberId를 성공적으로 조회하였습니다."), CHECK_HAS_SAMPLE_PHOTO(200,"SM000","자신의 샘플 사진 업로드 여부를 성공적으로 조회하였습니다."), ; From c9d46bc7f4b36daa7a6aefd2e607efd40e934f13 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 14 Aug 2024 18:24:33 +0900 Subject: [PATCH 03/11] =?UTF-8?q?fix:=20import=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/member/controller/MemberController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/umc/naoman/domain/member/controller/MemberController.java b/src/main/java/com/umc/naoman/domain/member/controller/MemberController.java index b599792..ead8a5b 100644 --- a/src/main/java/com/umc/naoman/domain/member/controller/MemberController.java +++ b/src/main/java/com/umc/naoman/domain/member/controller/MemberController.java @@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.DeleteMapping; import static com.umc.naoman.global.result.code.MemberResultCode.*; From 876202116cde3248c43551c69dd8c3349111f47f Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 14 Aug 2024 19:57:37 +0900 Subject: [PATCH 04/11] =?UTF-8?q?feat:=20=ED=9A=8C=EC=9B=90=20=ED=83=88?= =?UTF-8?q?=ED=87=B4=20api=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/controller/MemberController.java | 13 ++++++----- .../member/converter/MemberConverter.java | 7 +++--- .../domain/member/dto/MemberResponse.java | 2 +- .../domain/member/service/MemberService.java | 2 +- .../member/service/MemberServiceImpl.java | 22 +++++++++---------- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/member/controller/MemberController.java b/src/main/java/com/umc/naoman/domain/member/controller/MemberController.java index ead8a5b..a292427 100644 --- a/src/main/java/com/umc/naoman/domain/member/controller/MemberController.java +++ b/src/main/java/com/umc/naoman/domain/member/controller/MemberController.java @@ -83,14 +83,15 @@ public ResultResponse hasSamplePhoto(@LoginMember Member member) @Operation(summary = "회원 탈퇴 API", description = "[request]\n" + "[response]\n 탈퇴 memberId, 탈퇴 시간") @ApiResponses({ - @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "SM007", description = "회원 탈퇴 성공."), - @io.swagger.v3.oas.annotations.responses.ApiResponse - (responseCode = "EM001", description = "해당 memberId를 가진 회원이 존재하지 않습니다.", + @ApiResponse(responseCode = "SM007", description = "회원 탈퇴 성공."), + @ApiResponse(responseCode = "EM001", description = "해당 memberId를 가진 회원이 존재하지 않습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse(responseCode = "EG008", description = "공유 그룹을 삭제할 권한이 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class))), }) - public ResultResponse deleteMember(@LoginMember Member member){ - return ResultResponse.of(MemberResultCode.DELETE_MEMBER, memberConverter.toDeleteMemberInfo(member)); - + public ResultResponse deleteMember(@LoginMember Member member){ + Member deleteMember = memberService.deleteMember(member); + return ResultResponse.of(MemberResultCode.DELETE_MEMBER, memberConverter.toDeleteMemberInfo(deleteMember)); } } diff --git a/src/main/java/com/umc/naoman/domain/member/converter/MemberConverter.java b/src/main/java/com/umc/naoman/domain/member/converter/MemberConverter.java index 0132bee..c3d6471 100644 --- a/src/main/java/com/umc/naoman/domain/member/converter/MemberConverter.java +++ b/src/main/java/com/umc/naoman/domain/member/converter/MemberConverter.java @@ -7,11 +7,11 @@ import com.umc.naoman.domain.member.dto.MemberResponse.MarketingAgreed; import com.umc.naoman.domain.member.dto.MemberResponse.MemberId; import com.umc.naoman.domain.member.dto.MemberResponse.MemberInfo; +import com.umc.naoman.domain.member.dto.MemberResponse; import com.umc.naoman.domain.member.entity.Member; import com.umc.naoman.domain.member.entity.SocialType; import io.jsonwebtoken.Claims; import org.springframework.stereotype.Component; - @Component public class MemberConverter { public Member toEntity(SignupRequest request) { @@ -46,7 +46,6 @@ public SignupRequest toSignupRequest(Claims payload, boolean marketingAgreed) { public MemberInfo toMemberInfo(Member member) { return MemberInfo.builder() - .memberId(member.getId()) .name(member.getName()) .email(member.getEmail()) .image(member.getImage()) @@ -71,8 +70,8 @@ public MarketingAgreed toMarketingAgreed(Member member) { .build(); } - public MemberResponse.deleteMemberInfo toDeleteMemberInfo(Member member) { - return MemberResponse.deleteMemberInfo.builder() + public MemberResponse.DeleteMemberInfo toDeleteMemberInfo(Member member) { + return MemberResponse.DeleteMemberInfo.builder() .memberId(member.getId()) .deletedAt(member.getDeletedAt()) .build(); diff --git a/src/main/java/com/umc/naoman/domain/member/dto/MemberResponse.java b/src/main/java/com/umc/naoman/domain/member/dto/MemberResponse.java index a9d045b..c32782f 100644 --- a/src/main/java/com/umc/naoman/domain/member/dto/MemberResponse.java +++ b/src/main/java/com/umc/naoman/domain/member/dto/MemberResponse.java @@ -49,7 +49,7 @@ public static class MarketingAgreed { @Builder @Getter @AllArgsConstructor - public static class deleteMemberInfo { + public static class DeleteMemberInfo { private Long memberId; @JsonFormat(pattern = "yyyy-MM-dd") private LocalDateTime deletedAt; diff --git a/src/main/java/com/umc/naoman/domain/member/service/MemberService.java b/src/main/java/com/umc/naoman/domain/member/service/MemberService.java index 5fba3ca..fef068e 100644 --- a/src/main/java/com/umc/naoman/domain/member/service/MemberService.java +++ b/src/main/java/com/umc/naoman/domain/member/service/MemberService.java @@ -21,5 +21,5 @@ public interface MemberService { MemberId getMyMemberId(Member member); Member findMember(Long memberId); Member findMember(SocialType socialType, String authId); - Member deleteMember(Long memberId); + Member deleteMember(Member member); } diff --git a/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java b/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java index 506804f..ed29a12 100644 --- a/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java @@ -4,11 +4,7 @@ import com.umc.naoman.domain.member.dto.MemberRequest.LoginRequest; import com.umc.naoman.domain.member.dto.MemberRequest.MarketingAgreedRequest; import com.umc.naoman.domain.member.dto.MemberRequest.SignupRequest; -import com.umc.naoman.domain.member.dto.MemberResponse.CheckMemberRegistration; -import com.umc.naoman.domain.member.dto.MemberResponse.HasSamplePhoto; -import com.umc.naoman.domain.member.dto.MemberResponse.LoginInfo; -import com.umc.naoman.domain.member.dto.MemberResponse.MemberId; -import com.umc.naoman.domain.member.dto.MemberResponse.MemberInfo; +import com.umc.naoman.domain.member.dto.MemberResponse.*; import com.umc.naoman.domain.member.entity.Member; import com.umc.naoman.domain.member.entity.SocialType; import com.umc.naoman.domain.member.repository.MemberRepository; @@ -16,7 +12,6 @@ import com.umc.naoman.domain.photo.service.PhotoService; import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.Role; -import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.domain.shareGroup.service.ShareGroupService; import com.umc.naoman.global.error.BusinessException; import com.umc.naoman.global.security.util.JwtUtils; @@ -128,17 +123,22 @@ public Member findMember(SocialType socialType, String authId) { } @Override - public Member deleteMember(Long memberId) { - Member member = findMember(memberId); + public Member deleteMember(Member member) { + Long memberId = member.getId(); List profileListByMemberId = shareGroupService.findProfileListByMemberId(memberId); for (Profile profile : profileListByMemberId) { - if (profile.getRole().equals(Role.CREATOR)) { - ShareGroup shareGroup = shareGroupService.findShareGroup(profile.getId()); + Long shareGroupId = profile.getShareGroup().getId(); + if (profile.getRole() == Role.CREATOR) { + // 특정 공유 그룹의 사진을 모두 삭제 + photoService.deletePhotoListByShareGroupId(shareGroupId); shareGroupService.deleteShareGroup(profile); } else { // creator가 아닌 경우 - + photoService.deletePhotoListByFaceTag(memberId); + profile.delete(); } } + // 회원 샘플 사진 삭제 + photoService.deleteSamplePhotoList(member); member.delete(); return member; } From 12b65ff2b9816318a85f489e75dffa46a60424fa Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 14 Aug 2024 20:41:11 +0900 Subject: [PATCH 05/11] =?UTF-8?q?fix:=20=EA=B0=80=EB=8F=85=EC=84=B1?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=9C=20=EC=BD=94=EB=93=9C=20=EC=A0=95?= =?UTF-8?q?=EB=A6=AC=20=EB=B0=8F=20=EB=88=84=EB=9D=BD=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/umc/naoman/domain/member/converter/MemberConverter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/umc/naoman/domain/member/converter/MemberConverter.java b/src/main/java/com/umc/naoman/domain/member/converter/MemberConverter.java index c3d6471..6fe6acc 100644 --- a/src/main/java/com/umc/naoman/domain/member/converter/MemberConverter.java +++ b/src/main/java/com/umc/naoman/domain/member/converter/MemberConverter.java @@ -12,6 +12,7 @@ import com.umc.naoman.domain.member.entity.SocialType; import io.jsonwebtoken.Claims; import org.springframework.stereotype.Component; + @Component public class MemberConverter { public Member toEntity(SignupRequest request) { @@ -46,6 +47,7 @@ public SignupRequest toSignupRequest(Claims payload, boolean marketingAgreed) { public MemberInfo toMemberInfo(Member member) { return MemberInfo.builder() + .memberId(member.getId()) .name(member.getName()) .email(member.getEmail()) .image(member.getImage()) From c6aadb1eb2a3513e9b7393fa00287b79badf3c46 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 14 Aug 2024 20:42:01 +0900 Subject: [PATCH 06/11] =?UTF-8?q?fix:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EC=BD=94=EB=93=9C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/member/service/MemberServiceImpl.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java b/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java index ed29a12..23b43c3 100644 --- a/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java @@ -72,11 +72,8 @@ public LoginInfo signup(SignupRequest request) { @Override public LoginInfo login(LoginRequest request) { Member member = findMember(request.getSocialType(), request.getAuthId()); - Long memberId = member.getId(); - String email = member.getEmail(); String role = "ROLE_DEFAULT"; - return createJwtAndGetLoginInfo(memberId, role); } From cd129dec44867a6a989b861023dc5cd3106dfb29 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 14 Aug 2024 20:42:39 +0900 Subject: [PATCH 07/11] =?UTF-8?q?fix:=20=EA=B0=80=EB=8F=85=EC=84=B1?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=9C=20=EB=B3=80=EC=88=98=EB=AA=85=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/member/service/MemberServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java b/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java index 23b43c3..abd273f 100644 --- a/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java @@ -122,8 +122,8 @@ public Member findMember(SocialType socialType, String authId) { @Override public Member deleteMember(Member member) { Long memberId = member.getId(); - List profileListByMemberId = shareGroupService.findProfileListByMemberId(memberId); - for (Profile profile : profileListByMemberId) { + List profileList = shareGroupService.findProfileListByMemberId(memberId); + for (Profile profile : profileList) { Long shareGroupId = profile.getShareGroup().getId(); if (profile.getRole() == Role.CREATOR) { // 특정 공유 그룹의 사진을 모두 삭제 From 2fd18c6afa68ef68541a63f9b1fd053025041fb8 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 14 Aug 2024 20:44:23 +0900 Subject: [PATCH 08/11] =?UTF-8?q?fix:=20Profile=EB=A1=9C=20=EA=B3=B5?= =?UTF-8?q?=EC=9C=A0=EA=B7=B8=EB=A3=B9=EC=9D=84=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=EB=A9=94=EC=86=8C=EB=93=9C=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/shareGroup/service/ShareGroupService.java | 1 - .../shareGroup/service/ShareGroupServiceImpl.java | 10 ---------- 2 files changed, 11 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupService.java b/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupService.java index fbf6d0a..03938aa 100644 --- a/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupService.java +++ b/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupService.java @@ -14,7 +14,6 @@ public interface ShareGroupService { ShareGroup joinShareGroup(Long shareGroupId, Long profileId, Member member); ShareGroup getInviteInfo(Long shareGroupId, Member member); ShareGroup deleteShareGroup(Long shareGroupId, Member member); - ShareGroup deleteShareGroup(Profile profile); Page getMyShareGroupList(Member member, Pageable pageable); ShareGroup findShareGroup(Long shareGroupId); ShareGroup findShareGroup(String inviteCode); diff --git a/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java b/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java index 7e62079..512fe9c 100644 --- a/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java @@ -134,16 +134,6 @@ public ShareGroup deleteShareGroup(Long shareGroupId, Member member) { return shareGroup; } - @Override - public ShareGroup deleteShareGroup(Profile profile) { - if (!profile.getRole().equals(Role.CREATOR)) { - throw new BusinessException(ShareGroupErrorCode.UNAUTHORIZED_DELETE); - } - ShareGroup shareGroup = profile.getShareGroup(); - shareGroup.delete(); - return shareGroup; - } - @Override public ShareGroup findShareGroup(Long shareGroupId) { return shareGroupRepository.findById(shareGroupId) From a18d33a4ec51b4aee0bb8c064c2f9de271002e33 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 14 Aug 2024 20:47:26 +0900 Subject: [PATCH 09/11] =?UTF-8?q?fix:=20shareGroupService=EB=A5=BC=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=ED=95=98=EC=A7=80=20=EC=95=8A=EA=B3=A0=20mem?= =?UTF-8?q?berService=EC=97=90=EC=84=9C=20shareGroup=EC=9D=84=20delete?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/member/controller/MemberController.java | 2 -- .../umc/naoman/domain/member/service/MemberServiceImpl.java | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/member/controller/MemberController.java b/src/main/java/com/umc/naoman/domain/member/controller/MemberController.java index a292427..9edf3c0 100644 --- a/src/main/java/com/umc/naoman/domain/member/controller/MemberController.java +++ b/src/main/java/com/umc/naoman/domain/member/controller/MemberController.java @@ -86,8 +86,6 @@ public ResultResponse hasSamplePhoto(@LoginMember Member member) @ApiResponse(responseCode = "SM007", description = "회원 탈퇴 성공."), @ApiResponse(responseCode = "EM001", description = "해당 memberId를 가진 회원이 존재하지 않습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), - @ApiResponse(responseCode = "EG008", description = "공유 그룹을 삭제할 권한이 없습니다.", - content = @Content(schema = @Schema(implementation = ErrorResponse.class))), }) public ResultResponse deleteMember(@LoginMember Member member){ Member deleteMember = memberService.deleteMember(member); diff --git a/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java b/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java index abd273f..cd1e18f 100644 --- a/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java @@ -12,6 +12,7 @@ import com.umc.naoman.domain.photo.service.PhotoService; import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.Role; +import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.domain.shareGroup.service.ShareGroupService; import com.umc.naoman.global.error.BusinessException; import com.umc.naoman.global.security.util.JwtUtils; @@ -128,7 +129,8 @@ public Member deleteMember(Member member) { if (profile.getRole() == Role.CREATOR) { // 특정 공유 그룹의 사진을 모두 삭제 photoService.deletePhotoListByShareGroupId(shareGroupId); - shareGroupService.deleteShareGroup(profile); + // 공유 그룹 삭제 + profile.getShareGroup().delete(); } else { // creator가 아닌 경우 photoService.deletePhotoListByFaceTag(memberId); profile.delete(); From 4529a7fdcbafc308f164b3c605b06d3aa17a04b8 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 14 Aug 2024 20:49:55 +0900 Subject: [PATCH 10/11] =?UTF-8?q?fix:=20=EA=B0=80=EB=8F=85=EC=84=B1?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../naoman/global/result/code/MemberResultCode.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/umc/naoman/global/result/code/MemberResultCode.java b/src/main/java/com/umc/naoman/global/result/code/MemberResultCode.java index 6d9567a..9a78fc4 100644 --- a/src/main/java/com/umc/naoman/global/result/code/MemberResultCode.java +++ b/src/main/java/com/umc/naoman/global/result/code/MemberResultCode.java @@ -12,11 +12,11 @@ public enum MemberResultCode implements ResultCode { MYPAGE_INFO(200, "SM001", "내 정보를 성공적으로 조회하였습니다."), EDIT_MYPAGE_INFO(200, "SM002", "내 정보를 성공적으로 수정하였습니다."), CHECK_MEMBER_REGISTRATION(200, "SM000", "해당 정보에 대응하는 회원의 가입 여부를 성공적으로 조회하였습니다."), - MEMBER_INFO (200,"SM005","회원 정보를 성공적으로 조회하였습니다."), - CHECK_MARKETING_AGREED(200,"SM006","마케팅동의여부를 성공적으로 조회하였습니다."), - DELETE_MEMBER(200,"SM007","성공적으로 탈퇴하였습니다."), - GET_MY_MEMBERID(200,"SM000","자신의 memberId를 성공적으로 조회하였습니다."), - CHECK_HAS_SAMPLE_PHOTO(200,"SM000","자신의 샘플 사진 업로드 여부를 성공적으로 조회하였습니다."), + MEMBER_INFO(200, "SM005", "회원 정보를 성공적으로 조회하였습니다."), + CHECK_MARKETING_AGREED(200, "SM006", "마케팅동의여부를 성공적으로 조회하였습니다."), + DELETE_MEMBER(200, "SM007", "성공적으로 탈퇴하였습니다."), + GET_MY_MEMBERID(200, "SM000", "자신의 memberId를 성공적으로 조회하였습니다."), + CHECK_HAS_SAMPLE_PHOTO(200, "SM000", "자신의 샘플 사진 업로드 여부를 성공적으로 조회하였습니다."), ; private final int status; private final String code; From 7bc7c7bcc2454c7dfef8a6e0aacaf5490529f826 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 14 Aug 2024 20:59:08 +0900 Subject: [PATCH 11/11] =?UTF-8?q?fix:=20=EC=99=80=EC=9D=BC=EB=93=9C?= =?UTF-8?q?=EC=B9=B4=EB=93=9C=20=ED=95=B4=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../naoman/domain/member/service/MemberServiceImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java b/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java index cd1e18f..68e1e8b 100644 --- a/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/member/service/MemberServiceImpl.java @@ -4,7 +4,11 @@ import com.umc.naoman.domain.member.dto.MemberRequest.LoginRequest; import com.umc.naoman.domain.member.dto.MemberRequest.MarketingAgreedRequest; import com.umc.naoman.domain.member.dto.MemberRequest.SignupRequest; -import com.umc.naoman.domain.member.dto.MemberResponse.*; +import com.umc.naoman.domain.member.dto.MemberResponse.CheckMemberRegistration; +import com.umc.naoman.domain.member.dto.MemberResponse.HasSamplePhoto; +import com.umc.naoman.domain.member.dto.MemberResponse.LoginInfo; +import com.umc.naoman.domain.member.dto.MemberResponse.MemberId; +import com.umc.naoman.domain.member.dto.MemberResponse.MemberInfo; import com.umc.naoman.domain.member.entity.Member; import com.umc.naoman.domain.member.entity.SocialType; import com.umc.naoman.domain.member.repository.MemberRepository; @@ -12,7 +16,6 @@ import com.umc.naoman.domain.photo.service.PhotoService; import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.Role; -import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.domain.shareGroup.service.ShareGroupService; import com.umc.naoman.global.error.BusinessException; import com.umc.naoman.global.security.util.JwtUtils;