diff --git a/.gitignore b/.gitignore index c092fd2f..9b324236 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ motivoo-firebase-adminsdk.json **.http **.sql +logback-**.xml local.properties diff --git a/motivoo-domain/src/main/java/sopt/org/motivoo/domain/mission/entity/UserMission.java b/motivoo-domain/src/main/java/sopt/org/motivoo/domain/mission/entity/UserMission.java index 399f5049..67d7b2bb 100644 --- a/motivoo-domain/src/main/java/sopt/org/motivoo/domain/mission/entity/UserMission.java +++ b/motivoo-domain/src/main/java/sopt/org/motivoo/domain/mission/entity/UserMission.java @@ -120,6 +120,10 @@ public void updateMissionFromEmpty(final Mission mission) { this.updateCompletedStatus(IN_PROGRESS); } + public void updateMissionQuest(MissionQuest missionQuest) { + this.missionQuest = missionQuest; + } + public boolean isEmptyUserMission() { return this.getMission().getTarget().equals(UserType.NONE); } diff --git a/motivoo-domain/src/main/java/sopt/org/motivoo/domain/mission/repository/UserMissionRepository.java b/motivoo-domain/src/main/java/sopt/org/motivoo/domain/mission/repository/UserMissionRepository.java index fe5f5ddc..0860b9b2 100644 --- a/motivoo-domain/src/main/java/sopt/org/motivoo/domain/mission/repository/UserMissionRepository.java +++ b/motivoo-domain/src/main/java/sopt/org/motivoo/domain/mission/repository/UserMissionRepository.java @@ -39,7 +39,7 @@ public interface UserMissionRepository extends JpaRepository //== UPDATE ==// @Modifying - @Query("UPDATE UserMission um SET um.mission = :mission, um.missionQuest = :quest, um.completedStatus = :status WHERE um.user = :user AND DATE(um.createdAt) = DATE(:date)") - void updateValidTodayMission(Mission mission, MissionQuest quest, CompletedStatus status, User user, LocalDate date); + @Query("UPDATE UserMission um SET um.mission = :mission, um.missionQuest = :quest WHERE um.user = :user AND DATE(um.createdAt) = DATE(:date)") + void updateValidTodayMission(Mission mission, MissionQuest quest, User user, LocalDate date); } diff --git a/motivoo-domain/src/main/java/sopt/org/motivoo/domain/mission/repository/UserMissionRetriever.java b/motivoo-domain/src/main/java/sopt/org/motivoo/domain/mission/repository/UserMissionRetriever.java index 2f947892..e812401c 100644 --- a/motivoo-domain/src/main/java/sopt/org/motivoo/domain/mission/repository/UserMissionRetriever.java +++ b/motivoo-domain/src/main/java/sopt/org/motivoo/domain/mission/repository/UserMissionRetriever.java @@ -52,7 +52,7 @@ public void deleteById(Long userMissionId) { //== UPDATE ==// public void updateUserMission(User user, Mission mission, MissionQuest quest) { - userMissionRepository.updateValidTodayMission(mission, quest, IN_PROGRESS, user, LocalDate.now()); + userMissionRepository.updateValidTodayMission(mission, quest, user, LocalDate.now()); } //== CREATE ==// diff --git a/motivoo-domain/src/main/java/sopt/org/motivoo/domain/mission/service/UserMissionManager.java b/motivoo-domain/src/main/java/sopt/org/motivoo/domain/mission/service/UserMissionManager.java index 220a8d6b..83866d08 100644 --- a/motivoo-domain/src/main/java/sopt/org/motivoo/domain/mission/service/UserMissionManager.java +++ b/motivoo-domain/src/main/java/sopt/org/motivoo/domain/mission/service/UserMissionManager.java @@ -172,6 +172,12 @@ public List getFilteredMissionChoices(User user, List= 3) { + throw new ParentchildException(INVALID_PARENTCHILD_RELATION); } - - return true; + return userCnt == 2 && isMatched; } } diff --git a/motivoo-domain/src/main/java/sopt/org/motivoo/domain/user/exception/UserExceptionType.java b/motivoo-domain/src/main/java/sopt/org/motivoo/domain/user/exception/UserExceptionType.java index 1acb6ffe..66776e2b 100644 --- a/motivoo-domain/src/main/java/sopt/org/motivoo/domain/user/exception/UserExceptionType.java +++ b/motivoo-domain/src/main/java/sopt/org/motivoo/domain/user/exception/UserExceptionType.java @@ -17,7 +17,6 @@ public enum UserExceptionType implements BusinessExceptionType { NULL_VALUE_USERTYPE_ENUM(HttpStatus.BAD_REQUEST, "데이터베이스의 유저 타입이 유효하지 않은 값입니다."), NULL_VALUE_AGE(HttpStatus.BAD_REQUEST, "유저의 나이는 null이어서는 안 됩니다."), ALREADY_WITHDRAW_USER(HttpStatus.BAD_REQUEST, "이미 탈퇴한 유저입니다."), - ALREADY_WITHDRAW_OPPONENT_USER(HttpStatus.BAD_REQUEST, "상대 유저가 탈퇴하여 요청을 처리할 수 없습니다."), /** * 401 Unauthorized @@ -36,7 +35,7 @@ public enum UserExceptionType implements BusinessExceptionType { /** * 412 Precondition Failed */ - // ALREADY_WITHDRAW_OPPONENT_USER(HttpStatus.PRECONDITION_FAILED, "상대 유저가 탈퇴하여 요청을 처리할 수 없습니다."), + ALREADY_WITHDRAW_OPPONENT_USER(HttpStatus.PRECONDITION_FAILED, "상대 유저가 탈퇴하여 요청을 처리할 수 없습니다."), ;