Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to read method to handle google sign-in 500 error #144

Merged
merged 2 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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