From e2fa17df6ebca3df91bea8b5f4b33e1139a0b76a Mon Sep 17 00:00:00 2001 From: Jeong-In-Hee Date: Wed, 25 Oct 2023 18:35:52 +0900 Subject: [PATCH 1/2] fix: read method and change to is-deleted for unity --- .../org/swmaestro/repl/gifthub/auth/service/AppleService.java | 2 +- .../swmaestro/repl/gifthub/auth/service/GoogleService.java | 4 ++-- .../org/swmaestro/repl/gifthub/auth/service/NaverService.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/swmaestro/repl/gifthub/auth/service/AppleService.java b/src/main/java/org/swmaestro/repl/gifthub/auth/service/AppleService.java index 8c17c070..1965a74f 100644 --- a/src/main/java/org/swmaestro/repl/gifthub/auth/service/AppleService.java +++ b/src/main/java/org/swmaestro/repl/gifthub/auth/service/AppleService.java @@ -121,7 +121,7 @@ public OAuth read(OAuthUserInfoDto oAuthUserInfoDto) { OAuth oAuth = oAuthRepository.findByPlatformAndPlatformIdAndDeletedAtIsNull(OAuthPlatform.APPLE, oAuthUserInfoDto.getId()) .orElseThrow(() -> new BusinessException("존재하지 않는 OAuth 계정입니다.", StatusEnum.NOT_FOUND)); - if (oAuth.getDeletedAt() != null) { + if (oAuth.isDeleted()) { throw new BusinessException("존재하지 않는 OAuth 계정입니다.", StatusEnum.NOT_FOUND); } else { return oAuth; diff --git a/src/main/java/org/swmaestro/repl/gifthub/auth/service/GoogleService.java b/src/main/java/org/swmaestro/repl/gifthub/auth/service/GoogleService.java index 0d834616..801014fe 100644 --- a/src/main/java/org/swmaestro/repl/gifthub/auth/service/GoogleService.java +++ b/src/main/java/org/swmaestro/repl/gifthub/auth/service/GoogleService.java @@ -100,10 +100,10 @@ public OAuth create(User user, OAuthUserInfoDto oAuthUserInfoDto) { @Override public OAuth read(OAuthUserInfoDto oAuthUserInfoDto) { - OAuth oAuth = oAuthRepository.findByPlatformAndPlatformId(OAuthPlatform.GOOGLE, oAuthUserInfoDto.getId()) + OAuth oAuth = oAuthRepository.findByPlatformAndPlatformIdAndDeletedAtIsNull(OAuthPlatform.GOOGLE, oAuthUserInfoDto.getId()) .orElseThrow(() -> new BusinessException("존재하지 않는 OAuth 계정입니다.", StatusEnum.NOT_FOUND)); - if (oAuth.getDeletedAt() != null) { + if (oAuth.isDeleted()) { throw new BusinessException("존재하지 않는 OAuth 계정입니다.", StatusEnum.NOT_FOUND); } else { return oAuth; diff --git a/src/main/java/org/swmaestro/repl/gifthub/auth/service/NaverService.java b/src/main/java/org/swmaestro/repl/gifthub/auth/service/NaverService.java index ee240438..774fc0cc 100644 --- a/src/main/java/org/swmaestro/repl/gifthub/auth/service/NaverService.java +++ b/src/main/java/org/swmaestro/repl/gifthub/auth/service/NaverService.java @@ -106,7 +106,7 @@ public OAuth read(OAuthUserInfoDto oAuthUserInfoDto) { OAuth oAuth = oAuthRepository.findByPlatformAndPlatformIdAndDeletedAtIsNull(OAuthPlatform.NAVER, oAuthUserInfoDto.getId()) .orElseThrow(() -> new BusinessException("존재하지 않는 OAuth 계정입니다.", StatusEnum.NOT_FOUND)); - if (oAuth.getDeletedAt() != null) { + if (oAuth.isDeleted()) { throw new BusinessException("존재하지 않는 OAuth 계정입니다.", StatusEnum.NOT_FOUND); } else { return oAuth; From a8c33fb8feae1cb7a8bd21325123521107f33a82 Mon Sep 17 00:00:00 2001 From: Jeong-In-Hee Date: Wed, 25 Oct 2023 18:36:15 +0900 Subject: [PATCH 2/2] fix: change notification message --- .../repl/gifthub/vouchers/service/VoucherSaveService.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/org/swmaestro/repl/gifthub/vouchers/service/VoucherSaveService.java b/src/main/java/org/swmaestro/repl/gifthub/vouchers/service/VoucherSaveService.java index 4367ec37..991b11a2 100644 --- a/src/main/java/org/swmaestro/repl/gifthub/vouchers/service/VoucherSaveService.java +++ b/src/main/java/org/swmaestro/repl/gifthub/vouchers/service/VoucherSaveService.java @@ -65,16 +65,12 @@ public void execute(OCRDto ocrDto, String username) throws IOException { throwable -> { System.out.println("등록 실패"); throwable.printStackTrace(); - // notification 저장(알림 실패 저장) - notificationService.save(userService.read(username), null, - NotificationType.REGISTERED, - "기프티콘 등록에 실패했습니다."); //Gpt 에러일 경우 if (throwable instanceof GptResponseException) { fcmNotificationService.sendNotification("기프티콘 등록 실패", "자동 등록에 실패했습니다. 수동 등록을 이용해 주세요.", username); notificationService.save(userService.read(username), null, NotificationType.REGISTERED, - "Gpt 응답이 올바르지 않습니다."); + "자동 등록에 실패했습니다. 수동 등록을 이용해 주세요."); } else { fcmNotificationService.sendNotification("기프티콘 등록 실패", "이미 등록된 기프티콘 입니다.", username); notificationService.save(userService.read(username), null,