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

[FIX] 급한 에러사항 수정 #78

Merged
merged 2 commits into from
Jul 21, 2023
Merged
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 @@ -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