From be6799b8e960619a6ec2c36febf54645ce2c317b Mon Sep 17 00:00:00 2001 From: chjcoder Date: Sun, 6 Oct 2024 12:26:14 +0900 Subject: [PATCH 1/6] =?UTF-8?q?feat(withdrawnMember)=20:=20=ED=9A=8C?= =?UTF-8?q?=EC=9B=90=ED=83=88=ED=87=B4=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/entity/WithdrawnMember.java | 30 +++++ .../member/entity/WithdrawnMemberDAO.java | 7 ++ .../service/WithdrawnMemberService.java | 109 ++++++++++++++++++ .../global/util/hash/EmailHasher.java | 31 +++++ 4 files changed, 177 insertions(+) create mode 100644 src/main/java/chzzk/grassdiary/domain/member/entity/WithdrawnMember.java create mode 100644 src/main/java/chzzk/grassdiary/domain/member/entity/WithdrawnMemberDAO.java create mode 100644 src/main/java/chzzk/grassdiary/domain/member/service/WithdrawnMemberService.java create mode 100644 src/main/java/chzzk/grassdiary/global/util/hash/EmailHasher.java diff --git a/src/main/java/chzzk/grassdiary/domain/member/entity/WithdrawnMember.java b/src/main/java/chzzk/grassdiary/domain/member/entity/WithdrawnMember.java new file mode 100644 index 00000000..d1493ca1 --- /dev/null +++ b/src/main/java/chzzk/grassdiary/domain/member/entity/WithdrawnMember.java @@ -0,0 +1,30 @@ +package chzzk.grassdiary.domain.member.entity; + +import chzzk.grassdiary.domain.base.BaseTimeEntity; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import lombok.AccessLevel; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class WithdrawnMember extends BaseTimeEntity { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "withdrawn_member_id") + private Long id; + + @Column(name = "hashed_email", nullable = false, unique = true) + private String hashedEmail; + + @Builder + public WithdrawnMember(String hashedEmail) { + this.hashedEmail = hashedEmail; + } +} diff --git a/src/main/java/chzzk/grassdiary/domain/member/entity/WithdrawnMemberDAO.java b/src/main/java/chzzk/grassdiary/domain/member/entity/WithdrawnMemberDAO.java new file mode 100644 index 00000000..ff87b743 --- /dev/null +++ b/src/main/java/chzzk/grassdiary/domain/member/entity/WithdrawnMemberDAO.java @@ -0,0 +1,7 @@ +package chzzk.grassdiary.domain.member.entity; + +import org.springframework.data.jpa.repository.JpaRepository; + +public interface WithdrawnMemberDAO extends JpaRepository { + boolean existsByHashedEmail(String hashedEmail); +} \ No newline at end of file diff --git a/src/main/java/chzzk/grassdiary/domain/member/service/WithdrawnMemberService.java b/src/main/java/chzzk/grassdiary/domain/member/service/WithdrawnMemberService.java new file mode 100644 index 00000000..690fd8e2 --- /dev/null +++ b/src/main/java/chzzk/grassdiary/domain/member/service/WithdrawnMemberService.java @@ -0,0 +1,109 @@ +package chzzk.grassdiary.domain.member.service; + +import chzzk.grassdiary.domain.comment.entity.Comment; +import chzzk.grassdiary.domain.comment.entity.CommentDAO; +import chzzk.grassdiary.domain.comment.service.CommentService; +import chzzk.grassdiary.domain.diary.entity.Diary; +import chzzk.grassdiary.domain.diary.entity.DiaryDAO; +import chzzk.grassdiary.domain.diary.service.DiaryService; +import chzzk.grassdiary.domain.member.entity.Member; +import chzzk.grassdiary.domain.member.entity.MemberDAO; +import chzzk.grassdiary.domain.member.entity.WithdrawnMember; +import chzzk.grassdiary.domain.member.entity.WithdrawnMemberDAO; +import chzzk.grassdiary.domain.reward.service.RewardService; +import chzzk.grassdiary.global.common.error.exception.SystemException; +import chzzk.grassdiary.global.common.response.ClientErrorCode; +import chzzk.grassdiary.global.common.response.ServerErrorCode; +import chzzk.grassdiary.global.util.hash.EmailHasher; +import java.util.Base64; +import java.util.List; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@RequiredArgsConstructor +public class WithdrawnMemberService { + private final MemberDAO memberDAO; + private final DiaryDAO diaryDAO; + private final CommentDAO commentDAO; + private final WithdrawnMemberDAO withdrawnMemberDAO; + private final DiaryService diaryService; + private final CommentService commentService; + private final RewardService rewardService; + private final EmailHasher emailHasher; + + @Transactional + public void withdrawMember(Long logInMemberId) { + Member member = findMember(logInMemberId); + + deleteDiaries(logInMemberId); + + deleteComments(logInMemberId); + + deleteRewards(logInMemberId); + + //구입한 잔디 색깔 이력 삭제 + + //email 해싱 + String hashedEmail = hashEmail(member.getEmail()); + + // 해싱된 이메일을 WithdrawnMember에 저장 + saveWithdrawnMember(hashedEmail); + + // member의 값들 식별불가하게 변경 + member.withdrawMember(); + memberDAO.save(member); + } + + @Transactional + public void checkWithdrawnMember(String email) { + String hashedEmail = hashEmail(email); + if (withdrawnMemberDAO.existsByHashedEmail(hashedEmail)) { + throw new SystemException(ClientErrorCode.ALREADY_WITHDRAWN_MEMBER_ERR); + } + } + + private Member findMember(Long memberId) { + return memberDAO.findById(memberId) + .orElseThrow(() -> new SystemException(ClientErrorCode.MEMBER_NOT_FOUND_ERR)); + } + + private void deleteDiaries(long memberId) { + List diaries = diaryDAO.findAllByMemberId(memberId); + + for (Diary diary : diaries) { + diaryService.delete(diary.getId(), memberId); + } + } + + private void deleteComments(long memberId) { + List comments = commentDAO.findAllByMemberId(memberId); + + for (Comment comment : comments) { + commentService.delete(comment.getId(), memberId); + } + } + + private void deleteRewards(long memberId) { + rewardService.deleteAllRewardHistory(memberId); + } + + // 이메일 해싱 메서드 + private String hashEmail(String email) { + try { + return emailHasher.hashEmail(email); // 이메일 해싱 + } catch (Exception e) { + throw new SystemException(ServerErrorCode.HASHING_FAILED, e); + } + } + + // WithdrawnMember 저장 메서드 + private void saveWithdrawnMember(String hashedEmail) { + WithdrawnMember withdrawnMember = WithdrawnMember.builder() + .hashedEmail(hashedEmail) + .build(); + + withdrawnMemberDAO.save(withdrawnMember); // WithdrawnMember 엔티티 저장 + } +} diff --git a/src/main/java/chzzk/grassdiary/global/util/hash/EmailHasher.java b/src/main/java/chzzk/grassdiary/global/util/hash/EmailHasher.java new file mode 100644 index 00000000..84fd476a --- /dev/null +++ b/src/main/java/chzzk/grassdiary/global/util/hash/EmailHasher.java @@ -0,0 +1,31 @@ +package chzzk.grassdiary.global.util.hash; + +import java.nio.charset.StandardCharsets; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.security.spec.InvalidKeySpecException; +import java.util.Base64; +import javax.crypto.Mac; +import javax.crypto.SecretKeyFactory; +import javax.crypto.spec.PBEKeySpec; +import javax.crypto.spec.SecretKeySpec; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +@Component +public class EmailHasher { + + private static final String HMAC_ALGORITHM = "HmacSHA256"; + + @Value("${HASH_SECRET_KEY}") + private String secretKey; + + public String hashEmail(String email) throws Exception { + SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey.getBytes(StandardCharsets.UTF_8), HMAC_ALGORITHM); + Mac mac = Mac.getInstance(HMAC_ALGORITHM); + mac.init(secretKeySpec); + byte[] hmac = mac.doFinal(email.getBytes(StandardCharsets.UTF_8)); + return Base64.getEncoder().encodeToString(hmac); + } + +} \ No newline at end of file From 1896c12ede1514fb5d4da90315f7bdbe8d97bc10 Mon Sep 17 00:00:00 2001 From: chjcoder Date: Sun, 6 Oct 2024 12:26:58 +0900 Subject: [PATCH 2/6] =?UTF-8?q?feat(withdrawnMember)=20:=20memeberId?= =?UTF-8?q?=EB=A1=9C=20=EB=8C=93=EA=B8=80=20=EB=B6=88=EB=9F=AC=EC=98=A4?= =?UTF-8?q?=EB=8A=94=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/chzzk/grassdiary/domain/comment/entity/CommentDAO.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/chzzk/grassdiary/domain/comment/entity/CommentDAO.java b/src/main/java/chzzk/grassdiary/domain/comment/entity/CommentDAO.java index 0f56bff4..e77f4a88 100644 --- a/src/main/java/chzzk/grassdiary/domain/comment/entity/CommentDAO.java +++ b/src/main/java/chzzk/grassdiary/domain/comment/entity/CommentDAO.java @@ -8,4 +8,6 @@ public interface CommentDAO extends JpaRepository { @Query("select c from Comment c join fetch c.member left join fetch c.parentComment where c.diary.id = :diaryId order by c.parentComment.id asc nulls first, c.id asc") List findAllByDiaryId(Long diaryId, Pageable pageable); + + List findAllByMemberId(Long memberId); } From 2e2820e1415c0f9a59ca7ff3bba04d666ccedd3a Mon Sep 17 00:00:00 2001 From: chjcoder Date: Sun, 6 Oct 2024 12:28:42 +0900 Subject: [PATCH 3/6] =?UTF-8?q?feat(withdrawnMember)=20:=20=ED=83=88?= =?UTF-8?q?=ED=87=B4=ED=95=9C=20=ED=9A=8C=EC=9B=90=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/controller/MemberController.java | 12 ++++++++++++ .../grassdiary/domain/member/entity/Member.java | 8 ++++++++ .../domain/member/service/MemberService.java | 5 +++++ 3 files changed, 25 insertions(+) diff --git a/src/main/java/chzzk/grassdiary/domain/member/controller/MemberController.java b/src/main/java/chzzk/grassdiary/domain/member/controller/MemberController.java index 8cb13cf4..94a8dc5a 100644 --- a/src/main/java/chzzk/grassdiary/domain/member/controller/MemberController.java +++ b/src/main/java/chzzk/grassdiary/domain/member/controller/MemberController.java @@ -3,7 +3,10 @@ import chzzk.grassdiary.domain.member.service.MyPageService; import chzzk.grassdiary.domain.member.dto.MemberInfoDTO; import chzzk.grassdiary.domain.member.dto.TotalRewardDTO; +import chzzk.grassdiary.domain.member.service.WithdrawnMemberService; import chzzk.grassdiary.domain.reward.service.RewardService; +import chzzk.grassdiary.global.auth.common.AuthenticatedMember; +import chzzk.grassdiary.global.auth.service.dto.AuthMemberPayload; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; @@ -12,6 +15,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @@ -24,6 +28,7 @@ public class MemberController { private final MyPageService myPageService; private final RewardService rewardService; + private final WithdrawnMemberService withdrawnMemberService; @GetMapping("profile/{memberId}") @Operation( @@ -44,4 +49,11 @@ public ResponseEntity getProfileInfo(@PathVariable Long memberId) { public ResponseEntity getTotalReward(@PathVariable Long memberId) { return ResponseEntity.ok(rewardService.findTotalRewardById(memberId)); } + + @DeleteMapping("/withdraw") + public ResponseEntity withdrawMember(@AuthenticatedMember AuthMemberPayload payload) { + withdrawnMemberService.withdrawMember(payload.id()); + return ResponseEntity.ok("탈퇴가 완료되었습니다."); + } + } diff --git a/src/main/java/chzzk/grassdiary/domain/member/entity/Member.java b/src/main/java/chzzk/grassdiary/domain/member/entity/Member.java index ff04f426..35deb843 100644 --- a/src/main/java/chzzk/grassdiary/domain/member/entity/Member.java +++ b/src/main/java/chzzk/grassdiary/domain/member/entity/Member.java @@ -93,4 +93,12 @@ private boolean isAvailable(String text) { public void addRandomPoint(Integer randomPoint) { this.rewardPoint += randomPoint; } + + public void withdrawMember() { + this.rewardPoint = 0; + this.nickname = "탈퇴한 회원"; + this.email = "withdrawnMember"; + this.profileIntro = null; + this.picture = null; + } } diff --git a/src/main/java/chzzk/grassdiary/domain/member/service/MemberService.java b/src/main/java/chzzk/grassdiary/domain/member/service/MemberService.java index 7a3748f1..569f7915 100644 --- a/src/main/java/chzzk/grassdiary/domain/member/service/MemberService.java +++ b/src/main/java/chzzk/grassdiary/domain/member/service/MemberService.java @@ -1,10 +1,15 @@ package chzzk.grassdiary.domain.member.service; +import chzzk.grassdiary.domain.diary.entity.Diary; +import chzzk.grassdiary.domain.diary.entity.DiaryDAO; import chzzk.grassdiary.global.auth.service.dto.GoogleUserInfo; import chzzk.grassdiary.domain.color.ColorCode; import chzzk.grassdiary.domain.color.ColorCodeDAO; import chzzk.grassdiary.domain.member.entity.Member; import chzzk.grassdiary.domain.member.entity.MemberDAO; +import chzzk.grassdiary.global.common.error.exception.SystemException; +import chzzk.grassdiary.global.common.response.ClientErrorCode; +import java.util.List; import java.util.Optional; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; From 050f50ecdda9bd754e1bdc9e5a0011b25bf8c41d Mon Sep 17 00:00:00 2001 From: chjcoder Date: Sun, 6 Oct 2024 12:29:58 +0900 Subject: [PATCH 4/6] =?UTF-8?q?feat(withdrawnMember)=20:=20rewardHistory?= =?UTF-8?q?=20=EC=82=AD=EC=A0=9C=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../grassdiary/domain/reward/RewardHistoryDAO.java | 8 ++++++++ .../domain/reward/controller/RewardController.java | 6 ++++++ .../domain/reward/service/RewardService.java | 11 +++++++++++ 3 files changed, 25 insertions(+) diff --git a/src/main/java/chzzk/grassdiary/domain/reward/RewardHistoryDAO.java b/src/main/java/chzzk/grassdiary/domain/reward/RewardHistoryDAO.java index d88039c0..10ade07a 100644 --- a/src/main/java/chzzk/grassdiary/domain/reward/RewardHistoryDAO.java +++ b/src/main/java/chzzk/grassdiary/domain/reward/RewardHistoryDAO.java @@ -3,7 +3,15 @@ import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.transaction.annotation.Transactional; public interface RewardHistoryDAO extends JpaRepository { List findByMemberId(Long memberId); + + @Modifying + @Transactional + @Query("DELETE FROM RewardHistory r WHERE r.member.id = :memberId") + void deleteAllByMemberId(Long memberId); } diff --git a/src/main/java/chzzk/grassdiary/domain/reward/controller/RewardController.java b/src/main/java/chzzk/grassdiary/domain/reward/controller/RewardController.java index 4f1b10dc..36dac521 100644 --- a/src/main/java/chzzk/grassdiary/domain/reward/controller/RewardController.java +++ b/src/main/java/chzzk/grassdiary/domain/reward/controller/RewardController.java @@ -29,4 +29,10 @@ public class RewardController { public ResponseEntity getRewardHistory(@PathVariable Long memberId) { return ResponseEntity.ok(rewardService.getRewardHistory(memberId)); } + + @ApiResponse(responseCode = "200", description = "성공", content = @Content(schema = @Schema(implementation = String.class))) + public ResponseEntity deleteAllRewardsForMember(@PathVariable Long memberId) { + rewardService.deleteAllRewardHistory(memberId); + return ResponseEntity.ok("All reward history deleted for member " + memberId); + } } diff --git a/src/main/java/chzzk/grassdiary/domain/reward/service/RewardService.java b/src/main/java/chzzk/grassdiary/domain/reward/service/RewardService.java index c8f5a760..2fa64a38 100644 --- a/src/main/java/chzzk/grassdiary/domain/reward/service/RewardService.java +++ b/src/main/java/chzzk/grassdiary/domain/reward/service/RewardService.java @@ -41,7 +41,18 @@ public List getRewardHistory(Long memberId) { )).toList(); } + public void deleteAllRewardHistory(long memberId) { + validateMemberExists(memberId); + + rewardHistoryDAO.deleteAllByMemberId(memberId); + } + private String makeHistoryStamp(LocalDateTime createdAt) { return createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); } + + private void validateMemberExists(Long memberId) { + memberDAO.findById(memberId) + .orElseThrow(() -> new SystemException(ClientErrorCode.MEMBER_NOT_FOUND_ERR)); + } } From ad5e727c5ed6b5e8a08b56ee7f6396916a7297e2 Mon Sep 17 00:00:00 2001 From: chjcoder Date: Sun, 6 Oct 2024 12:30:52 +0900 Subject: [PATCH 5/6] =?UTF-8?q?feat(withdrawnMember)=20:=20=ED=83=88?= =?UTF-8?q?=ED=87=B4=ED=95=9C=20=ED=9A=8C=EC=9B=90=20=EC=9E=AC=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20=EB=A7=89=EB=8A=94=20=EB=A1=9C=EC=A7=81=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chzzk/grassdiary/global/auth/service/OAuthService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/chzzk/grassdiary/global/auth/service/OAuthService.java b/src/main/java/chzzk/grassdiary/global/auth/service/OAuthService.java index a9c2f56d..5f28bf93 100644 --- a/src/main/java/chzzk/grassdiary/global/auth/service/OAuthService.java +++ b/src/main/java/chzzk/grassdiary/global/auth/service/OAuthService.java @@ -1,5 +1,7 @@ package chzzk.grassdiary.global.auth.service; +import chzzk.grassdiary.domain.member.entity.WithdrawnMemberDAO; +import chzzk.grassdiary.domain.member.service.WithdrawnMemberService; import chzzk.grassdiary.global.auth.client.GoogleOAuthClient; import chzzk.grassdiary.global.auth.jwt.JwtTokenProvider; import chzzk.grassdiary.global.auth.service.dto.AuthMemberPayload; @@ -23,6 +25,7 @@ public class OAuthService { private final GoogleOAuthClient googleOAuthClient; private final JwtTokenProvider jwtTokenProvider; private final MemberService memberService; + private final WithdrawnMemberService withdrawnMemberService; public String findRedirectUri() { return googleOAuthUriGenerator.generateUrl(); @@ -33,6 +36,8 @@ public JWTTokenResponse loginGoogle(String code) { GoogleUserInfo googleUserInfo = googleOAuthClient.getGoogleUserInfo(googleAccessToken.accessToken()); + withdrawnMemberService.checkWithdrawnMember(googleUserInfo.email()); + Member member = memberService.createMemberIfNotExist(googleUserInfo); String accessToken = jwtTokenProvider.generateAccessToken(AuthMemberPayload.from(member)); From fb0fc84487f7ec2834380169284c827d1ba8e61c Mon Sep 17 00:00:00 2001 From: chjcoder Date: Sun, 6 Oct 2024 12:31:14 +0900 Subject: [PATCH 6/6] =?UTF-8?q?feat(withdrawnMember)=20:=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../grassdiary/global/common/response/ClientErrorCode.java | 2 +- .../grassdiary/global/common/response/ServerErrorCode.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/chzzk/grassdiary/global/common/response/ClientErrorCode.java b/src/main/java/chzzk/grassdiary/global/common/response/ClientErrorCode.java index 93b4bfdb..e6106d01 100644 --- a/src/main/java/chzzk/grassdiary/global/common/response/ClientErrorCode.java +++ b/src/main/java/chzzk/grassdiary/global/common/response/ClientErrorCode.java @@ -11,6 +11,7 @@ public enum ClientErrorCode implements ErrorCodeModel { AUTH_TOKEN_EXTRACTION_FAILED(401, "AUTH_TOKEN_EXTRACTION_FAILED", "액세스 토큰 추출에 실패했습니다."), AUTH_SESSION_EXPIRED(440, "AUTH_SESSION_EXPIRED", "세션이 만료되었습니다. 다시 로그인 해주세요."), + ALREADY_WITHDRAWN_MEMBER_ERR(409, "ALREADY_WITHDRAWN_MEMBER_ERR","이전에 탈퇴한 회원은 재가입할 수 없습니다."), MEMBER_NOT_FOUND_ERR(404, "MEMBER_NOT_FOUND_ERR", "요청하신 사용자를 찾을 수 없습니다."), PAST_DIARY_MODIFICATION_NOT_ALLOWED(409, "PAST_DIARY_MODIFICATION_NOT_ALLOWED", "과거의 일기는 수정할 수 없습니다."), DIARY_NOT_FOUND_ERR(404, "DIARY_NOT_FOUND_ERR", "요청하신 다이어리를 찾을 수 없습니다."), @@ -25,7 +26,6 @@ public enum ClientErrorCode implements ErrorCodeModel { AUTHOR_MISMATCH_ERR(403, "AUTHOR_MISMATCH_ERR", "작성자가 아닙니다."), COMMENT_ALREADY_DELETED_ERR(400, "COMMENT_ALREADY_DELETED_ERR", "이미 삭제된 댓글입니다."), COMMENT_DEPTH_EXCEEDED_ERR(400, "COMMENT_DEPTH_EXCEEDED_ERR", "댓글은 대댓글까지만 허용합니다."), - VALIDATION_ERR(400, "VALIDATION_ERR", "잘못된 입력입니다. 올바른 값을 입력해주세요."), PERMISSION_ERR(403, "PERMISSION_ERR", "접근 권한이 없습니다. 관리자에게 문의하세요."), TIMEOUT_ERR(408, "TIMEOUT_ERR", "요청 시간이 초과되었습니다. 다시 시도해주세요."), diff --git a/src/main/java/chzzk/grassdiary/global/common/response/ServerErrorCode.java b/src/main/java/chzzk/grassdiary/global/common/response/ServerErrorCode.java index c2a7e26d..9f31b684 100644 --- a/src/main/java/chzzk/grassdiary/global/common/response/ServerErrorCode.java +++ b/src/main/java/chzzk/grassdiary/global/common/response/ServerErrorCode.java @@ -8,6 +8,9 @@ public enum ServerErrorCode implements ErrorCodeModel { NOT_IMPLEMENTED(501, "NOT_IMPLEMENTED", "현재 지원되지 않는 기능입니다."), SERVICE_UNAVAILABLE(503, "SERVICE_UNAVAILABLE", "현재 서비스가 사용 불가합니다. 나중에 다시 시도해주세요."), IMAGE_UPLOAD_FAILED(500, "IMAGE_UPLOAD_FAILED", "이미지 업로드에 실패했습니다."), + HASHING_FAILED(500,"HASHING_FAILED", "해싱에 실패했습니다."), + GENERATING_SALT_FAILED(500, "GENERATING_SALT_FAILED", "salt 생성에 실패했습니다."), + REWARD_HISTORY_SAVE_FAILED(500, "REWARD_HISTORY_SAVE_FAILED", "일기 히스토리 저장에 실패했습니다."); private final int statusCode;