Skip to content

Commit

Permalink
[FIX] 예외처리 시점 변경 #77
Browse files Browse the repository at this point in the history
  • Loading branch information
jun02160 committed Jul 21, 2023
1 parent 0408e62 commit f7ab95e
Showing 1 changed file with 30 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,45 +93,46 @@ public OnboardingInviteResponseDto onboardInvite(Long userId, OnboardingInviteRe
@Transactional
public OnboardingReceiveResponseDto onboardReceive(Long userId, OnboardingReceiveRequestDto request) throws InterruptedException {

if (getUserById(userId).getParentChild() != null) {

User user = getUserById(userId);
user.updateOnboardingInfo(
request.getUserInfo().getName(),
request.getUserInfo().getGender(),
request.getUserInfo().getBornYear()
);
if (getUserById(userId).getParentChild() == null) {
throw new CustomException(ErrorType.RECEIVE_AFTER_MATCH);
}

Parentchild parentchild = user.getParentChild();
User user = getUserById(userId);
user.updateOnboardingInfo(
request.getUserInfo().getName(),
request.getUserInfo().getGender(),
request.getUserInfo().getBornYear()
);

Parentchild parentchild = user.getParentChild();
// parentchild.updateInfo(); TODO 온보딩 송수신 측의 관계 정보가 불일치한 경우에 대한 처리
List<User> parentChildUsers = getParentChildUsers(parentchild);
List<User> parentChildUsers = getParentChildUsers(parentchild);

// String을 Enum으로 변경
List<OnboardingAnswer> onboardingAnswerList = request.getOnboardingAnswerList().stream()
.map(OnboardingAnswer::of)
.collect(Collectors.toList());
// String을 Enum으로 변경
List<OnboardingAnswer> onboardingAnswerList = request.getOnboardingAnswerList().stream()
.map(OnboardingAnswer::of)
.collect(Collectors.toList());

if (onboardingAnswerList.size() != 5) {
throw new CustomException(ErrorType.INVALID_ONBOARDING_ANSWER_SIZE);
}
if (onboardingAnswerList.size() != 5) {
throw new CustomException(ErrorType.INVALID_ONBOARDING_ANSWER_SIZE);
}

if (getUserById(userId).isMeChild()) {
parentchild.changeChildOnboardingAnswerList(onboardingAnswerList);
} else {
parentchild.changeParentOnboardingAnswerList(onboardingAnswerList);
}
if (getUserById(userId).isMeChild()) {
parentchild.changeChildOnboardingAnswerList(onboardingAnswerList);
} else {
parentchild.changeParentOnboardingAnswerList(onboardingAnswerList);
}

/*if (!ParentchildRelation.validate(parentChildUsers, parentchild.getRelation())) {
throw new CustomException(ErrorType.INVALID_PARENT_CHILD_RELATION);
}*/
ScheduleConfig.resetScheduler();
fcmScheduler.pushTodayQna();
/*if (!ParentchildRelation.validate(parentChildUsers, parentchild.getRelation())) {
throw new CustomException(ErrorType.INVALID_PARENT_CHILD_RELATION);
}*/
ScheduleConfig.resetScheduler();
fcmScheduler.pushTodayQna();


return OnboardingReceiveResponseDto.of(parentchild, user, parentChildUsers);
}
return OnboardingReceiveResponseDto.of(parentchild, user, parentChildUsers);

throw new CustomException(ErrorType.RECEIVE_AFTER_MATCH);
}


Expand Down

0 comments on commit f7ab95e

Please sign in to comment.