From f7ab95e959bab6f19f6244c520f3fc3e0c3cbcda Mon Sep 17 00:00:00 2001 From: jun02160 Date: Fri, 21 Jul 2023 22:25:52 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[FIX]=20=EC=98=88=EC=99=B8=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EC=8B=9C=EC=A0=90=20=EB=B3=80=EA=B2=BD=20#77?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ParentchildService.java | 59 ++++++++++--------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/src/main/java/sopt/org/umbbaServer/domain/parentchild/service/ParentchildService.java b/src/main/java/sopt/org/umbbaServer/domain/parentchild/service/ParentchildService.java index b6a9e1d0..b8f49592 100644 --- a/src/main/java/sopt/org/umbbaServer/domain/parentchild/service/ParentchildService.java +++ b/src/main/java/sopt/org/umbbaServer/domain/parentchild/service/ParentchildService.java @@ -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 parentChildUsers = getParentChildUsers(parentchild); + List parentChildUsers = getParentChildUsers(parentchild); - // String을 Enum으로 변경 - List onboardingAnswerList = request.getOnboardingAnswerList().stream() - .map(OnboardingAnswer::of) - .collect(Collectors.toList()); + // String을 Enum으로 변경 + List 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); } From a7fa1a30c2dc1ca2c5743c5ccc4b9021c2160715 Mon Sep 17 00:00:00 2001 From: jun02160 Date: Fri, 21 Jul 2023 22:27:24 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[FIX]=20=EC=98=A8=EB=B3=B4=EB=94=A9=20?= =?UTF-8?q?=EC=98=88=EC=99=B8=EC=B2=98=EB=A6=AC=20=EC=A0=9C=EC=99=B8=20#77?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/parentchild/service/ParentchildService.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/sopt/org/umbbaServer/domain/parentchild/service/ParentchildService.java b/src/main/java/sopt/org/umbbaServer/domain/parentchild/service/ParentchildService.java index b8f49592..65140a58 100644 --- a/src/main/java/sopt/org/umbbaServer/domain/parentchild/service/ParentchildService.java +++ b/src/main/java/sopt/org/umbbaServer/domain/parentchild/service/ParentchildService.java @@ -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(),