Skip to content

Commit

Permalink
Merge pull request #78 from Team-Umbba/fix/#77-exception_hotfix
Browse files Browse the repository at this point in the history
[FIX] 급한 에러사항 수정
  • Loading branch information
jun02160 authored Jul 21, 2023
2 parents 0408e62 + a7fa1a3 commit 16ddfe6
Showing 1 changed file with 30 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ public class ParentchildService {
public OnboardingInviteResponseDto onboardInvite(Long userId, OnboardingInviteRequestDto request) {

User user = getUserById(userId);
if (user.getParentChild() != null) {
throw new CustomException(ErrorType.ALREADY_EXISTS_PARENT_CHILD_USER);
}

user.updateOnboardingInfo(
request.getUserInfo().getName(),
request.getUserInfo().getGender(),
Expand Down Expand Up @@ -93,45 +89,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 16ddfe6

Please sign in to comment.