Skip to content

Commit

Permalink
[REFACTOR] import 경로 변경 문제 해결 #82
Browse files Browse the repository at this point in the history
  • Loading branch information
ddongseop committed Aug 8, 2023
1 parent 4fbe1f9 commit 5ad7fef
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import sopt.org.umbba.api.controller.parentchild.dto.request.InviteCodeRequestDto;
import sopt.org.umbba.api.controller.parentchild.dto.request.OnboardingInviteRequestDto;
import sopt.org.umbba.api.controller.parentchild.dto.request.OnboardingReceiveRequestDto;
import sopt.org.umbba.api.controller.parentchild.dto.response.InviteResultResponseDto;
import sopt.org.umbba.api.controller.parentchild.dto.response.OnboardingInviteResponseDto;
import sopt.org.umbba.api.controller.parentchild.dto.response.OnboardingReceiveResponseDto;
import sopt.org.umbba.common.exception.ErrorType;
Expand All @@ -19,6 +21,7 @@
import sopt.org.umbba.domain.domain.user.User;
import sopt.org.umbba.domain.domain.user.repository.UserRepository;

import javax.validation.Valid;
import java.util.List;
import java.util.stream.Collectors;

Expand All @@ -31,8 +34,7 @@ public class ParentchildService {
private final ParentchildRepository parentchildRepository;
private final UserRepository userRepository;
private final ParentchildDao parentchildDao;
private final FCMScheduler fcmScheduler;
private final FCMService fcmService;
// private final FCMScheduler fcmScheduler; TODO ⭐️SQS로 변경

// [발신] 초대하는 측의 온보딩 정보 입력
@Transactional
Expand Down Expand Up @@ -118,9 +120,9 @@ public OnboardingReceiveResponseDto onboardReceive(Long userId, OnboardingReceiv
/*if (!ParentchildRelation.validate(parentChildUsers, parentchild.getRelation())) {
throw new CustomException(ErrorType.INVALID_PARENT_CHILD_RELATION);
}*/
ScheduleConfig.resetScheduler();
fcmScheduler.pushTodayQna();

// TODO ⭐️SQS로 변경
// ScheduleConfig.resetScheduler();
// fcmScheduler.pushTodayQna();

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

Expand All @@ -135,7 +137,7 @@ private String generateInviteCode() {

// 초대코드 확인 후 부모자식 관계 성립
@Transactional
public InviteResultResponseDto matchRelation(Long userId, InviteCodeRequestDto request) {
public InviteResultResponseDto matchRelation(Long userId, @Valid InviteCodeRequestDto request) {

log.info("ParentchlidService 실행 - 요청 초대코드: {}", request.getInviteCode());
Parentchild newMatchRelation = parentchildRepository.findByInviteCode(request.getInviteCode()).orElseThrow(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class QnAService {
private final QuestionRepository questionRepository;
private final UserRepository userRepository;
private final ParentchildDao parentchildDao;
private final FCMService fcmService; //TODO Service에서 Service를 주입받는 부분 수정
// private final FCMService fcmService; //TODO ⭐️SQS로 변경

public TodayQnAResponseDto getTodayQnA(Long userId) {

Expand Down Expand Up @@ -82,10 +82,12 @@ public void answerTodayQuestion(Long userId, TodayAnswerRequestDto request) {

if (myUser.isMeChild()) {
todayQnA.saveChildAnswer(request.getAnswer());
fcmService.pushOpponentReply(todayQnA.getQuestion().getParentQuestion(), opponentUser.getId());
//TODO ⭐️SQS로 변경
// fcmService.pushOpponentReply(todayQnA.getQuestion().getParentQuestion(), opponentUser.getId());
} else {
todayQnA.saveParentAnswer(request.getAnswer());
fcmService.pushOpponentReply(todayQnA.getQuestion().getChildQuestion(), opponentUser.getId());
//TODO ⭐️SQS로 변경
// fcmService.pushOpponentReply(todayQnA.getQuestion().getChildQuestion(), opponentUser.getId());
}
}

Expand Down Expand Up @@ -237,7 +239,7 @@ private User getOpponentByParentchild(Parentchild parentchild, Long userId) {
}

@Transactional
private void customQuestion(List<OnboardingAnswer> childList, List<OnboardingAnswer> parentList, List<QnA> qnAList) {
public void customQuestion(List<OnboardingAnswer> childList, List<OnboardingAnswer> parentList, List<QnA> qnAList) {

// Type 1 : 1번째 선택 질문인 거주 현황에 대해 한명이라도 아니/애매해라고 답한 경우
if (childList.get(0) != YES || parentList.get(0) !=YES) {
Expand Down Expand Up @@ -344,9 +346,10 @@ public void updateDemoList(Long userId) {
}
QnA fifthQnA = getTodayQnAByParentchild(parentchild);
log.info("💖💖💖💖Day 5 QnA: {}", fifthQnA.getId());
fcmService.multipleSendByToken(FCMPushRequestDto.sendTodayQna(
fifthQnA.getQuestion().getSection().getValue(),
fifthQnA.getQuestion().getTopic()), parentchild.getId());
//TODO ⭐️SQS로 변경
// fcmService.multipleSendByToken(FCMPushRequestDto.sendTodayQna(
// fifthQnA.getQuestion().getSection().getValue(),
// fifthQnA.getQuestion().getTopic()), parentchild.getId());

}

Expand All @@ -361,9 +364,10 @@ public void todayUpdate(Long userId) {
"오구 내 똥강아지~ 어렸을 때는 매일 볼 수 있었는데, 어른이 되고 나서 자주 못봐서 너무 아쉽다... 연락 잘하거라 요녀석~");

QnA todayQnA = getTodayQnAByParentchild(parentchild);
fcmService.multipleSendByToken(FCMPushRequestDto.sendTodayQna(
todayQnA.getQuestion().getSection().getValue(),
todayQnA.getQuestion().getTopic()), parentchild.getId());
//TODO ⭐️SQS로 변경
// fcmService.multipleSendByToken(FCMPushRequestDto.sendTodayQna(
// todayQnA.getQuestion().getSection().getValue(),
// todayQnA.getQuestion().getTopic()), parentchild.getId());
}

private void updateDay(Parentchild parentchild, String childAnswer, String parentAnswer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.*;
import lombok.extern.slf4j.Slf4j;
import sopt.org.umbba.domain.domain.common.AuditingTimeEntity;
import sopt.org.umbba.domain.domain.qna.OnboardingAnswer;
import sopt.org.umbba.domain.domain.qna.QnA;

import javax.persistence.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
import sopt.org.umbba.domain.parentchild.model.Parentchild;
import sopt.org.umbba.domain.user.model.User;
import sopt.org.umbba.domain.domain.parentchild.Parentchild;
import sopt.org.umbba.domain.domain.user.User;

import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
Expand Down

0 comments on commit 5ad7fef

Please sign in to comment.