Skip to content

Commit

Permalink
Change to read method to handle google sign-in 500 error (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
inh2613 authored Oct 25, 2023
2 parents 44649b5 + a8c33fb commit 3f9f86d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 3f9f86d

Please sign in to comment.