From d72b469de0904f477d0dbfffa31403fa0a227244 Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Wed, 20 Dec 2023 02:43:41 +0900 Subject: [PATCH 01/22] =?UTF-8?q?refactor:=20roadmap=20=EA=B4=80=EB=A0=A8?= =?UTF-8?q?=20=EC=BD=94=EB=93=9C=20=ED=8C=A8=ED=82=A4=EC=A7=80=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resolver/RoadmapSaveArgumentResolver.java | 4 +- .../co/kirikiri/domain/goalroom/GoalRoom.java | 2 +- .../domain/goalroom/GoalRoomRoadmapNode.java | 2 +- .../GoalRoomMemberQueryRepositoryImpl.java | 17 ++--- .../goalroom/GoalRoomQueryRepository.java | 2 +- .../goalroom/GoalRoomQueryRepositoryImpl.java | 17 ++--- .../controller/RoadmapController.java | 35 ++++----- .../roadmap => roadmap/domain}/Roadmap.java | 4 +- .../domain}/RoadmapCategory.java | 4 +- .../domain}/RoadmapContent.java | 4 +- .../domain}/RoadmapContents.java | 2 +- .../domain}/RoadmapDifficulty.java | 2 +- .../domain}/RoadmapNode.java | 4 +- .../domain}/RoadmapNodeImage.java | 2 +- .../domain}/RoadmapNodeImages.java | 4 +- .../domain}/RoadmapNodes.java | 4 +- .../domain}/RoadmapReview.java | 4 +- .../domain}/RoadmapReviews.java | 2 +- .../domain}/RoadmapStatus.java | 2 +- .../domain}/RoadmapTag.java | 4 +- .../domain}/RoadmapTags.java | 6 +- .../domain}/exception/RoadmapException.java | 2 +- .../domain}/vo/RoadmapTagName.java | 6 +- .../RoadmapCategoryRepository.java | 4 +- .../RoadmapContentRepository.java | 6 +- .../persistence}/RoadmapNodeRepository.java | 6 +- .../persistence}/RoadmapQueryRepository.java | 8 +-- .../RoadmapQueryRepositoryImpl.java | 27 +++---- .../persistence}/RoadmapRepository.java | 4 +- .../RoadmapReviewQueryRepository.java | 6 +- .../RoadmapReviewQueryRepositoryImpl.java | 13 ++-- .../persistence}/RoadmapReviewRepository.java | 6 +- .../service}/RoadmapCreateEventListener.java | 18 ++--- .../service}/RoadmapCreateService.java | 46 ++++++------ .../service}/RoadmapReadService.java | 62 ++++++++-------- .../service/dto}/RoadmapCategoryDto.java | 2 +- .../service/dto}/RoadmapContentDto.java | 2 +- .../service/dto}/RoadmapDto.java | 2 +- .../service/dto}/RoadmapForListDto.java | 2 +- .../service/dto}/RoadmapForListScrollDto.java | 2 +- .../dto}/RoadmapGoalRoomNumberDto.java | 2 +- .../dto}/RoadmapGoalRoomsOrderTypeDto.java | 2 +- .../service/dto}/RoadmapNodeDto.java | 2 +- .../service/dto}/RoadmapNodeSaveDto.java | 2 +- .../service/dto}/RoadmapReviewDto.java | 2 +- .../service/dto}/RoadmapReviewReadDto.java | 2 +- .../service/dto}/RoadmapSaveDto.java | 4 +- .../service/dto}/RoadmapTagDto.java | 2 +- .../service/dto}/RoadmapTagSaveDto.java | 2 +- .../request/RoadmapCategorySaveRequest.java | 2 +- .../dto}/request/RoadmapDifficultyType.java | 2 +- .../dto}/request/RoadmapNodeSaveRequest.java | 2 +- .../dto}/request/RoadmapOrderTypeRequest.java | 2 +- .../request/RoadmapReviewSaveRequest.java | 2 +- .../dto}/request/RoadmapSaveRequest.java | 2 +- .../dto}/request/RoadmapSearchRequest.java | 2 +- .../dto}/request/RoadmapTagSaveRequest.java | 2 +- .../dto}/response/MemberRoadmapResponse.java | 2 +- .../dto}/response/MemberRoadmapResponses.java | 2 +- .../response/RoadmapCategoryResponse.java | 2 +- .../dto}/response/RoadmapContentResponse.java | 2 +- .../dto}/response/RoadmapForListResponse.java | 2 +- .../response/RoadmapForListResponses.java | 2 +- .../response/RoadmapGoalRoomResponse.java | 2 +- .../response/RoadmapGoalRoomResponses.java | 2 +- .../dto}/response/RoadmapNodeResponse.java | 2 +- .../dto}/response/RoadmapResponse.java | 2 +- .../dto}/response/RoadmapReviewResponse.java | 2 +- .../dto}/response/RoadmapTagResponse.java | 2 +- .../service/event/RoadmapCreateEvent.java | 11 +++ .../service/mapper/RoadmapMapper.java | 72 ++++++++++--------- .../service/scheduler/RoadmapScheduler.java | 8 +-- .../service/event/RoadmapCreateEvent.java | 11 --- .../goalroom/GoalRoomCreateService.java | 8 +-- .../service/goalroom/GoalRoomReadService.java | 2 +- .../service/mapper/GoalRoomMapper.java | 8 +-- .../kirikiri/src/main/resources/properties | 2 +- .../RoadmapSaveArgumentResolverTest.java | 2 +- .../controller/RoadmapCreateApiTest.java | 17 ++--- .../controller/RoadmapReadApiTest.java | 33 ++++----- .../goalroom/GoalRoomPendingMemberTest.java | 2 +- .../goalroom/GoalRoomPendingMembersTest.java | 2 +- .../goalroom/GoalRoomRoadmapNodeTest.java | 2 +- .../goalroom/GoalRoomRoadmapNodesTest.java | 2 +- .../domain/goalroom/GoalRoomTest.java | 16 ++--- .../domain/roadmap/RoadmapCategoryTest.java | 3 +- .../domain/roadmap/RoadmapContentTest.java | 9 ++- .../domain/roadmap/RoadmapContentsTest.java | 4 ++ .../domain/roadmap/RoadmapNodeImagesTest.java | 4 +- .../domain/roadmap/RoadmapNodeTest.java | 3 +- .../domain/roadmap/RoadmapNodesTest.java | 3 + .../domain/roadmap/RoadmapReviewTest.java | 3 +- .../domain/roadmap/RoadmapTagsTest.java | 6 +- .../kirikiri/domain/roadmap/RoadmapTest.java | 10 ++- .../domain/roadmap/vo/RoadmapTagNameTest.java | 3 +- .../GoalRoomCreateIntegrationTest.java | 4 +- .../GoalRoomReadIntegrationTest.java | 10 +-- .../GoalRoomSchedulerIntegrationTest.java | 2 +- .../RoadmapCreateIntegrationTest.java | 10 +-- .../RoadmapReadIntegrationTest.java | 20 +++--- .../RoadmapReadOrderIntegrationTest.java | 16 ++--- .../RoadmapReviewCreateIntegrationTest.java | 5 +- .../RoadmapReviewReadIntegrationTest.java | 6 +- .../RoadmapSchedulerIntegrationTest.java | 6 +- .../RoadmapSearchIntegrationTest.java | 10 +-- .../fixture/GoalRoomAPIFixture.java | 2 +- .../fixture/RoadmapAPIFixture.java | 12 ++-- .../helper/InitIntegrationTest.java | 10 +-- .../helper/TestTransactionService.java | 2 +- .../goalroom/CheckFeedRepositoryTest.java | 22 +++--- .../GoalRoomMemberRepositoryTest.java | 22 +++--- .../GoalRoomPendingMemberRepositoryTest.java | 22 +++--- .../goalroom/GoalRoomRepositoryTest.java | 16 ++--- .../GoalRoomToDoCheckRepositoryTest.java | 16 ++--- .../roadmap/RoadmapContentRepositoryTest.java | 11 +-- .../roadmap/RoadmapRepositoryTest.java | 25 ++++--- .../roadmap/RoadmapReviewRepositoryTest.java | 17 +++-- .../service/GoalRoomCreateServiceTest.java | 22 +++--- .../service/GoalRoomReadServiceTest.java | 18 ++--- .../service/GoalRoomSchedulerTest.java | 18 ++--- .../RoadmapCreateEventListenerTest.java | 26 +++---- .../service/RoadmapCreateServiceTest.java | 32 ++++----- .../service/RoadmapReadServiceTest.java | 60 ++++++++-------- .../service/RoadmapSchedulerTest.java | 16 ++--- 124 files changed, 579 insertions(+), 536 deletions(-) rename backend/kirikiri/src/main/java/co/kirikiri/{ => roadmap}/controller/RoadmapController.java (86%) rename backend/kirikiri/src/main/java/co/kirikiri/{domain/roadmap => roadmap/domain}/Roadmap.java (98%) rename backend/kirikiri/src/main/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapCategory.java (91%) rename backend/kirikiri/src/main/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapContent.java (96%) rename backend/kirikiri/src/main/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapContents.java (97%) rename backend/kirikiri/src/main/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapDifficulty.java (74%) rename backend/kirikiri/src/main/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapNode.java (96%) rename backend/kirikiri/src/main/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapNodeImage.java (97%) rename backend/kirikiri/src/main/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapNodeImages.java (93%) rename backend/kirikiri/src/main/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapNodes.java (96%) rename backend/kirikiri/src/main/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapReview.java (96%) rename backend/kirikiri/src/main/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapReviews.java (95%) rename backend/kirikiri/src/main/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapStatus.java (61%) rename backend/kirikiri/src/main/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapTag.java (93%) rename backend/kirikiri/src/main/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapTags.java (93%) rename backend/kirikiri/src/main/java/co/kirikiri/{domain/roadmap => roadmap/domain}/exception/RoadmapException.java (80%) rename backend/kirikiri/src/main/java/co/kirikiri/{domain/roadmap => roadmap/domain}/vo/RoadmapTagName.java (88%) rename backend/kirikiri/src/main/java/co/kirikiri/{persistence/roadmap => roadmap/persistence}/RoadmapCategoryRepository.java (72%) rename backend/kirikiri/src/main/java/co/kirikiri/{persistence/roadmap => roadmap/persistence}/RoadmapContentRepository.java (82%) rename backend/kirikiri/src/main/java/co/kirikiri/{persistence/roadmap => roadmap/persistence}/RoadmapNodeRepository.java (64%) rename backend/kirikiri/src/main/java/co/kirikiri/{persistence/roadmap => roadmap/persistence}/RoadmapQueryRepository.java (87%) rename backend/kirikiri/src/main/java/co/kirikiri/{persistence/roadmap => roadmap/persistence}/RoadmapQueryRepositoryImpl.java (94%) rename backend/kirikiri/src/main/java/co/kirikiri/{persistence/roadmap => roadmap/persistence}/RoadmapRepository.java (66%) rename backend/kirikiri/src/main/java/co/kirikiri/{persistence/roadmap => roadmap/persistence}/RoadmapReviewQueryRepository.java (73%) rename backend/kirikiri/src/main/java/co/kirikiri/{persistence/roadmap => roadmap/persistence}/RoadmapReviewQueryRepositoryImpl.java (89%) rename backend/kirikiri/src/main/java/co/kirikiri/{persistence/roadmap => roadmap/persistence}/RoadmapReviewRepository.java (72%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/roadmap => roadmap/service}/RoadmapCreateEventListener.java (89%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/roadmap => roadmap/service}/RoadmapCreateService.java (87%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/roadmap => roadmap/service}/RoadmapReadService.java (88%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/RoadmapCategoryDto.java (65%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/RoadmapContentDto.java (77%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/RoadmapDto.java (91%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/RoadmapForListDto.java (91%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/RoadmapForListScrollDto.java (76%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/RoadmapGoalRoomNumberDto.java (79%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/RoadmapGoalRoomsOrderTypeDto.java (86%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/RoadmapNodeDto.java (79%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/RoadmapNodeSaveDto.java (83%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/RoadmapReviewDto.java (78%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/RoadmapReviewReadDto.java (85%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/RoadmapSaveDto.java (75%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/RoadmapTagDto.java (64%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/RoadmapTagSaveDto.java (59%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/request/RoadmapCategorySaveRequest.java (80%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/request/RoadmapDifficultyType.java (69%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/request/RoadmapNodeSaveRequest.java (93%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/request/RoadmapOrderTypeRequest.java (87%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/request/RoadmapReviewSaveRequest.java (80%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/request/RoadmapSaveRequest.java (95%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/request/RoadmapSearchRequest.java (71%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/request/RoadmapTagSaveRequest.java (57%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/response/MemberRoadmapResponse.java (82%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/response/MemberRoadmapResponses.java (73%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/response/RoadmapCategoryResponse.java (62%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/response/RoadmapContentResponse.java (75%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/response/RoadmapForListResponse.java (90%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/response/RoadmapForListResponses.java (74%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/response/RoadmapGoalRoomResponse.java (90%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/response/RoadmapGoalRoomResponses.java (74%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/response/RoadmapNodeResponse.java (76%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/response/RoadmapResponse.java (92%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/response/RoadmapReviewResponse.java (84%) rename backend/kirikiri/src/main/java/co/kirikiri/{service/dto/roadmap => roadmap/service/dto}/response/RoadmapTagResponse.java (61%) create mode 100644 backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/event/RoadmapCreateEvent.java rename backend/kirikiri/src/main/java/co/kirikiri/{ => roadmap}/service/mapper/RoadmapMapper.java (82%) rename backend/kirikiri/src/main/java/co/kirikiri/{ => roadmap}/service/scheduler/RoadmapScheduler.java (90%) delete mode 100644 backend/kirikiri/src/main/java/co/kirikiri/service/event/RoadmapCreateEvent.java diff --git a/backend/kirikiri/src/main/java/co/kirikiri/common/resolver/RoadmapSaveArgumentResolver.java b/backend/kirikiri/src/main/java/co/kirikiri/common/resolver/RoadmapSaveArgumentResolver.java index fb080e831..f0bf30836 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/common/resolver/RoadmapSaveArgumentResolver.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/common/resolver/RoadmapSaveArgumentResolver.java @@ -1,7 +1,7 @@ package co.kirikiri.common.resolver; -import co.kirikiri.service.dto.roadmap.request.RoadmapNodeSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; import co.kirikiri.service.exception.BadRequestException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoom.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoom.java index e10f05f82..474549cdb 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoom.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoom.java @@ -5,7 +5,7 @@ import co.kirikiri.domain.goalroom.vo.GoalRoomName; import co.kirikiri.domain.goalroom.vo.LimitedMemberCount; import co.kirikiri.domain.member.Member; -import co.kirikiri.domain.roadmap.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapContent; import jakarta.persistence.Column; import jakarta.persistence.Embedded; import jakarta.persistence.Entity; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNode.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNode.java index a8ec84112..eb1f0b49b 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNode.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNode.java @@ -3,7 +3,7 @@ import co.kirikiri.domain.BaseEntity; import co.kirikiri.domain.goalroom.exception.GoalRoomException; import co.kirikiri.domain.goalroom.vo.Period; -import co.kirikiri.domain.roadmap.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNode; import jakarta.persistence.Embedded; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberQueryRepositoryImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberQueryRepositoryImpl.java index 5f83611bb..e2f5ce90c 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberQueryRepositoryImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberQueryRepositoryImpl.java @@ -1,13 +1,5 @@ package co.kirikiri.persistence.goalroom; -import static co.kirikiri.domain.goalroom.QGoalRoom.goalRoom; -import static co.kirikiri.domain.goalroom.QGoalRoomMember.goalRoomMember; -import static co.kirikiri.domain.member.QMember.member; -import static co.kirikiri.domain.member.QMemberImage.memberImage; -import static co.kirikiri.domain.roadmap.QRoadmapContent.roadmapContent; -import static co.kirikiri.persistence.goalroom.dto.GoalRoomMemberSortType.ACCOMPLISHMENT_RATE; -import static co.kirikiri.persistence.goalroom.dto.GoalRoomMemberSortType.JOINED_ASC; - import co.kirikiri.domain.goalroom.GoalRoomMember; import co.kirikiri.domain.goalroom.GoalRoomStatus; import co.kirikiri.domain.member.vo.Identifier; @@ -15,9 +7,18 @@ import co.kirikiri.persistence.goalroom.dto.GoalRoomMemberSortType; import com.querydsl.core.types.OrderSpecifier; import com.querydsl.core.types.dsl.BooleanExpression; + import java.util.List; import java.util.Optional; +import static co.kirikiri.domain.goalroom.QGoalRoom.goalRoom; +import static co.kirikiri.domain.goalroom.QGoalRoomMember.goalRoomMember; +import static co.kirikiri.domain.member.QMember.member; +import static co.kirikiri.domain.member.QMemberImage.memberImage; +import static co.kirikiri.persistence.goalroom.dto.GoalRoomMemberSortType.ACCOMPLISHMENT_RATE; +import static co.kirikiri.persistence.goalroom.dto.GoalRoomMemberSortType.JOINED_ASC; +import static co.kirikiri.roadmap.domain.QRoadmapContent.roadmapContent; + public class GoalRoomMemberQueryRepositoryImpl extends QuerydslRepositorySupporter implements GoalRoomMemberQueryRepository { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepository.java index 5a18b19d9..c4ca95054 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepository.java @@ -3,7 +3,7 @@ import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomStatus; import co.kirikiri.domain.member.Member; -import co.kirikiri.domain.roadmap.Roadmap; +import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.persistence.goalroom.dto.RoadmapGoalRoomsOrderType; import java.time.LocalDate; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepositoryImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepositoryImpl.java index dad601666..5fe835bec 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepositoryImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepositoryImpl.java @@ -1,25 +1,26 @@ package co.kirikiri.persistence.goalroom; -import static co.kirikiri.domain.goalroom.QGoalRoom.goalRoom; -import static co.kirikiri.domain.goalroom.QGoalRoomMember.goalRoomMember; -import static co.kirikiri.domain.goalroom.QGoalRoomPendingMember.goalRoomPendingMember; -import static co.kirikiri.domain.goalroom.QGoalRoomRoadmapNode.goalRoomRoadmapNode; -import static co.kirikiri.domain.goalroom.QGoalRoomToDo.goalRoomToDo; -import static co.kirikiri.domain.roadmap.QRoadmapContent.roadmapContent; - import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomStatus; import co.kirikiri.domain.member.Member; -import co.kirikiri.domain.roadmap.Roadmap; import co.kirikiri.persistence.QuerydslRepositorySupporter; import co.kirikiri.persistence.goalroom.dto.RoadmapGoalRoomsOrderType; +import co.kirikiri.roadmap.domain.Roadmap; import com.querydsl.core.types.OrderSpecifier; import com.querydsl.core.types.dsl.BooleanExpression; import jakarta.persistence.LockModeType; + import java.time.LocalDate; import java.util.List; import java.util.Optional; +import static co.kirikiri.domain.goalroom.QGoalRoom.goalRoom; +import static co.kirikiri.domain.goalroom.QGoalRoomMember.goalRoomMember; +import static co.kirikiri.domain.goalroom.QGoalRoomPendingMember.goalRoomPendingMember; +import static co.kirikiri.domain.goalroom.QGoalRoomRoadmapNode.goalRoomRoadmapNode; +import static co.kirikiri.domain.goalroom.QGoalRoomToDo.goalRoomToDo; +import static co.kirikiri.roadmap.domain.QRoadmapContent.roadmapContent; + public class GoalRoomQueryRepositoryImpl extends QuerydslRepositorySupporter implements GoalRoomQueryRepository { private static final int LIMIT_OFFSET = 1; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/controller/RoadmapController.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/controller/RoadmapController.java similarity index 86% rename from backend/kirikiri/src/main/java/co/kirikiri/controller/RoadmapController.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/controller/RoadmapController.java index 21abca873..0665ac534 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/controller/RoadmapController.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/controller/RoadmapController.java @@ -1,25 +1,23 @@ -package co.kirikiri.controller; +package co.kirikiri.roadmap.controller; import co.kirikiri.common.interceptor.Authenticated; import co.kirikiri.common.resolver.MemberIdentifier; import co.kirikiri.service.dto.CustomScrollRequest; -import co.kirikiri.service.dto.roadmap.RoadmapGoalRoomsOrderTypeDto; -import co.kirikiri.service.dto.roadmap.request.RoadmapCategorySaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapOrderTypeRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapReviewSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapSearchRequest; -import co.kirikiri.service.dto.roadmap.response.MemberRoadmapResponses; -import co.kirikiri.service.dto.roadmap.response.RoadmapCategoryResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapForListResponses; -import co.kirikiri.service.dto.roadmap.response.RoadmapGoalRoomResponses; -import co.kirikiri.service.dto.roadmap.response.RoadmapResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapReviewResponse; -import co.kirikiri.service.roadmap.RoadmapCreateService; -import co.kirikiri.service.roadmap.RoadmapReadService; +import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomsOrderTypeDto; +import co.kirikiri.roadmap.service.dto.request.RoadmapCategorySaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapOrderTypeRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapSearchRequest; +import co.kirikiri.roadmap.service.dto.response.MemberRoadmapResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapCategoryResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapForListResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; +import co.kirikiri.roadmap.service.RoadmapCreateService; +import co.kirikiri.roadmap.service.RoadmapReadService; import jakarta.validation.Valid; -import java.net.URI; -import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -34,6 +32,9 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import java.net.URI; +import java.util.List; + @RestController @RequestMapping("/roadmaps") @RequiredArgsConstructor diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/Roadmap.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/Roadmap.java similarity index 98% rename from backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/Roadmap.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/Roadmap.java index 6c509d470..6af0662b4 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/Roadmap.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/Roadmap.java @@ -1,8 +1,8 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; import co.kirikiri.domain.BaseCreatedTimeEntity; import co.kirikiri.domain.member.Member; -import co.kirikiri.domain.roadmap.exception.RoadmapException; +import co.kirikiri.roadmap.domain.exception.RoadmapException; import jakarta.persistence.Column; import jakarta.persistence.Embedded; import jakarta.persistence.Entity; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapCategory.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapCategory.java similarity index 91% rename from backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapCategory.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapCategory.java index 521839855..d76f1874f 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapCategory.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapCategory.java @@ -1,7 +1,7 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; import co.kirikiri.domain.BaseEntity; -import co.kirikiri.domain.roadmap.exception.RoadmapException; +import co.kirikiri.roadmap.domain.exception.RoadmapException; import jakarta.persistence.Column; import jakarta.persistence.Entity; import lombok.AccessLevel; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapContent.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContent.java similarity index 96% rename from backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapContent.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContent.java index e4d918267..692b6dfc8 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapContent.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContent.java @@ -1,7 +1,7 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; import co.kirikiri.domain.BaseUpdatedTimeEntity; -import co.kirikiri.domain.roadmap.exception.RoadmapException; +import co.kirikiri.roadmap.domain.exception.RoadmapException; import jakarta.persistence.Column; import jakarta.persistence.Embedded; import jakarta.persistence.Entity; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapContents.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContents.java similarity index 97% rename from backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapContents.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContents.java index 4677640f2..18eb219ca 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapContents.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContents.java @@ -1,4 +1,4 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; import jakarta.persistence.CascadeType; import jakarta.persistence.Column; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapDifficulty.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapDifficulty.java similarity index 74% rename from backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapDifficulty.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapDifficulty.java index f8379da50..1a4969ced 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapDifficulty.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapDifficulty.java @@ -1,4 +1,4 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; public enum RoadmapDifficulty { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapNode.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNode.java similarity index 96% rename from backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapNode.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNode.java index dcf5bfbdf..2a641d291 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapNode.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNode.java @@ -1,7 +1,7 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; import co.kirikiri.domain.BaseEntity; -import co.kirikiri.domain.roadmap.exception.RoadmapException; +import co.kirikiri.roadmap.domain.exception.RoadmapException; import jakarta.persistence.Column; import jakarta.persistence.Embedded; import jakarta.persistence.Entity; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapNodeImage.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodeImage.java similarity index 97% rename from backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapNodeImage.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodeImage.java index 47f3b1a1d..572bbf430 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapNodeImage.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodeImage.java @@ -1,4 +1,4 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; import co.kirikiri.domain.BaseEntity; import co.kirikiri.domain.ImageContentType; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapNodeImages.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodeImages.java similarity index 93% rename from backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapNodeImages.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodeImages.java index 8d33922dc..4af543a71 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapNodeImages.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodeImages.java @@ -1,6 +1,6 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; -import co.kirikiri.domain.roadmap.exception.RoadmapException; +import co.kirikiri.roadmap.domain.exception.RoadmapException; import jakarta.persistence.CascadeType; import jakarta.persistence.Embeddable; import jakarta.persistence.FetchType; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapNodes.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodes.java similarity index 96% rename from backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapNodes.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodes.java index 728d15b6f..6f6440960 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapNodes.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodes.java @@ -1,6 +1,6 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; -import co.kirikiri.domain.roadmap.exception.RoadmapException; +import co.kirikiri.roadmap.domain.exception.RoadmapException; import jakarta.persistence.CascadeType; import jakarta.persistence.Embeddable; import jakarta.persistence.FetchType; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapReview.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReview.java similarity index 96% rename from backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapReview.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReview.java index 1b36d1f92..af3bf5c2a 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapReview.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReview.java @@ -1,8 +1,8 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; import co.kirikiri.domain.BaseUpdatedTimeEntity; import co.kirikiri.domain.member.Member; -import co.kirikiri.domain.roadmap.exception.RoadmapException; +import co.kirikiri.roadmap.domain.exception.RoadmapException; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapReviews.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReviews.java similarity index 95% rename from backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapReviews.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReviews.java index 706c14b6f..9880cd83d 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapReviews.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReviews.java @@ -1,4 +1,4 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; import jakarta.persistence.CascadeType; import jakarta.persistence.Embeddable; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapStatus.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapStatus.java similarity index 61% rename from backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapStatus.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapStatus.java index 2e24fc540..e730beb56 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapStatus.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapStatus.java @@ -1,4 +1,4 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; public enum RoadmapStatus { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapTag.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapTag.java similarity index 93% rename from backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapTag.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapTag.java index 2dcd55fdc..e536bc274 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapTag.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapTag.java @@ -1,7 +1,7 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; import co.kirikiri.domain.BaseEntity; -import co.kirikiri.domain.roadmap.vo.RoadmapTagName; +import co.kirikiri.roadmap.domain.vo.RoadmapTagName; import jakarta.persistence.Embedded; import jakarta.persistence.Entity; import lombok.AccessLevel; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapTags.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapTags.java similarity index 93% rename from backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapTags.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapTags.java index 763c920cb..4b6b079c7 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/RoadmapTags.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapTags.java @@ -1,7 +1,7 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; -import co.kirikiri.domain.roadmap.exception.RoadmapException; -import co.kirikiri.domain.roadmap.vo.RoadmapTagName; +import co.kirikiri.roadmap.domain.exception.RoadmapException; +import co.kirikiri.roadmap.domain.vo.RoadmapTagName; import jakarta.persistence.CascadeType; import jakarta.persistence.Embeddable; import jakarta.persistence.FetchType; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/exception/RoadmapException.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/exception/RoadmapException.java similarity index 80% rename from backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/exception/RoadmapException.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/exception/RoadmapException.java index 86610f60b..5f13270ff 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/exception/RoadmapException.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/exception/RoadmapException.java @@ -1,4 +1,4 @@ -package co.kirikiri.domain.roadmap.exception; +package co.kirikiri.roadmap.domain.exception; import co.kirikiri.domain.exception.DomainException; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/vo/RoadmapTagName.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/vo/RoadmapTagName.java similarity index 88% rename from backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/vo/RoadmapTagName.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/vo/RoadmapTagName.java index 711208319..41d519546 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/roadmap/vo/RoadmapTagName.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/vo/RoadmapTagName.java @@ -1,6 +1,6 @@ -package co.kirikiri.domain.roadmap.vo; +package co.kirikiri.roadmap.domain.vo; -import co.kirikiri.domain.roadmap.exception.RoadmapException; +import co.kirikiri.roadmap.domain.exception.RoadmapException; import jakarta.persistence.Column; import java.util.Objects; import lombok.AccessLevel; @@ -16,7 +16,7 @@ public class RoadmapTagName { private String value; public RoadmapTagName(final String value) { - final String removedSpaceValue = value.replaceAll(" ", ""); + final String removedSpaceValue = value.replace(" ", ""); validate(removedSpaceValue); this.value = removedSpaceValue; } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapCategoryRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapCategoryRepository.java similarity index 72% rename from backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapCategoryRepository.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapCategoryRepository.java index 37d52022b..a7250e476 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapCategoryRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapCategoryRepository.java @@ -1,6 +1,6 @@ -package co.kirikiri.persistence.roadmap; +package co.kirikiri.roadmap.persistence; -import co.kirikiri.domain.roadmap.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapCategory; import org.springframework.data.jpa.repository.JpaRepository; import java.util.Optional; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapContentRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapContentRepository.java similarity index 82% rename from backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapContentRepository.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapContentRepository.java index 722761e75..c2202f00f 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapContentRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapContentRepository.java @@ -1,7 +1,7 @@ -package co.kirikiri.persistence.roadmap; +package co.kirikiri.roadmap.persistence; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapContent; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapContent; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapNodeRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapNodeRepository.java similarity index 64% rename from backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapNodeRepository.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapNodeRepository.java index cbe15b11b..ad15f7806 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapNodeRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapNodeRepository.java @@ -1,7 +1,7 @@ -package co.kirikiri.persistence.roadmap; +package co.kirikiri.roadmap.persistence; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapNode; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapQueryRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepository.java similarity index 87% rename from backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapQueryRepository.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepository.java index 05a9d838e..6ea8dbd48 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapQueryRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepository.java @@ -1,9 +1,9 @@ -package co.kirikiri.persistence.roadmap; +package co.kirikiri.roadmap.persistence; import co.kirikiri.domain.member.Member; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapStatus; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapStatus; import co.kirikiri.persistence.dto.RoadmapOrderType; import co.kirikiri.persistence.dto.RoadmapSearchDto; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapQueryRepositoryImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepositoryImpl.java similarity index 94% rename from backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapQueryRepositoryImpl.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepositoryImpl.java index 95680b8aa..2c19ba527 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapQueryRepositoryImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepositoryImpl.java @@ -1,25 +1,16 @@ -package co.kirikiri.persistence.roadmap; - -import static co.kirikiri.domain.goalroom.QGoalRoom.goalRoom; -import static co.kirikiri.domain.goalroom.QGoalRoomMember.goalRoomMember; -import static co.kirikiri.domain.member.QMember.member; -import static co.kirikiri.domain.roadmap.QRoadmap.roadmap; -import static co.kirikiri.domain.roadmap.QRoadmapCategory.roadmapCategory; -import static co.kirikiri.domain.roadmap.QRoadmapContent.roadmapContent; -import static co.kirikiri.domain.roadmap.QRoadmapReview.roadmapReview; -import static co.kirikiri.domain.roadmap.QRoadmapTag.roadmapTag; +package co.kirikiri.roadmap.persistence; import co.kirikiri.domain.member.Member; import co.kirikiri.domain.member.vo.Identifier; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapStatus; import co.kirikiri.persistence.QuerydslRepositorySupporter; import co.kirikiri.persistence.dto.RoadmapOrderType; import co.kirikiri.persistence.dto.RoadmapSearchCreatorNickname; import co.kirikiri.persistence.dto.RoadmapSearchDto; import co.kirikiri.persistence.dto.RoadmapSearchTagName; import co.kirikiri.persistence.dto.RoadmapSearchTitle; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapStatus; import com.querydsl.core.types.Order; import com.querydsl.core.types.OrderSpecifier; import com.querydsl.core.types.dsl.BooleanExpression; @@ -27,9 +18,19 @@ import com.querydsl.core.types.dsl.NumberPath; import com.querydsl.core.types.dsl.StringExpression; import com.querydsl.jpa.impl.JPAQuery; + import java.util.List; import java.util.Optional; +import static co.kirikiri.domain.goalroom.QGoalRoom.goalRoom; +import static co.kirikiri.domain.goalroom.QGoalRoomMember.goalRoomMember; +import static co.kirikiri.domain.member.QMember.member; +import static co.kirikiri.roadmap.domain.QRoadmap.roadmap; +import static co.kirikiri.roadmap.domain.QRoadmapCategory.roadmapCategory; +import static co.kirikiri.roadmap.domain.QRoadmapContent.roadmapContent; +import static co.kirikiri.roadmap.domain.QRoadmapReview.roadmapReview; +import static co.kirikiri.roadmap.domain.QRoadmapTag.roadmapTag; + public class RoadmapQueryRepositoryImpl extends QuerydslRepositorySupporter implements RoadmapQueryRepository { private static final int LIMIT_OFFSET = 1; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapRepository.java similarity index 66% rename from backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapRepository.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapRepository.java index 6df4b1ba4..f0819e5d9 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapRepository.java @@ -1,6 +1,6 @@ -package co.kirikiri.persistence.roadmap; +package co.kirikiri.roadmap.persistence; -import co.kirikiri.domain.roadmap.Roadmap; +import co.kirikiri.roadmap.domain.Roadmap; import org.springframework.data.jpa.repository.JpaRepository; public interface RoadmapRepository extends JpaRepository, RoadmapQueryRepository { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapReviewQueryRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepository.java similarity index 73% rename from backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapReviewQueryRepository.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepository.java index 84a779636..a4cd62e5c 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapReviewQueryRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepository.java @@ -1,7 +1,7 @@ -package co.kirikiri.persistence.roadmap; +package co.kirikiri.roadmap.persistence; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapReview; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapReview; import java.util.List; public interface RoadmapReviewQueryRepository { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapReviewQueryRepositoryImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepositoryImpl.java similarity index 89% rename from backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapReviewQueryRepositoryImpl.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepositoryImpl.java index a0dc47a56..7c9ffcb94 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapReviewQueryRepositoryImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepositoryImpl.java @@ -1,16 +1,17 @@ -package co.kirikiri.persistence.roadmap; +package co.kirikiri.roadmap.persistence; -import static co.kirikiri.domain.member.QMember.member; -import static co.kirikiri.domain.roadmap.QRoadmapReview.roadmapReview; - -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapReview; import co.kirikiri.persistence.QuerydslRepositorySupporter; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapReview; import com.querydsl.core.types.OrderSpecifier; import com.querydsl.core.types.dsl.BooleanExpression; + import java.time.LocalDateTime; import java.util.List; +import static co.kirikiri.domain.member.QMember.member; +import static co.kirikiri.roadmap.domain.QRoadmapReview.roadmapReview; + public class RoadmapReviewQueryRepositoryImpl extends QuerydslRepositorySupporter implements RoadmapReviewQueryRepository { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapReviewRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepository.java similarity index 72% rename from backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapReviewRepository.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepository.java index b83bb24f2..cf275af3d 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapReviewRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepository.java @@ -1,8 +1,8 @@ -package co.kirikiri.persistence.roadmap; +package co.kirikiri.roadmap.persistence; import co.kirikiri.domain.member.Member; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapReview; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapReview; import org.springframework.data.jpa.repository.JpaRepository; import java.util.Optional; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/roadmap/RoadmapCreateEventListener.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateEventListener.java similarity index 89% rename from backend/kirikiri/src/main/java/co/kirikiri/service/roadmap/RoadmapCreateEventListener.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateEventListener.java index 833c59de6..b1dd1e03d 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/roadmap/RoadmapCreateEventListener.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateEventListener.java @@ -1,19 +1,19 @@ -package co.kirikiri.service.roadmap; +package co.kirikiri.roadmap.service; import co.kirikiri.domain.ImageContentType; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapNode; -import co.kirikiri.domain.roadmap.RoadmapNodeImage; -import co.kirikiri.domain.roadmap.RoadmapNodeImages; -import co.kirikiri.persistence.roadmap.RoadmapContentRepository; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodeImage; +import co.kirikiri.roadmap.domain.RoadmapNodeImages; +import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.service.FilePathGenerator; import co.kirikiri.service.FileService; import co.kirikiri.service.ImageDirType; import co.kirikiri.service.aop.ExceptionConvert; import co.kirikiri.service.dto.FileInformation; -import co.kirikiri.service.dto.roadmap.RoadmapNodeSaveDto; -import co.kirikiri.service.event.RoadmapCreateEvent; +import co.kirikiri.roadmap.service.dto.RoadmapNodeSaveDto; +import co.kirikiri.roadmap.service.event.RoadmapCreateEvent; import co.kirikiri.service.exception.BadRequestException; import co.kirikiri.service.exception.ServerException; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/roadmap/RoadmapCreateService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java similarity index 87% rename from backend/kirikiri/src/main/java/co/kirikiri/service/roadmap/RoadmapCreateService.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java index 77bce647b..157757bfb 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/roadmap/RoadmapCreateService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java @@ -1,41 +1,41 @@ -package co.kirikiri.service.roadmap; +package co.kirikiri.roadmap.service; import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomMember; import co.kirikiri.domain.goalroom.GoalRoomStatus; import co.kirikiri.domain.member.Member; import co.kirikiri.domain.member.vo.Identifier; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapDifficulty; -import co.kirikiri.domain.roadmap.RoadmapNode; -import co.kirikiri.domain.roadmap.RoadmapNodes; -import co.kirikiri.domain.roadmap.RoadmapReview; -import co.kirikiri.domain.roadmap.RoadmapTag; -import co.kirikiri.domain.roadmap.RoadmapTags; -import co.kirikiri.domain.roadmap.vo.RoadmapTagName; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodes; +import co.kirikiri.roadmap.domain.RoadmapReview; +import co.kirikiri.roadmap.domain.RoadmapTag; +import co.kirikiri.roadmap.domain.RoadmapTags; +import co.kirikiri.roadmap.domain.vo.RoadmapTagName; import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; import co.kirikiri.persistence.goalroom.GoalRoomRepository; import co.kirikiri.persistence.member.MemberRepository; -import co.kirikiri.persistence.roadmap.RoadmapCategoryRepository; -import co.kirikiri.persistence.roadmap.RoadmapRepository; -import co.kirikiri.persistence.roadmap.RoadmapReviewRepository; +import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; +import co.kirikiri.roadmap.persistence.RoadmapRepository; +import co.kirikiri.roadmap.persistence.RoadmapReviewRepository; import co.kirikiri.service.aop.ExceptionConvert; -import co.kirikiri.service.dto.roadmap.RoadmapNodeSaveDto; -import co.kirikiri.service.dto.roadmap.RoadmapReviewDto; -import co.kirikiri.service.dto.roadmap.RoadmapSaveDto; -import co.kirikiri.service.dto.roadmap.RoadmapTagSaveDto; -import co.kirikiri.service.dto.roadmap.request.RoadmapCategorySaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapReviewSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapSaveRequest; -import co.kirikiri.service.event.RoadmapCreateEvent; +import co.kirikiri.roadmap.service.dto.RoadmapNodeSaveDto; +import co.kirikiri.roadmap.service.dto.RoadmapReviewDto; +import co.kirikiri.roadmap.service.dto.RoadmapSaveDto; +import co.kirikiri.roadmap.service.dto.RoadmapTagSaveDto; +import co.kirikiri.roadmap.service.dto.request.RoadmapCategorySaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; +import co.kirikiri.roadmap.service.event.RoadmapCreateEvent; import co.kirikiri.service.exception.AuthenticationException; import co.kirikiri.service.exception.BadRequestException; import co.kirikiri.service.exception.ConflictException; import co.kirikiri.service.exception.ForbiddenException; import co.kirikiri.service.exception.NotFoundException; -import co.kirikiri.service.mapper.RoadmapMapper; +import co.kirikiri.roadmap.service.mapper.RoadmapMapper; import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.cache.annotation.CacheEvict; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/roadmap/RoadmapReadService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java similarity index 88% rename from backend/kirikiri/src/main/java/co/kirikiri/service/roadmap/RoadmapReadService.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java index 7afa4fce1..ca0824606 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/roadmap/RoadmapReadService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java @@ -1,51 +1,51 @@ -package co.kirikiri.service.roadmap; +package co.kirikiri.roadmap.service; import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.member.Member; import co.kirikiri.domain.member.vo.Identifier; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapNode; -import co.kirikiri.domain.roadmap.RoadmapNodes; -import co.kirikiri.domain.roadmap.RoadmapReview; -import co.kirikiri.domain.roadmap.RoadmapTags; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodes; +import co.kirikiri.roadmap.domain.RoadmapReview; +import co.kirikiri.roadmap.domain.RoadmapTags; import co.kirikiri.persistence.dto.RoadmapOrderType; import co.kirikiri.persistence.dto.RoadmapSearchDto; import co.kirikiri.persistence.goalroom.GoalRoomRepository; import co.kirikiri.persistence.goalroom.dto.RoadmapGoalRoomsOrderType; import co.kirikiri.persistence.member.MemberRepository; -import co.kirikiri.persistence.roadmap.RoadmapCategoryRepository; -import co.kirikiri.persistence.roadmap.RoadmapContentRepository; -import co.kirikiri.persistence.roadmap.RoadmapRepository; -import co.kirikiri.persistence.roadmap.RoadmapReviewRepository; +import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; +import co.kirikiri.roadmap.persistence.RoadmapContentRepository; +import co.kirikiri.roadmap.persistence.RoadmapRepository; +import co.kirikiri.roadmap.persistence.RoadmapReviewRepository; import co.kirikiri.service.FileService; import co.kirikiri.service.aop.ExceptionConvert; import co.kirikiri.service.dto.CustomScrollRequest; import co.kirikiri.service.dto.goalroom.RoadmapGoalRoomDto; import co.kirikiri.service.dto.goalroom.RoadmapGoalRoomScrollDto; import co.kirikiri.service.dto.member.MemberDto; -import co.kirikiri.service.dto.roadmap.RoadmapCategoryDto; -import co.kirikiri.service.dto.roadmap.RoadmapContentDto; -import co.kirikiri.service.dto.roadmap.RoadmapDto; -import co.kirikiri.service.dto.roadmap.RoadmapForListDto; -import co.kirikiri.service.dto.roadmap.RoadmapForListScrollDto; -import co.kirikiri.service.dto.roadmap.RoadmapGoalRoomNumberDto; -import co.kirikiri.service.dto.roadmap.RoadmapGoalRoomsOrderTypeDto; -import co.kirikiri.service.dto.roadmap.RoadmapNodeDto; -import co.kirikiri.service.dto.roadmap.RoadmapReviewReadDto; -import co.kirikiri.service.dto.roadmap.RoadmapTagDto; -import co.kirikiri.service.dto.roadmap.request.RoadmapOrderTypeRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapSearchRequest; -import co.kirikiri.service.dto.roadmap.response.MemberRoadmapResponses; -import co.kirikiri.service.dto.roadmap.response.RoadmapCategoryResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapForListResponses; -import co.kirikiri.service.dto.roadmap.response.RoadmapGoalRoomResponses; -import co.kirikiri.service.dto.roadmap.response.RoadmapResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapReviewResponse; +import co.kirikiri.roadmap.service.dto.RoadmapCategoryDto; +import co.kirikiri.roadmap.service.dto.RoadmapContentDto; +import co.kirikiri.roadmap.service.dto.RoadmapDto; +import co.kirikiri.roadmap.service.dto.RoadmapForListDto; +import co.kirikiri.roadmap.service.dto.RoadmapForListScrollDto; +import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomNumberDto; +import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomsOrderTypeDto; +import co.kirikiri.roadmap.service.dto.RoadmapNodeDto; +import co.kirikiri.roadmap.service.dto.RoadmapReviewReadDto; +import co.kirikiri.roadmap.service.dto.RoadmapTagDto; +import co.kirikiri.roadmap.service.dto.request.RoadmapOrderTypeRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapSearchRequest; +import co.kirikiri.roadmap.service.dto.response.MemberRoadmapResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapCategoryResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapForListResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; import co.kirikiri.service.exception.NotFoundException; import co.kirikiri.service.mapper.GoalRoomMapper; -import co.kirikiri.service.mapper.RoadmapMapper; +import co.kirikiri.roadmap.service.mapper.RoadmapMapper; import co.kirikiri.service.mapper.ScrollResponseMapper; import java.net.URL; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapCategoryDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapCategoryDto.java similarity index 65% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapCategoryDto.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapCategoryDto.java index 591ab9e85..a6c6c8c15 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapCategoryDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapCategoryDto.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap; +package co.kirikiri.roadmap.service.dto; public record RoadmapCategoryDto( long id, diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapContentDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapContentDto.java similarity index 77% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapContentDto.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapContentDto.java index c568a32e6..3884c8377 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapContentDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapContentDto.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap; +package co.kirikiri.roadmap.service.dto; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapDto.java similarity index 91% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapDto.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapDto.java index a85cd7915..19adc1f24 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapDto.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap; +package co.kirikiri.roadmap.service.dto; import co.kirikiri.service.dto.member.MemberDto; import java.time.LocalDateTime; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapForListDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapForListDto.java similarity index 91% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapForListDto.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapForListDto.java index 1b05ab352..c42cace25 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapForListDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapForListDto.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap; +package co.kirikiri.roadmap.service.dto; import co.kirikiri.service.dto.member.MemberDto; import java.time.LocalDateTime; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapForListScrollDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapForListScrollDto.java similarity index 76% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapForListScrollDto.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapForListScrollDto.java index 042c42c97..85139eb4e 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapForListScrollDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapForListScrollDto.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap; +package co.kirikiri.roadmap.service.dto; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapGoalRoomNumberDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapGoalRoomNumberDto.java similarity index 79% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapGoalRoomNumberDto.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapGoalRoomNumberDto.java index da159eeb4..d43ffcbe6 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapGoalRoomNumberDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapGoalRoomNumberDto.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap; +package co.kirikiri.roadmap.service.dto; public record RoadmapGoalRoomNumberDto( long recruitedGoalRoomNumber, diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapGoalRoomsOrderTypeDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapGoalRoomsOrderTypeDto.java similarity index 86% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapGoalRoomsOrderTypeDto.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapGoalRoomsOrderTypeDto.java index f8688c26f..380421705 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapGoalRoomsOrderTypeDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapGoalRoomsOrderTypeDto.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap; +package co.kirikiri.roadmap.service.dto; public enum RoadmapGoalRoomsOrderTypeDto { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapNodeDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapNodeDto.java similarity index 79% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapNodeDto.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapNodeDto.java index c0d4cc164..8a0fc107a 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapNodeDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapNodeDto.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap; +package co.kirikiri.roadmap.service.dto; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapNodeSaveDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapNodeSaveDto.java similarity index 83% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapNodeSaveDto.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapNodeSaveDto.java index 474aab738..83342d7c1 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapNodeSaveDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapNodeSaveDto.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap; +package co.kirikiri.roadmap.service.dto; import co.kirikiri.service.dto.FileInformation; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapReviewDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapReviewDto.java similarity index 78% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapReviewDto.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapReviewDto.java index 89ef43983..f339fefae 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapReviewDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapReviewDto.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap; +package co.kirikiri.roadmap.service.dto; import co.kirikiri.domain.member.Member; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapReviewReadDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapReviewReadDto.java similarity index 85% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapReviewReadDto.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapReviewReadDto.java index 40ac375eb..9c21ffbb5 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapReviewReadDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapReviewReadDto.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap; +package co.kirikiri.roadmap.service.dto; import co.kirikiri.service.dto.member.MemberDto; import java.time.LocalDateTime; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapSaveDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapSaveDto.java similarity index 75% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapSaveDto.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapSaveDto.java index 448326df7..422b2e1de 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapSaveDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapSaveDto.java @@ -1,6 +1,6 @@ -package co.kirikiri.service.dto.roadmap; +package co.kirikiri.roadmap.service.dto; -import co.kirikiri.service.dto.roadmap.request.RoadmapDifficultyType; +import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; import java.util.List; public record RoadmapSaveDto( diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapTagDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapTagDto.java similarity index 64% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapTagDto.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapTagDto.java index bb3251790..746d74e14 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapTagDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapTagDto.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap; +package co.kirikiri.roadmap.service.dto; public record RoadmapTagDto( Long id, diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapTagSaveDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapTagSaveDto.java similarity index 59% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapTagSaveDto.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapTagSaveDto.java index fa8d75256..9d0525427 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/RoadmapTagSaveDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapTagSaveDto.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap; +package co.kirikiri.roadmap.service.dto; public record RoadmapTagSaveDto( String name diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapCategorySaveRequest.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapCategorySaveRequest.java similarity index 80% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapCategorySaveRequest.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapCategorySaveRequest.java index 5a107d70a..feb260c9e 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapCategorySaveRequest.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapCategorySaveRequest.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.request; +package co.kirikiri.roadmap.service.dto.request; import jakarta.validation.constraints.NotBlank; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapDifficultyType.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapDifficultyType.java similarity index 69% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapDifficultyType.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapDifficultyType.java index 9a3ac701f..1d5a0e37d 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapDifficultyType.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapDifficultyType.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.request; +package co.kirikiri.roadmap.service.dto.request; public enum RoadmapDifficultyType { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapNodeSaveRequest.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapNodeSaveRequest.java similarity index 93% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapNodeSaveRequest.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapNodeSaveRequest.java index 863c876db..d3c07b2c0 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapNodeSaveRequest.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapNodeSaveRequest.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.request; +package co.kirikiri.roadmap.service.dto.request; import jakarta.validation.constraints.NotBlank; import lombok.AllArgsConstructor; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapOrderTypeRequest.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapOrderTypeRequest.java similarity index 87% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapOrderTypeRequest.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapOrderTypeRequest.java index d195dae6a..0d51fec0d 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapOrderTypeRequest.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapOrderTypeRequest.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.request; +package co.kirikiri.roadmap.service.dto.request; public enum RoadmapOrderTypeRequest { LATEST("최신순"), diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapReviewSaveRequest.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapReviewSaveRequest.java similarity index 80% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapReviewSaveRequest.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapReviewSaveRequest.java index 9d29c0337..33dadbf0f 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapReviewSaveRequest.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapReviewSaveRequest.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.request; +package co.kirikiri.roadmap.service.dto.request; import jakarta.validation.constraints.NotNull; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapSaveRequest.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapSaveRequest.java similarity index 95% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapSaveRequest.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapSaveRequest.java index c58a272c0..caddb4a6f 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapSaveRequest.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapSaveRequest.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.request; +package co.kirikiri.roadmap.service.dto.request; import jakarta.validation.Valid; import jakarta.validation.constraints.NotBlank; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapSearchRequest.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapSearchRequest.java similarity index 71% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapSearchRequest.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapSearchRequest.java index e19832c48..e311f9b7a 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapSearchRequest.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapSearchRequest.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.request; +package co.kirikiri.roadmap.service.dto.request; public record RoadmapSearchRequest( String roadmapTitle, diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapTagSaveRequest.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapTagSaveRequest.java similarity index 57% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapTagSaveRequest.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapTagSaveRequest.java index 52be91ad0..39c183e27 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/request/RoadmapTagSaveRequest.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/request/RoadmapTagSaveRequest.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.request; +package co.kirikiri.roadmap.service.dto.request; public record RoadmapTagSaveRequest( String name diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/MemberRoadmapResponse.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/MemberRoadmapResponse.java similarity index 82% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/MemberRoadmapResponse.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/MemberRoadmapResponse.java index a8dc55c8b..7eeaa513f 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/MemberRoadmapResponse.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/MemberRoadmapResponse.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.response; +package co.kirikiri.roadmap.service.dto.response; import java.time.LocalDateTime; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/MemberRoadmapResponses.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/MemberRoadmapResponses.java similarity index 73% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/MemberRoadmapResponses.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/MemberRoadmapResponses.java index 7c9620776..a4afe3d1c 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/MemberRoadmapResponses.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/MemberRoadmapResponses.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.response; +package co.kirikiri.roadmap.service.dto.response; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapCategoryResponse.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapCategoryResponse.java similarity index 62% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapCategoryResponse.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapCategoryResponse.java index d2660dd97..0bd6cd26c 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapCategoryResponse.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapCategoryResponse.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.response; +package co.kirikiri.roadmap.service.dto.response; public record RoadmapCategoryResponse( long id, diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapContentResponse.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapContentResponse.java similarity index 75% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapContentResponse.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapContentResponse.java index 41ca642cc..3ec43381e 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapContentResponse.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapContentResponse.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.response; +package co.kirikiri.roadmap.service.dto.response; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapForListResponse.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapForListResponse.java similarity index 90% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapForListResponse.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapForListResponse.java index b0ad3d37e..baf8cfcfa 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapForListResponse.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapForListResponse.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.response; +package co.kirikiri.roadmap.service.dto.response; import co.kirikiri.service.dto.member.response.MemberResponse; import java.time.LocalDateTime; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapForListResponses.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapForListResponses.java similarity index 74% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapForListResponses.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapForListResponses.java index 161eb8be6..590926e2a 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapForListResponses.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapForListResponses.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.response; +package co.kirikiri.roadmap.service.dto.response; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapGoalRoomResponse.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapGoalRoomResponse.java similarity index 90% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapGoalRoomResponse.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapGoalRoomResponse.java index 2d63964e5..c5af7d633 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapGoalRoomResponse.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapGoalRoomResponse.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.response; +package co.kirikiri.roadmap.service.dto.response; import co.kirikiri.domain.goalroom.GoalRoomStatus; import co.kirikiri.service.dto.member.response.MemberResponse; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapGoalRoomResponses.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapGoalRoomResponses.java similarity index 74% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapGoalRoomResponses.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapGoalRoomResponses.java index 1bb5df0dd..9ead3b603 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapGoalRoomResponses.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapGoalRoomResponses.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.response; +package co.kirikiri.roadmap.service.dto.response; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapNodeResponse.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapNodeResponse.java similarity index 76% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapNodeResponse.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapNodeResponse.java index 2fe654d34..a604481bb 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapNodeResponse.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapNodeResponse.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.response; +package co.kirikiri.roadmap.service.dto.response; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapResponse.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapResponse.java similarity index 92% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapResponse.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapResponse.java index 3286b0df2..57ed9b5e0 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapResponse.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapResponse.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.response; +package co.kirikiri.roadmap.service.dto.response; import co.kirikiri.service.dto.member.response.MemberResponse; import java.time.LocalDateTime; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapReviewResponse.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapReviewResponse.java similarity index 84% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapReviewResponse.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapReviewResponse.java index 956143b7c..e9e9343d9 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapReviewResponse.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapReviewResponse.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.response; +package co.kirikiri.roadmap.service.dto.response; import co.kirikiri.service.dto.member.response.MemberResponse; import java.time.LocalDateTime; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapTagResponse.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapTagResponse.java similarity index 61% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapTagResponse.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapTagResponse.java index 9fc072030..1b192d18f 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapTagResponse.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapTagResponse.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto.roadmap.response; +package co.kirikiri.roadmap.service.dto.response; public record RoadmapTagResponse( Long id, diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/event/RoadmapCreateEvent.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/event/RoadmapCreateEvent.java new file mode 100644 index 000000000..cc6f142e8 --- /dev/null +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/event/RoadmapCreateEvent.java @@ -0,0 +1,11 @@ +package co.kirikiri.roadmap.service.event; + +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.service.dto.RoadmapSaveDto; + +public record RoadmapCreateEvent( + Roadmap roadmap, + RoadmapSaveDto roadmapSaveDto +) { + +} diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/RoadmapMapper.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java similarity index 82% rename from backend/kirikiri/src/main/java/co/kirikiri/service/mapper/RoadmapMapper.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java index a5efc4376..1064fb618 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/RoadmapMapper.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java @@ -1,49 +1,51 @@ -package co.kirikiri.service.mapper; +package co.kirikiri.roadmap.service.mapper; import co.kirikiri.domain.member.Member; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; import co.kirikiri.persistence.dto.RoadmapOrderType; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.service.dto.RoadmapCategoryDto; +import co.kirikiri.roadmap.service.dto.RoadmapContentDto; +import co.kirikiri.roadmap.service.dto.RoadmapDto; +import co.kirikiri.roadmap.service.dto.RoadmapForListDto; +import co.kirikiri.roadmap.service.dto.RoadmapForListScrollDto; +import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomNumberDto; +import co.kirikiri.roadmap.service.dto.RoadmapNodeDto; +import co.kirikiri.roadmap.service.dto.RoadmapNodeSaveDto; +import co.kirikiri.roadmap.service.dto.RoadmapReviewDto; +import co.kirikiri.roadmap.service.dto.RoadmapReviewReadDto; +import co.kirikiri.roadmap.service.dto.RoadmapSaveDto; +import co.kirikiri.roadmap.service.dto.RoadmapTagDto; +import co.kirikiri.roadmap.service.dto.RoadmapTagSaveDto; +import co.kirikiri.roadmap.service.dto.request.RoadmapCategorySaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapOrderTypeRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapTagSaveRequest; +import co.kirikiri.roadmap.service.dto.response.MemberRoadmapResponse; +import co.kirikiri.roadmap.service.dto.response.MemberRoadmapResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapCategoryResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapContentResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapForListResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapForListResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapNodeResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapTagResponse; import co.kirikiri.service.dto.FileInformation; import co.kirikiri.service.dto.member.MemberDto; import co.kirikiri.service.dto.member.response.MemberResponse; -import co.kirikiri.service.dto.roadmap.RoadmapCategoryDto; -import co.kirikiri.service.dto.roadmap.RoadmapContentDto; -import co.kirikiri.service.dto.roadmap.RoadmapDto; -import co.kirikiri.service.dto.roadmap.RoadmapForListDto; -import co.kirikiri.service.dto.roadmap.RoadmapForListScrollDto; -import co.kirikiri.service.dto.roadmap.RoadmapGoalRoomNumberDto; -import co.kirikiri.service.dto.roadmap.RoadmapNodeDto; -import co.kirikiri.service.dto.roadmap.RoadmapNodeSaveDto; -import co.kirikiri.service.dto.roadmap.RoadmapReviewDto; -import co.kirikiri.service.dto.roadmap.RoadmapReviewReadDto; -import co.kirikiri.service.dto.roadmap.RoadmapSaveDto; -import co.kirikiri.service.dto.roadmap.RoadmapTagDto; -import co.kirikiri.service.dto.roadmap.RoadmapTagSaveDto; -import co.kirikiri.service.dto.roadmap.request.RoadmapCategorySaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapNodeSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapOrderTypeRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapReviewSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapTagSaveRequest; -import co.kirikiri.service.dto.roadmap.response.MemberRoadmapResponse; -import co.kirikiri.service.dto.roadmap.response.MemberRoadmapResponses; -import co.kirikiri.service.dto.roadmap.response.RoadmapCategoryResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapContentResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapForListResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapForListResponses; -import co.kirikiri.service.dto.roadmap.response.RoadmapNodeResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapReviewResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapTagResponse; import co.kirikiri.service.exception.ServerException; -import java.io.IOException; -import java.util.Collections; -import java.util.List; +import co.kirikiri.service.mapper.ScrollResponseMapper; import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.springframework.web.multipart.MultipartFile; +import java.io.IOException; +import java.util.Collections; +import java.util.List; + @NoArgsConstructor(access = AccessLevel.PRIVATE) public final class RoadmapMapper { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/scheduler/RoadmapScheduler.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java similarity index 90% rename from backend/kirikiri/src/main/java/co/kirikiri/service/scheduler/RoadmapScheduler.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java index 92af456a9..f4d6db089 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/scheduler/RoadmapScheduler.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java @@ -1,10 +1,10 @@ -package co.kirikiri.service.scheduler; +package co.kirikiri.roadmap.service.scheduler; import co.kirikiri.domain.goalroom.GoalRoom; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapStatus; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapStatus; import co.kirikiri.persistence.goalroom.GoalRoomRepository; -import co.kirikiri.persistence.roadmap.RoadmapRepository; +import co.kirikiri.roadmap.persistence.RoadmapRepository; import co.kirikiri.service.aop.ExceptionConvert; import java.util.List; import lombok.RequiredArgsConstructor; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/event/RoadmapCreateEvent.java b/backend/kirikiri/src/main/java/co/kirikiri/service/event/RoadmapCreateEvent.java deleted file mode 100644 index d0e3d129c..000000000 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/event/RoadmapCreateEvent.java +++ /dev/null @@ -1,11 +0,0 @@ -package co.kirikiri.service.event; - -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.service.dto.roadmap.RoadmapSaveDto; - -public record RoadmapCreateEvent( - Roadmap roadmap, - RoadmapSaveDto roadmapSaveDto -) { - -} diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomCreateService.java b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomCreateService.java index 7e34b03ea..4a9984b53 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomCreateService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomCreateService.java @@ -12,15 +12,15 @@ import co.kirikiri.domain.goalroom.vo.Period; import co.kirikiri.domain.member.Member; import co.kirikiri.domain.member.vo.Identifier; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapNode; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.persistence.goalroom.CheckFeedRepository; import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; import co.kirikiri.persistence.goalroom.GoalRoomRepository; import co.kirikiri.persistence.goalroom.GoalRoomToDoCheckRepository; import co.kirikiri.persistence.member.MemberRepository; -import co.kirikiri.persistence.roadmap.RoadmapContentRepository; +import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.service.FilePathGenerator; import co.kirikiri.service.FileService; import co.kirikiri.service.ImageDirType; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomReadService.java b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomReadService.java index 09480bbef..84dd262a5 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomReadService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomReadService.java @@ -11,7 +11,7 @@ import co.kirikiri.domain.goalroom.GoalRoomToDos; import co.kirikiri.domain.member.Member; import co.kirikiri.domain.member.vo.Identifier; -import co.kirikiri.domain.roadmap.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.persistence.goalroom.CheckFeedRepository; import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; import co.kirikiri.persistence.goalroom.GoalRoomPendingMemberRepository; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/GoalRoomMapper.java b/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/GoalRoomMapper.java index a7a7fdef6..2dde127c7 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/GoalRoomMapper.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/GoalRoomMapper.java @@ -42,10 +42,10 @@ import co.kirikiri.service.dto.member.response.MemberGoalRoomForListResponse; import co.kirikiri.service.dto.member.response.MemberGoalRoomResponse; import co.kirikiri.service.dto.member.response.MemberResponse; -import co.kirikiri.service.dto.roadmap.RoadmapGoalRoomNumberDto; -import co.kirikiri.service.dto.roadmap.RoadmapGoalRoomsOrderTypeDto; -import co.kirikiri.service.dto.roadmap.response.RoadmapGoalRoomResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapGoalRoomResponses; +import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomNumberDto; +import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomsOrderTypeDto; +import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; import co.kirikiri.service.exception.ServerException; import java.io.IOException; import java.time.LocalDate; diff --git a/backend/kirikiri/src/main/resources/properties b/backend/kirikiri/src/main/resources/properties index 2fdc5b50c..2a724a7f4 160000 --- a/backend/kirikiri/src/main/resources/properties +++ b/backend/kirikiri/src/main/resources/properties @@ -1 +1 @@ -Subproject commit 2fdc5b50cd9c5095f16c7b28ad1275c60289f930 +Subproject commit 2a724a7f4b45163a35cf72ab579444baa063316f diff --git a/backend/kirikiri/src/test/java/co/kirikiri/common/resolver/RoadmapSaveArgumentResolverTest.java b/backend/kirikiri/src/test/java/co/kirikiri/common/resolver/RoadmapSaveArgumentResolverTest.java index 80973fc0f..5b22e1772 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/common/resolver/RoadmapSaveArgumentResolverTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/common/resolver/RoadmapSaveArgumentResolverTest.java @@ -5,7 +5,7 @@ import static org.mockito.Mockito.when; import co.kirikiri.service.dto.member.request.MemberJoinRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; import co.kirikiri.service.exception.BadRequestException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/controller/RoadmapCreateApiTest.java b/backend/kirikiri/src/test/java/co/kirikiri/controller/RoadmapCreateApiTest.java index 04f4a8d19..1041893d6 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/controller/RoadmapCreateApiTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/controller/RoadmapCreateApiTest.java @@ -25,20 +25,21 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import co.kirikiri.controller.helper.ControllerTestHelper; +import co.kirikiri.roadmap.controller.RoadmapController; import co.kirikiri.service.dto.ErrorResponse; -import co.kirikiri.service.dto.roadmap.request.RoadmapCategorySaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapDifficultyType; -import co.kirikiri.service.dto.roadmap.request.RoadmapNodeSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapReviewSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapTagSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapCategorySaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; +import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapTagSaveRequest; import co.kirikiri.service.exception.AuthenticationException; import co.kirikiri.service.exception.BadRequestException; import co.kirikiri.service.exception.ConflictException; import co.kirikiri.service.exception.ForbiddenException; import co.kirikiri.service.exception.NotFoundException; -import co.kirikiri.service.roadmap.RoadmapCreateService; -import co.kirikiri.service.roadmap.RoadmapReadService; +import co.kirikiri.roadmap.service.RoadmapCreateService; +import co.kirikiri.roadmap.service.RoadmapReadService; import com.fasterxml.jackson.core.type.TypeReference; import java.util.ArrayList; import java.util.List; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/controller/RoadmapReadApiTest.java b/backend/kirikiri/src/test/java/co/kirikiri/controller/RoadmapReadApiTest.java index ceda742a1..0696fe1d7 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/controller/RoadmapReadApiTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/controller/RoadmapReadApiTest.java @@ -18,26 +18,27 @@ import co.kirikiri.controller.helper.ControllerTestHelper; import co.kirikiri.domain.goalroom.GoalRoomStatus; -import co.kirikiri.domain.roadmap.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.RoadmapDifficulty; +import co.kirikiri.roadmap.controller.RoadmapController; import co.kirikiri.service.dto.CustomScrollRequest; import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.member.response.MemberResponse; -import co.kirikiri.service.dto.roadmap.request.RoadmapOrderTypeRequest; -import co.kirikiri.service.dto.roadmap.response.MemberRoadmapResponse; -import co.kirikiri.service.dto.roadmap.response.MemberRoadmapResponses; -import co.kirikiri.service.dto.roadmap.response.RoadmapCategoryResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapContentResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapForListResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapForListResponses; -import co.kirikiri.service.dto.roadmap.response.RoadmapGoalRoomResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapGoalRoomResponses; -import co.kirikiri.service.dto.roadmap.response.RoadmapNodeResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapReviewResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapTagResponse; +import co.kirikiri.roadmap.service.dto.request.RoadmapOrderTypeRequest; +import co.kirikiri.roadmap.service.dto.response.MemberRoadmapResponse; +import co.kirikiri.roadmap.service.dto.response.MemberRoadmapResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapCategoryResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapContentResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapForListResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapForListResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapNodeResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapTagResponse; import co.kirikiri.service.exception.NotFoundException; -import co.kirikiri.service.roadmap.RoadmapCreateService; -import co.kirikiri.service.roadmap.RoadmapReadService; +import co.kirikiri.roadmap.service.RoadmapCreateService; +import co.kirikiri.roadmap.service.RoadmapReadService; import com.fasterxml.jackson.core.type.TypeReference; import java.time.LocalDate; import java.time.LocalDateTime; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMemberTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMemberTest.java index 78a675c65..7e3714151 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMemberTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMemberTest.java @@ -11,7 +11,7 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapContent; import org.junit.jupiter.api.Test; import java.time.LocalDateTime; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembersTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembersTest.java index bcb18de45..7671004cc 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembersTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembersTest.java @@ -11,7 +11,7 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapContent; import java.time.LocalDateTime; import java.util.List; import org.junit.jupiter.api.Test; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodeTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodeTest.java index 51a8d6208..304dec2a8 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodeTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodeTest.java @@ -6,7 +6,7 @@ import co.kirikiri.domain.goalroom.exception.GoalRoomException; import co.kirikiri.domain.goalroom.vo.Period; -import co.kirikiri.domain.roadmap.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNode; import java.time.LocalDate; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodesTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodesTest.java index 3743814ba..b0b93abd9 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodesTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodesTest.java @@ -7,7 +7,7 @@ import co.kirikiri.domain.goalroom.exception.GoalRoomException; import co.kirikiri.domain.goalroom.vo.Period; -import co.kirikiri.domain.roadmap.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNode; import java.time.LocalDate; import java.util.ArrayList; import java.util.Collections; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomTest.java index 8459bd4d1..81fa94092 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomTest.java @@ -15,14 +15,14 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapContents; -import co.kirikiri.domain.roadmap.RoadmapDifficulty; -import co.kirikiri.domain.roadmap.RoadmapNode; -import co.kirikiri.domain.roadmap.RoadmapNodeImages; -import co.kirikiri.domain.roadmap.RoadmapNodes; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapContents; +import co.kirikiri.roadmap.domain.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodeImages; +import co.kirikiri.roadmap.domain.RoadmapNodes; import java.time.LocalDate; import java.util.Collections; import java.util.List; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapCategoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapCategoryTest.java index 726de9855..20c59c7ea 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapCategoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapCategoryTest.java @@ -3,7 +3,8 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import co.kirikiri.domain.roadmap.exception.RoadmapException; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.exception.RoadmapException; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapContentTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapContentTest.java index 4a663ac40..5aa1e6c33 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapContentTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapContentTest.java @@ -1,6 +1,6 @@ package co.kirikiri.domain.roadmap; -import static co.kirikiri.domain.roadmap.RoadmapDifficulty.DIFFICULT; +import static co.kirikiri.roadmap.domain.RoadmapDifficulty.DIFFICULT; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertAll; @@ -13,7 +13,12 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.exception.RoadmapException; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodes; +import co.kirikiri.roadmap.domain.exception.RoadmapException; import java.util.List; import org.junit.jupiter.api.Test; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapContentsTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapContentsTest.java index a9e9113f9..6fb70baaf 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapContentsTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapContentsTest.java @@ -2,6 +2,10 @@ import static org.assertj.core.api.Assertions.assertThat; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapContents; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodes; import org.junit.jupiter.api.Test; import java.util.List; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodeImagesTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodeImagesTest.java index d5aab01ae..1c65d6c4d 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodeImagesTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodeImagesTest.java @@ -4,7 +4,9 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import co.kirikiri.domain.ImageContentType; -import co.kirikiri.domain.roadmap.exception.RoadmapException; +import co.kirikiri.roadmap.domain.RoadmapNodeImage; +import co.kirikiri.roadmap.domain.RoadmapNodeImages; +import co.kirikiri.roadmap.domain.exception.RoadmapException; import java.util.List; import org.junit.jupiter.api.Test; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodeTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodeTest.java index 97ae660fc..353817bf7 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodeTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodeTest.java @@ -2,7 +2,8 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; -import co.kirikiri.domain.roadmap.exception.RoadmapException; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.exception.RoadmapException; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodesTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodesTest.java index e8c06eecc..0cf698575 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodesTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodesTest.java @@ -3,6 +3,9 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertAll; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodes; import org.junit.jupiter.api.Test; import java.util.List; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapReviewTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapReviewTest.java index 0e7dcd492..63ad2a2c6 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapReviewTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapReviewTest.java @@ -11,7 +11,8 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.exception.RoadmapException; +import co.kirikiri.roadmap.domain.RoadmapReview; +import co.kirikiri.roadmap.domain.exception.RoadmapException; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapTagsTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapTagsTest.java index 76ba65ba5..9ed0db9f2 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapTagsTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapTagsTest.java @@ -4,8 +4,10 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import co.kirikiri.domain.roadmap.exception.RoadmapException; -import co.kirikiri.domain.roadmap.vo.RoadmapTagName; +import co.kirikiri.roadmap.domain.RoadmapTag; +import co.kirikiri.roadmap.domain.RoadmapTags; +import co.kirikiri.roadmap.domain.exception.RoadmapException; +import co.kirikiri.roadmap.domain.vo.RoadmapTagName; import java.util.List; import org.junit.jupiter.api.Test; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapTest.java index cea624848..30e81411d 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapTest.java @@ -1,6 +1,6 @@ package co.kirikiri.domain.roadmap; -import static co.kirikiri.domain.roadmap.RoadmapDifficulty.DIFFICULT; +import static co.kirikiri.roadmap.domain.RoadmapDifficulty.DIFFICULT; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; @@ -12,7 +12,13 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.exception.RoadmapException; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapContents; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodes; +import co.kirikiri.roadmap.domain.exception.RoadmapException; import java.util.List; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/vo/RoadmapTagNameTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/vo/RoadmapTagNameTest.java index d563697df..99b1b4f31 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/vo/RoadmapTagNameTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/vo/RoadmapTagNameTest.java @@ -4,7 +4,8 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import co.kirikiri.domain.roadmap.exception.RoadmapException; +import co.kirikiri.roadmap.domain.exception.RoadmapException; +import co.kirikiri.roadmap.domain.vo.RoadmapTagName; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.ValueSource; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomCreateIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomCreateIntegrationTest.java index b1f922460..c5ad956bf 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomCreateIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomCreateIntegrationTest.java @@ -44,8 +44,8 @@ import co.kirikiri.service.dto.member.request.MemberJoinRequest; import co.kirikiri.service.dto.member.response.MemberGoalRoomResponse; import co.kirikiri.service.dto.member.response.MemberInformationResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapGoalRoomResponses; -import co.kirikiri.service.dto.roadmap.response.RoadmapResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import com.fasterxml.jackson.core.JsonProcessingException; import io.restassured.common.mapper.TypeRef; import io.restassured.response.ExtractableResponse; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomReadIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomReadIntegrationTest.java index bed2603b5..9772331fa 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomReadIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomReadIntegrationTest.java @@ -54,11 +54,11 @@ import co.kirikiri.service.dto.member.request.MemberJoinRequest; import co.kirikiri.service.dto.member.response.MemberGoalRoomForListResponse; import co.kirikiri.service.dto.member.response.MemberGoalRoomResponse; -import co.kirikiri.service.dto.roadmap.request.RoadmapDifficultyType; -import co.kirikiri.service.dto.roadmap.request.RoadmapNodeSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapSaveRequest; -import co.kirikiri.service.dto.roadmap.response.RoadmapGoalRoomResponses; -import co.kirikiri.service.dto.roadmap.response.RoadmapResponse; +import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; +import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; +import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import com.fasterxml.jackson.core.type.TypeReference; import io.restassured.common.mapper.TypeRef; import io.restassured.response.ExtractableResponse; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomSchedulerIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomSchedulerIntegrationTest.java index f4f5e9399..86d0854b6 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomSchedulerIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomSchedulerIntegrationTest.java @@ -32,7 +32,7 @@ import co.kirikiri.service.dto.member.request.GenderType; import co.kirikiri.service.dto.member.request.MemberJoinRequest; import co.kirikiri.service.dto.member.response.MemberGoalRoomResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.service.scheduler.GoalRoomScheduler; import java.io.IOException; import java.util.List; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapCreateIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapCreateIntegrationTest.java index 32e6b9023..fd0b3572c 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapCreateIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapCreateIntegrationTest.java @@ -17,11 +17,11 @@ import co.kirikiri.service.dto.auth.request.LoginRequest; import co.kirikiri.service.dto.member.request.GenderType; import co.kirikiri.service.dto.member.request.MemberJoinRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapCategorySaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapDifficultyType; -import co.kirikiri.service.dto.roadmap.request.RoadmapNodeSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapTagSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapCategorySaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; +import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapTagSaveRequest; import io.restassured.common.mapper.TypeRef; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadIntegrationTest.java index e51683df5..582602e94 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadIntegrationTest.java @@ -13,19 +13,19 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertAll; -import co.kirikiri.domain.roadmap.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.integration.helper.InitIntegrationTest; import co.kirikiri.persistence.dto.RoadmapOrderType; import co.kirikiri.service.dto.ErrorResponse; -import co.kirikiri.service.dto.roadmap.request.RoadmapDifficultyType; -import co.kirikiri.service.dto.roadmap.request.RoadmapNodeSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapTagSaveRequest; -import co.kirikiri.service.dto.roadmap.response.MemberRoadmapResponses; -import co.kirikiri.service.dto.roadmap.response.RoadmapCategoryResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapForListResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapForListResponses; -import co.kirikiri.service.dto.roadmap.response.RoadmapResponse; +import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; +import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapTagSaveRequest; +import co.kirikiri.roadmap.service.dto.response.MemberRoadmapResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapCategoryResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapForListResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapForListResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import io.restassured.common.mapper.TypeRef; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadOrderIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadOrderIntegrationTest.java index ddd207f71..787365448 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadOrderIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadOrderIntegrationTest.java @@ -19,19 +19,19 @@ import static org.assertj.core.api.Assertions.assertThat; import co.kirikiri.domain.goalroom.GoalRoom; -import co.kirikiri.domain.roadmap.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.integration.helper.InitIntegrationTest; import co.kirikiri.persistence.dto.RoadmapOrderType; import co.kirikiri.service.dto.goalroom.request.GoalRoomCreateRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomRoadmapNodeRequest; import co.kirikiri.service.dto.member.response.MemberInformationResponse; -import co.kirikiri.service.dto.roadmap.request.RoadmapDifficultyType; -import co.kirikiri.service.dto.roadmap.request.RoadmapNodeSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapReviewSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapTagSaveRequest; -import co.kirikiri.service.dto.roadmap.response.RoadmapForListResponses; -import co.kirikiri.service.dto.roadmap.response.RoadmapResponse; +import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; +import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapTagSaveRequest; +import co.kirikiri.roadmap.service.dto.response.RoadmapForListResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import io.restassured.common.mapper.TypeRef; import java.io.IOException; import java.util.List; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewCreateIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewCreateIntegrationTest.java index 3f5784e8a..7eb747946 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewCreateIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewCreateIntegrationTest.java @@ -8,7 +8,6 @@ import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_노드_인증_횟수; import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_이름; import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_제한_인원; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_투두_컨텐츠; import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_EMAIL; import static co.kirikiri.integration.fixture.MemberAPIFixture.요청을_받는_사용자_자신의_정보_조회_요청; import static co.kirikiri.integration.fixture.MemberAPIFixture.회원가입; @@ -26,8 +25,8 @@ import co.kirikiri.service.dto.member.request.GenderType; import co.kirikiri.service.dto.member.request.MemberJoinRequest; import co.kirikiri.service.dto.member.response.MemberInformationResponse; -import co.kirikiri.service.dto.roadmap.request.RoadmapReviewSaveRequest; -import co.kirikiri.service.dto.roadmap.response.RoadmapResponse; +import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import io.restassured.common.mapper.TypeRef; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewReadIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewReadIntegrationTest.java index ba7dd7fea..05d9d0bff 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewReadIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewReadIntegrationTest.java @@ -21,9 +21,9 @@ import co.kirikiri.service.dto.member.request.MemberJoinRequest; import co.kirikiri.service.dto.member.response.MemberInformationResponse; import co.kirikiri.service.dto.member.response.MemberResponse; -import co.kirikiri.service.dto.roadmap.request.RoadmapReviewSaveRequest; -import co.kirikiri.service.dto.roadmap.response.RoadmapResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapReviewResponse; +import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import io.restassured.common.mapper.TypeRef; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapSchedulerIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapSchedulerIntegrationTest.java index a5a3e83f4..b4d8131b2 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapSchedulerIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapSchedulerIntegrationTest.java @@ -13,11 +13,11 @@ import co.kirikiri.domain.goalroom.GoalRoomStatus; import co.kirikiri.integration.helper.InitIntegrationTest; -import co.kirikiri.persistence.roadmap.RoadmapRepository; -import co.kirikiri.service.scheduler.RoadmapScheduler; +import co.kirikiri.roadmap.persistence.RoadmapRepository; +import co.kirikiri.roadmap.service.scheduler.RoadmapScheduler; import co.kirikiri.service.dto.goalroom.request.GoalRoomCreateRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomRoadmapNodeRequest; -import co.kirikiri.service.dto.roadmap.response.RoadmapResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import org.junit.jupiter.api.Test; import java.io.IOException; import java.time.LocalDate; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapSearchIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapSearchIntegrationTest.java index 0f763186e..a1a28e634 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapSearchIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapSearchIntegrationTest.java @@ -9,11 +9,11 @@ import co.kirikiri.integration.helper.InitIntegrationTest; import co.kirikiri.service.dto.member.response.MemberInformationResponse; -import co.kirikiri.service.dto.roadmap.request.RoadmapDifficultyType; -import co.kirikiri.service.dto.roadmap.request.RoadmapNodeSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapTagSaveRequest; -import co.kirikiri.service.dto.roadmap.response.RoadmapForListResponses; +import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; +import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapTagSaveRequest; +import co.kirikiri.roadmap.service.dto.response.RoadmapForListResponses; import io.restassured.common.mapper.TypeRef; import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/GoalRoomAPIFixture.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/GoalRoomAPIFixture.java index 500761b69..d46cf6cef 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/GoalRoomAPIFixture.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/GoalRoomAPIFixture.java @@ -10,7 +10,7 @@ import co.kirikiri.service.dto.goalroom.request.GoalRoomRoadmapNodeRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomTodoRequest; import co.kirikiri.service.dto.member.response.MemberGoalRoomResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import io.restassured.common.mapper.TypeRef; import io.restassured.http.Header; import io.restassured.response.ExtractableResponse; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java index 0acc14aae..a6109bd48 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java @@ -4,14 +4,14 @@ import static co.kirikiri.integration.fixture.CommonFixture.AUTHORIZATION; import static io.restassured.RestAssured.given; -import co.kirikiri.domain.roadmap.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.persistence.dto.RoadmapOrderType; import co.kirikiri.service.dto.CustomScrollRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapCategorySaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapNodeSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapReviewSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapSaveRequest; -import co.kirikiri.service.dto.roadmap.response.RoadmapResponse; +import co.kirikiri.roadmap.service.dto.request.RoadmapCategorySaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import io.restassured.response.ExtractableResponse; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/InitIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/InitIntegrationTest.java index 28b448b74..243e577e3 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/InitIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/InitIntegrationTest.java @@ -5,11 +5,11 @@ import static co.kirikiri.integration.fixture.MemberAPIFixture.기본_회원가입; import static co.kirikiri.integration.fixture.RoadmapAPIFixture.카테고리_생성; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.service.dto.roadmap.request.RoadmapDifficultyType; -import co.kirikiri.service.dto.roadmap.request.RoadmapNodeSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapTagSaveRequest; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; +import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapTagSaveRequest; import org.junit.jupiter.api.BeforeEach; import java.util.List; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestTransactionService.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestTransactionService.java index accf118e2..931f68b14 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestTransactionService.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestTransactionService.java @@ -25,7 +25,7 @@ import co.kirikiri.service.dto.goalroom.request.GoalRoomCreateRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomRoadmapNodeRequest; import co.kirikiri.service.dto.member.response.MemberInformationResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; import java.time.LocalDate; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/CheckFeedRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/CheckFeedRepositoryTest.java index f4eb535ee..b636f659b 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/CheckFeedRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/CheckFeedRepositoryTest.java @@ -21,19 +21,19 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapContents; -import co.kirikiri.domain.roadmap.RoadmapDifficulty; -import co.kirikiri.domain.roadmap.RoadmapNode; -import co.kirikiri.domain.roadmap.RoadmapNodeImage; -import co.kirikiri.domain.roadmap.RoadmapNodeImages; -import co.kirikiri.domain.roadmap.RoadmapNodes; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapContents; +import co.kirikiri.roadmap.domain.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodeImage; +import co.kirikiri.roadmap.domain.RoadmapNodeImages; +import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.persistence.helper.RepositoryTest; import co.kirikiri.persistence.member.MemberRepository; -import co.kirikiri.persistence.roadmap.RoadmapCategoryRepository; -import co.kirikiri.persistence.roadmap.RoadmapRepository; +import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; +import co.kirikiri.roadmap.persistence.RoadmapRepository; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepositoryTest.java index 5fed7fa95..50c6effcd 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepositoryTest.java @@ -19,20 +19,20 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapContents; -import co.kirikiri.domain.roadmap.RoadmapDifficulty; -import co.kirikiri.domain.roadmap.RoadmapNode; -import co.kirikiri.domain.roadmap.RoadmapNodeImage; -import co.kirikiri.domain.roadmap.RoadmapNodeImages; -import co.kirikiri.domain.roadmap.RoadmapNodes; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapContents; +import co.kirikiri.roadmap.domain.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodeImage; +import co.kirikiri.roadmap.domain.RoadmapNodeImages; +import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.persistence.goalroom.dto.GoalRoomMemberSortType; import co.kirikiri.persistence.helper.RepositoryTest; import co.kirikiri.persistence.member.MemberRepository; -import co.kirikiri.persistence.roadmap.RoadmapCategoryRepository; -import co.kirikiri.persistence.roadmap.RoadmapRepository; +import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; +import co.kirikiri.roadmap.persistence.RoadmapRepository; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepositoryTest.java index 2febbb556..a6e3421cb 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepositoryTest.java @@ -19,20 +19,20 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapContents; -import co.kirikiri.domain.roadmap.RoadmapDifficulty; -import co.kirikiri.domain.roadmap.RoadmapNode; -import co.kirikiri.domain.roadmap.RoadmapNodeImage; -import co.kirikiri.domain.roadmap.RoadmapNodeImages; -import co.kirikiri.domain.roadmap.RoadmapNodes; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapContents; +import co.kirikiri.roadmap.domain.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodeImage; +import co.kirikiri.roadmap.domain.RoadmapNodeImages; +import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.persistence.goalroom.dto.GoalRoomMemberSortType; import co.kirikiri.persistence.helper.RepositoryTest; import co.kirikiri.persistence.member.MemberRepository; -import co.kirikiri.persistence.roadmap.RoadmapCategoryRepository; -import co.kirikiri.persistence.roadmap.RoadmapRepository; +import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; +import co.kirikiri.roadmap.persistence.RoadmapRepository; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import java.time.LocalDate; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomRepositoryTest.java index 38f6fb513..6905b9e53 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomRepositoryTest.java @@ -19,17 +19,17 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapDifficulty; -import co.kirikiri.domain.roadmap.RoadmapNode; -import co.kirikiri.domain.roadmap.RoadmapNodes; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.persistence.goalroom.dto.RoadmapGoalRoomsOrderType; import co.kirikiri.persistence.helper.RepositoryTest; import co.kirikiri.persistence.member.MemberRepository; -import co.kirikiri.persistence.roadmap.RoadmapCategoryRepository; -import co.kirikiri.persistence.roadmap.RoadmapRepository; +import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; +import co.kirikiri.roadmap.persistence.RoadmapRepository; import org.junit.jupiter.api.Test; import java.time.LocalDate; import java.util.List; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepositoryTest.java index 2d7ebd328..7075330f2 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepositoryTest.java @@ -20,16 +20,16 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapDifficulty; -import co.kirikiri.domain.roadmap.RoadmapNode; -import co.kirikiri.domain.roadmap.RoadmapNodes; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.persistence.helper.RepositoryTest; import co.kirikiri.persistence.member.MemberRepository; -import co.kirikiri.persistence.roadmap.RoadmapCategoryRepository; -import co.kirikiri.persistence.roadmap.RoadmapRepository; +import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; +import co.kirikiri.roadmap.persistence.RoadmapRepository; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapContentRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapContentRepositoryTest.java index 9f6ce6a34..8dfd8bd6b 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapContentRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapContentRepositoryTest.java @@ -10,12 +10,15 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapDifficulty; import co.kirikiri.persistence.helper.RepositoryTest; import co.kirikiri.persistence.member.MemberRepository; +import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; +import co.kirikiri.roadmap.persistence.RoadmapContentRepository; +import co.kirikiri.roadmap.persistence.RoadmapRepository; import org.junit.jupiter.api.Test; @RepositoryTest diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapRepositoryTest.java index 83ab3ff56..450923f6e 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapRepositoryTest.java @@ -20,17 +20,17 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapDifficulty; -import co.kirikiri.domain.roadmap.RoadmapNode; -import co.kirikiri.domain.roadmap.RoadmapNodes; -import co.kirikiri.domain.roadmap.RoadmapReview; -import co.kirikiri.domain.roadmap.RoadmapStatus; -import co.kirikiri.domain.roadmap.RoadmapTag; -import co.kirikiri.domain.roadmap.RoadmapTags; -import co.kirikiri.domain.roadmap.vo.RoadmapTagName; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodes; +import co.kirikiri.roadmap.domain.RoadmapReview; +import co.kirikiri.roadmap.domain.RoadmapStatus; +import co.kirikiri.roadmap.domain.RoadmapTag; +import co.kirikiri.roadmap.domain.RoadmapTags; +import co.kirikiri.roadmap.domain.vo.RoadmapTagName; import co.kirikiri.persistence.dto.RoadmapOrderType; import co.kirikiri.persistence.dto.RoadmapSearchDto; import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; @@ -41,6 +41,9 @@ import java.time.LocalDateTime; import java.util.List; import java.util.Optional; + +import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; +import co.kirikiri.roadmap.persistence.RoadmapRepository; import org.junit.jupiter.api.Test; @RepositoryTest diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapReviewRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapReviewRepositoryTest.java index 099dd5fc9..0a428a301 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapReviewRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapReviewRepositoryTest.java @@ -12,15 +12,18 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapDifficulty; -import co.kirikiri.domain.roadmap.RoadmapNode; -import co.kirikiri.domain.roadmap.RoadmapNodes; -import co.kirikiri.domain.roadmap.RoadmapReview; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodes; +import co.kirikiri.roadmap.domain.RoadmapReview; import co.kirikiri.persistence.helper.RepositoryTest; import co.kirikiri.persistence.member.MemberRepository; +import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; +import co.kirikiri.roadmap.persistence.RoadmapRepository; +import co.kirikiri.roadmap.persistence.RoadmapReviewRepository; import org.junit.jupiter.api.Test; import java.util.List; import java.util.Optional; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomCreateServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomCreateServiceTest.java index b409f8ddb..33025688f 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomCreateServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomCreateServiceTest.java @@ -35,22 +35,22 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapContents; -import co.kirikiri.domain.roadmap.RoadmapDifficulty; -import co.kirikiri.domain.roadmap.RoadmapNode; -import co.kirikiri.domain.roadmap.RoadmapNodeImage; -import co.kirikiri.domain.roadmap.RoadmapNodeImages; -import co.kirikiri.domain.roadmap.RoadmapNodes; -import co.kirikiri.domain.roadmap.RoadmapStatus; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapContents; +import co.kirikiri.roadmap.domain.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodeImage; +import co.kirikiri.roadmap.domain.RoadmapNodeImages; +import co.kirikiri.roadmap.domain.RoadmapNodes; +import co.kirikiri.roadmap.domain.RoadmapStatus; import co.kirikiri.persistence.goalroom.CheckFeedRepository; import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; import co.kirikiri.persistence.goalroom.GoalRoomRepository; import co.kirikiri.persistence.goalroom.GoalRoomToDoCheckRepository; import co.kirikiri.persistence.member.MemberRepository; -import co.kirikiri.persistence.roadmap.RoadmapContentRepository; +import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.service.dto.goalroom.request.CheckFeedRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomCreateRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomRoadmapNodeRequest; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomReadServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomReadServiceTest.java index cf1452150..623fa5d51 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomReadServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomReadServiceTest.java @@ -32,15 +32,15 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapContents; -import co.kirikiri.domain.roadmap.RoadmapDifficulty; -import co.kirikiri.domain.roadmap.RoadmapNode; -import co.kirikiri.domain.roadmap.RoadmapNodeImage; -import co.kirikiri.domain.roadmap.RoadmapNodeImages; -import co.kirikiri.domain.roadmap.RoadmapNodes; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapContents; +import co.kirikiri.roadmap.domain.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodeImage; +import co.kirikiri.roadmap.domain.RoadmapNodeImages; +import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.persistence.goalroom.CheckFeedRepository; import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; import co.kirikiri.persistence.goalroom.GoalRoomPendingMemberRepository; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomSchedulerTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomSchedulerTest.java index f4118210d..cf4caa200 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomSchedulerTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomSchedulerTest.java @@ -25,15 +25,15 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapContents; -import co.kirikiri.domain.roadmap.RoadmapDifficulty; -import co.kirikiri.domain.roadmap.RoadmapNode; -import co.kirikiri.domain.roadmap.RoadmapNodeImage; -import co.kirikiri.domain.roadmap.RoadmapNodeImages; -import co.kirikiri.domain.roadmap.RoadmapNodes; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapContents; +import co.kirikiri.roadmap.domain.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodeImage; +import co.kirikiri.roadmap.domain.RoadmapNodeImages; +import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; import co.kirikiri.persistence.goalroom.GoalRoomPendingMemberRepository; import co.kirikiri.persistence.goalroom.GoalRoomRepository; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapCreateEventListenerTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapCreateEventListenerTest.java index e2ce4b915..19df3d06c 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapCreateEventListenerTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapCreateEventListenerTest.java @@ -11,22 +11,22 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapDifficulty; -import co.kirikiri.domain.roadmap.RoadmapNode; -import co.kirikiri.domain.roadmap.RoadmapNodes; -import co.kirikiri.persistence.roadmap.RoadmapContentRepository; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodes; +import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.service.dto.FileInformation; -import co.kirikiri.service.dto.roadmap.RoadmapNodeSaveDto; -import co.kirikiri.service.dto.roadmap.RoadmapSaveDto; -import co.kirikiri.service.dto.roadmap.RoadmapTagSaveDto; -import co.kirikiri.service.dto.roadmap.request.RoadmapDifficultyType; -import co.kirikiri.service.event.RoadmapCreateEvent; +import co.kirikiri.roadmap.service.dto.RoadmapNodeSaveDto; +import co.kirikiri.roadmap.service.dto.RoadmapSaveDto; +import co.kirikiri.roadmap.service.dto.RoadmapTagSaveDto; +import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; +import co.kirikiri.roadmap.service.event.RoadmapCreateEvent; import co.kirikiri.service.exception.BadRequestException; import co.kirikiri.service.exception.ServerException; -import co.kirikiri.service.roadmap.RoadmapCreateEventListener; +import co.kirikiri.roadmap.service.RoadmapCreateEventListener; import java.io.IOException; import java.util.List; import org.junit.jupiter.api.Test; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapCreateServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapCreateServiceTest.java index f0c78c42e..4ddcb9ef6 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapCreateServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapCreateServiceTest.java @@ -24,30 +24,30 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapContents; -import co.kirikiri.domain.roadmap.RoadmapDifficulty; -import co.kirikiri.domain.roadmap.RoadmapReview; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapContents; +import co.kirikiri.roadmap.domain.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.RoadmapReview; import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; import co.kirikiri.persistence.goalroom.GoalRoomRepository; import co.kirikiri.persistence.member.MemberRepository; -import co.kirikiri.persistence.roadmap.RoadmapCategoryRepository; -import co.kirikiri.persistence.roadmap.RoadmapRepository; -import co.kirikiri.persistence.roadmap.RoadmapReviewRepository; -import co.kirikiri.service.dto.roadmap.request.RoadmapCategorySaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapDifficultyType; -import co.kirikiri.service.dto.roadmap.request.RoadmapNodeSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapReviewSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapSaveRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapTagSaveRequest; +import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; +import co.kirikiri.roadmap.persistence.RoadmapRepository; +import co.kirikiri.roadmap.persistence.RoadmapReviewRepository; +import co.kirikiri.roadmap.service.dto.request.RoadmapCategorySaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; +import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapTagSaveRequest; import co.kirikiri.service.exception.AuthenticationException; import co.kirikiri.service.exception.BadRequestException; import co.kirikiri.service.exception.ConflictException; import co.kirikiri.service.exception.ForbiddenException; import co.kirikiri.service.exception.NotFoundException; -import co.kirikiri.service.roadmap.RoadmapCreateService; +import co.kirikiri.roadmap.service.RoadmapCreateService; import java.time.LocalDateTime; import java.util.Collections; import java.util.List; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapReadServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapReadServiceTest.java index d6222964e..93cdecb95 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapReadServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapReadServiceTest.java @@ -25,42 +25,42 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapDifficulty; -import co.kirikiri.domain.roadmap.RoadmapNode; -import co.kirikiri.domain.roadmap.RoadmapNodes; -import co.kirikiri.domain.roadmap.RoadmapReview; -import co.kirikiri.domain.roadmap.RoadmapTag; -import co.kirikiri.domain.roadmap.RoadmapTags; -import co.kirikiri.domain.roadmap.vo.RoadmapTagName; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodes; +import co.kirikiri.roadmap.domain.RoadmapReview; +import co.kirikiri.roadmap.domain.RoadmapTag; +import co.kirikiri.roadmap.domain.RoadmapTags; +import co.kirikiri.roadmap.domain.vo.RoadmapTagName; import co.kirikiri.persistence.goalroom.GoalRoomRepository; import co.kirikiri.persistence.goalroom.dto.RoadmapGoalRoomsOrderType; import co.kirikiri.persistence.member.MemberRepository; -import co.kirikiri.persistence.roadmap.RoadmapCategoryRepository; -import co.kirikiri.persistence.roadmap.RoadmapContentRepository; -import co.kirikiri.persistence.roadmap.RoadmapRepository; -import co.kirikiri.persistence.roadmap.RoadmapReviewRepository; +import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; +import co.kirikiri.roadmap.persistence.RoadmapContentRepository; +import co.kirikiri.roadmap.persistence.RoadmapRepository; +import co.kirikiri.roadmap.persistence.RoadmapReviewRepository; import co.kirikiri.service.dto.CustomScrollRequest; import co.kirikiri.service.dto.member.response.MemberResponse; -import co.kirikiri.service.dto.roadmap.RoadmapGoalRoomsOrderTypeDto; -import co.kirikiri.service.dto.roadmap.request.RoadmapOrderTypeRequest; -import co.kirikiri.service.dto.roadmap.request.RoadmapSearchRequest; -import co.kirikiri.service.dto.roadmap.response.MemberRoadmapResponse; -import co.kirikiri.service.dto.roadmap.response.MemberRoadmapResponses; -import co.kirikiri.service.dto.roadmap.response.RoadmapCategoryResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapContentResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapForListResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapForListResponses; -import co.kirikiri.service.dto.roadmap.response.RoadmapGoalRoomResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapGoalRoomResponses; -import co.kirikiri.service.dto.roadmap.response.RoadmapNodeResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapReviewResponse; -import co.kirikiri.service.dto.roadmap.response.RoadmapTagResponse; +import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomsOrderTypeDto; +import co.kirikiri.roadmap.service.dto.request.RoadmapOrderTypeRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapSearchRequest; +import co.kirikiri.roadmap.service.dto.response.MemberRoadmapResponse; +import co.kirikiri.roadmap.service.dto.response.MemberRoadmapResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapCategoryResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapContentResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapForListResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapForListResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapNodeResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapTagResponse; import co.kirikiri.service.exception.NotFoundException; -import co.kirikiri.service.roadmap.RoadmapReadService; +import co.kirikiri.roadmap.service.RoadmapReadService; import java.net.MalformedURLException; import java.net.URL; import java.time.LocalDate; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapSchedulerTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapSchedulerTest.java index eaea4f202..04b410fa3 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapSchedulerTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapSchedulerTest.java @@ -19,15 +19,15 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.domain.roadmap.Roadmap; -import co.kirikiri.domain.roadmap.RoadmapCategory; -import co.kirikiri.domain.roadmap.RoadmapContent; -import co.kirikiri.domain.roadmap.RoadmapDifficulty; -import co.kirikiri.domain.roadmap.RoadmapNode; -import co.kirikiri.domain.roadmap.RoadmapNodes; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.RoadmapNode; +import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.persistence.goalroom.GoalRoomRepository; -import co.kirikiri.persistence.roadmap.RoadmapRepository; -import co.kirikiri.service.scheduler.RoadmapScheduler; +import co.kirikiri.roadmap.persistence.RoadmapRepository; +import co.kirikiri.roadmap.service.scheduler.RoadmapScheduler; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; From 2ea62391c4cf149b963954503f72e8af547cd702 Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Wed, 20 Dec 2023 03:58:33 +0900 Subject: [PATCH 02/22] =?UTF-8?q?refactor:=20RoadmapCreateService=EC=97=90?= =?UTF-8?q?=EC=84=9C=20goalRoom=20=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../roadmap/controller/RoadmapController.java | 6 +- .../service/RoadmapCreateEventListener.java | 7 +- .../roadmap/service/RoadmapCreateService.java | 35 +++------ .../service/RoadmapGoalRoomService.java | 11 +++ .../service/scheduler/RoadmapScheduler.java | 5 +- .../member/RoadmapGoalRoomServiceImpl.java | 38 +++++++++ .../RoadmapSchedulerIntegrationTest.java | 20 ++--- .../service/RoadmapCreateServiceTest.java | 78 +++++++------------ 8 files changed, 104 insertions(+), 96 deletions(-) create mode 100644 backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java create mode 100644 backend/kirikiri/src/main/java/co/kirikiri/service/member/RoadmapGoalRoomServiceImpl.java diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/controller/RoadmapController.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/controller/RoadmapController.java index 0665ac534..72d9ae852 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/controller/RoadmapController.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/controller/RoadmapController.java @@ -2,7 +2,8 @@ import co.kirikiri.common.interceptor.Authenticated; import co.kirikiri.common.resolver.MemberIdentifier; -import co.kirikiri.service.dto.CustomScrollRequest; +import co.kirikiri.roadmap.service.RoadmapCreateService; +import co.kirikiri.roadmap.service.RoadmapReadService; import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomsOrderTypeDto; import co.kirikiri.roadmap.service.dto.request.RoadmapCategorySaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapOrderTypeRequest; @@ -15,8 +16,7 @@ import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; -import co.kirikiri.roadmap.service.RoadmapCreateService; -import co.kirikiri.roadmap.service.RoadmapReadService; +import co.kirikiri.service.dto.CustomScrollRequest; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateEventListener.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateEventListener.java index b1dd1e03d..f80b0ecfd 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateEventListener.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateEventListener.java @@ -7,22 +7,23 @@ import co.kirikiri.roadmap.domain.RoadmapNodeImage; import co.kirikiri.roadmap.domain.RoadmapNodeImages; import co.kirikiri.roadmap.persistence.RoadmapContentRepository; +import co.kirikiri.roadmap.service.dto.RoadmapNodeSaveDto; +import co.kirikiri.roadmap.service.event.RoadmapCreateEvent; import co.kirikiri.service.FilePathGenerator; import co.kirikiri.service.FileService; import co.kirikiri.service.ImageDirType; import co.kirikiri.service.aop.ExceptionConvert; import co.kirikiri.service.dto.FileInformation; -import co.kirikiri.roadmap.service.dto.RoadmapNodeSaveDto; -import co.kirikiri.roadmap.service.event.RoadmapCreateEvent; import co.kirikiri.service.exception.BadRequestException; import co.kirikiri.service.exception.ServerException; -import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.event.TransactionalEventListener; +import java.util.List; + @Service @RequiredArgsConstructor @ExceptionConvert diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java index 157757bfb..8218242bf 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java @@ -1,10 +1,8 @@ package co.kirikiri.roadmap.service; -import co.kirikiri.domain.goalroom.GoalRoom; -import co.kirikiri.domain.goalroom.GoalRoomMember; -import co.kirikiri.domain.goalroom.GoalRoomStatus; import co.kirikiri.domain.member.Member; import co.kirikiri.domain.member.vo.Identifier; +import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; @@ -15,13 +13,9 @@ import co.kirikiri.roadmap.domain.RoadmapTag; import co.kirikiri.roadmap.domain.RoadmapTags; import co.kirikiri.roadmap.domain.vo.RoadmapTagName; -import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; -import co.kirikiri.persistence.goalroom.GoalRoomRepository; -import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import co.kirikiri.roadmap.persistence.RoadmapReviewRepository; -import co.kirikiri.service.aop.ExceptionConvert; import co.kirikiri.roadmap.service.dto.RoadmapNodeSaveDto; import co.kirikiri.roadmap.service.dto.RoadmapReviewDto; import co.kirikiri.roadmap.service.dto.RoadmapSaveDto; @@ -30,19 +24,21 @@ import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; import co.kirikiri.roadmap.service.event.RoadmapCreateEvent; +import co.kirikiri.roadmap.service.mapper.RoadmapMapper; +import co.kirikiri.service.aop.ExceptionConvert; import co.kirikiri.service.exception.AuthenticationException; import co.kirikiri.service.exception.BadRequestException; import co.kirikiri.service.exception.ConflictException; import co.kirikiri.service.exception.ForbiddenException; import co.kirikiri.service.exception.NotFoundException; -import co.kirikiri.roadmap.service.mapper.RoadmapMapper; -import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.cache.annotation.CacheEvict; import org.springframework.context.ApplicationEventPublisher; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.List; + @Service @Transactional @RequiredArgsConstructor @@ -52,9 +48,8 @@ public class RoadmapCreateService { private final MemberRepository memberRepository; private final RoadmapRepository roadmapRepository; private final RoadmapReviewRepository roadmapReviewRepository; - private final GoalRoomRepository goalRoomRepository; - private final GoalRoomMemberRepository goalRoomMemberRepository; private final RoadmapCategoryRepository roadmapCategoryRepository; + private final RoadmapGoalRoomService roadmapGoalRoomService; private final ApplicationEventPublisher applicationEventPublisher; @CacheEvict(value = "roadmapList", allEntries = true) @@ -122,8 +117,7 @@ private Roadmap makeRoadmap(final Member member, final RoadmapSaveDto roadmapSav public void createReview(final Long roadmapId, final String identifier, final RoadmapReviewSaveRequest request) { final Roadmap roadmap = findRoadmapById(roadmapId); - final GoalRoomMember goalRoomMember = findCompletedGoalRoomMember(roadmapId, identifier); - final Member member = goalRoomMember.getMember(); + final Member member = roadmapGoalRoomService.findCompletedGoalRoomMember(roadmapId, identifier); final RoadmapReviewDto roadmapReviewDto = RoadmapMapper.convertRoadmapReviewDto(request, member); validateReviewQualification(roadmap, member); validateReviewCount(roadmap, member); @@ -137,13 +131,6 @@ private Roadmap findRoadmapById(final Long id) { .orElseThrow(() -> new NotFoundException("존재하지 않는 로드맵입니다. roadmapId = " + id)); } - private GoalRoomMember findCompletedGoalRoomMember(final Long roadmapId, final String identifier) { - return goalRoomMemberRepository.findByRoadmapIdAndMemberIdentifierAndGoalRoomStatus(roadmapId, - new Identifier(identifier), GoalRoomStatus.COMPLETED) - .orElseThrow(() -> new BadRequestException( - "로드맵에 대해서 완료된 골룸이 존재하지 않습니다. roadmapId = " + roadmapId + " memberIdentifier = " + identifier)); - } - private void validateReviewQualification(final Roadmap roadmap, final Member member) { if (roadmap.isCreator(member)) { throw new BadRequestException( @@ -162,8 +149,7 @@ private void validateReviewCount(final Roadmap roadmap, final Member member) { public void deleteRoadmap(final String identifier, final Long roadmapId) { final Roadmap roadmap = findRoadmapById(roadmapId); validateRoadmapCreator(roadmapId, identifier); - final List goalRooms = goalRoomRepository.findByRoadmap(roadmap); - if (goalRooms.isEmpty()) { + if (!roadmapGoalRoomService.hasGoalRooms(roadmap)) { roadmapRepository.delete(roadmap); return; } @@ -171,8 +157,9 @@ public void deleteRoadmap(final String identifier, final Long roadmapId) { } private void validateRoadmapCreator(final Long roadmapId, final String identifier) { - roadmapRepository.findByIdAndMemberIdentifier(roadmapId, identifier) - .orElseThrow(() -> new ForbiddenException("해당 로드맵을 생성한 사용자가 아닙니다.")); + if (roadmapRepository.findByIdAndMemberIdentifier(roadmapId, identifier).isEmpty()) { + throw new ForbiddenException("해당 로드맵을 생성한 사용자가 아닙니다."); + } } @CacheEvict(value = "categoryList", allEntries = true) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java new file mode 100644 index 000000000..a39428874 --- /dev/null +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java @@ -0,0 +1,11 @@ +package co.kirikiri.roadmap.service; + +import co.kirikiri.domain.member.Member; +import co.kirikiri.roadmap.domain.Roadmap; + +public interface RoadmapGoalRoomService { + + Member findCompletedGoalRoomMember(final Long roadmapId, final String identifier); + + boolean hasGoalRooms(final Roadmap roadmap); +} diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java index f4d6db089..22dc685e2 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java @@ -1,17 +1,18 @@ package co.kirikiri.roadmap.service.scheduler; import co.kirikiri.domain.goalroom.GoalRoom; +import co.kirikiri.persistence.goalroom.GoalRoomRepository; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapStatus; -import co.kirikiri.persistence.goalroom.GoalRoomRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import co.kirikiri.service.aop.ExceptionConvert; -import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; +import java.util.List; + @Component @Transactional @RequiredArgsConstructor diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/member/RoadmapGoalRoomServiceImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/service/member/RoadmapGoalRoomServiceImpl.java new file mode 100644 index 000000000..2253d9bec --- /dev/null +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/member/RoadmapGoalRoomServiceImpl.java @@ -0,0 +1,38 @@ +package co.kirikiri.service.member; + +import co.kirikiri.domain.goalroom.GoalRoomStatus; +import co.kirikiri.domain.member.Member; +import co.kirikiri.domain.member.vo.Identifier; +import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; +import co.kirikiri.persistence.goalroom.GoalRoomRepository; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.service.RoadmapGoalRoomService; +import co.kirikiri.service.aop.ExceptionConvert; +import co.kirikiri.service.exception.BadRequestException; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional +@RequiredArgsConstructor +@ExceptionConvert +public class RoadmapGoalRoomServiceImpl implements RoadmapGoalRoomService { + + private final GoalRoomRepository goalRoomRepository; + private final GoalRoomMemberRepository goalRoomMemberRepository; + + @Override + public Member findCompletedGoalRoomMember(final Long roadmapId, final String identifier) { + return goalRoomMemberRepository.findByRoadmapIdAndMemberIdentifierAndGoalRoomStatus(roadmapId, + new Identifier(identifier), GoalRoomStatus.COMPLETED) + .orElseThrow(() -> new BadRequestException( + "로드맵에 대해서 완료된 골룸이 존재하지 않습니다. roadmapId = " + roadmapId + " memberIdentifier = " + identifier)) + .getMember(); + } + + @Override + public boolean hasGoalRooms(final Roadmap roadmap) { + return !goalRoomRepository.findByRoadmap(roadmap).isEmpty(); + } +} diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapSchedulerIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapSchedulerIntegrationTest.java index b4d8131b2..ca28970b1 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapSchedulerIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapSchedulerIntegrationTest.java @@ -1,28 +1,22 @@ package co.kirikiri.integration; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸을_생성하고_아이디를_반환한다; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.십일_후; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.오늘; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_노드_인증_횟수; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_이름; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_제한_인원; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵_삭제; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵_생성; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵을_아이디로_조회하고_응답객체를_반환한다; -import static org.assertj.core.api.Assertions.assertThat; - import co.kirikiri.domain.goalroom.GoalRoomStatus; import co.kirikiri.integration.helper.InitIntegrationTest; import co.kirikiri.roadmap.persistence.RoadmapRepository; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.roadmap.service.scheduler.RoadmapScheduler; import co.kirikiri.service.dto.goalroom.request.GoalRoomCreateRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomRoadmapNodeRequest; -import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import org.junit.jupiter.api.Test; + import java.io.IOException; import java.time.LocalDate; import java.util.List; +import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.*; +import static co.kirikiri.integration.fixture.RoadmapAPIFixture.*; +import static org.assertj.core.api.Assertions.assertThat; + class RoadmapSchedulerIntegrationTest extends InitIntegrationTest { private static final LocalDate 현재부터_3개월_1일_전 = 오늘.minusMonths(3).minusDays(1); @@ -65,7 +59,7 @@ public RoadmapSchedulerIntegrationTest(final RoadmapScheduler roadmapScheduler, roadmapScheduler.deleteRoadmaps(); // then - assertThat(roadmapRepository.findAll()).hasSize(0); + assertThat(roadmapRepository.findAll()).isEmpty(); } @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapCreateServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapCreateServiceTest.java index 4ddcb9ef6..c21bfffb2 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapCreateServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapCreateServiceTest.java @@ -1,22 +1,5 @@ package co.kirikiri.service; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import co.kirikiri.domain.goalroom.GoalRoom; -import co.kirikiri.domain.goalroom.GoalRoomMember; -import co.kirikiri.domain.goalroom.GoalRoomRole; -import co.kirikiri.domain.goalroom.vo.GoalRoomName; -import co.kirikiri.domain.goalroom.vo.LimitedMemberCount; import co.kirikiri.domain.member.EncryptedPassword; import co.kirikiri.domain.member.Gender; import co.kirikiri.domain.member.Member; @@ -24,18 +7,18 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; +import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; import co.kirikiri.roadmap.domain.RoadmapContents; import co.kirikiri.roadmap.domain.RoadmapDifficulty; import co.kirikiri.roadmap.domain.RoadmapReview; -import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; -import co.kirikiri.persistence.goalroom.GoalRoomRepository; -import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import co.kirikiri.roadmap.persistence.RoadmapReviewRepository; +import co.kirikiri.roadmap.service.RoadmapCreateService; +import co.kirikiri.roadmap.service.RoadmapGoalRoomService; import co.kirikiri.roadmap.service.dto.request.RoadmapCategorySaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; @@ -47,11 +30,6 @@ import co.kirikiri.service.exception.ConflictException; import co.kirikiri.service.exception.ForbiddenException; import co.kirikiri.service.exception.NotFoundException; -import co.kirikiri.roadmap.service.RoadmapCreateService; -import java.time.LocalDateTime; -import java.util.Collections; -import java.util.List; -import java.util.Optional; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; @@ -59,6 +37,17 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.context.ApplicationEventPublisher; +import java.util.Collections; +import java.util.List; +import java.util.Optional; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.*; + @ExtendWith(MockitoExtension.class) class RoadmapCreateServiceTest { @@ -76,18 +65,15 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 @Mock private RoadmapReviewRepository roadmapReviewRepository; - @Mock - private GoalRoomRepository goalRoomRepository; - - @Mock - private GoalRoomMemberRepository goalRoomMemberRepository; - @Mock private RoadmapCategoryRepository roadmapCategoryRepository; @Mock private ApplicationEventPublisher applicationEventPublisher; + @Mock + private RoadmapGoalRoomService roadmapGoalRoomService; + @InjectMocks private RoadmapCreateService roadmapCreateService; @@ -166,13 +152,11 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 final Roadmap roadmap = 로드맵을_생성한다(MEMBER, category); final RoadmapContents roadmapContents = roadmap.getContents(); final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(MEMBER, targetRoadmapContent); when(roadmapRepository.findById(anyLong())) .thenReturn(Optional.of(roadmap)); - when(goalRoomMemberRepository.findByRoadmapIdAndMemberIdentifierAndGoalRoomStatus(anyLong(), any(), any())) - .thenReturn(Optional.of( - new GoalRoomMember(GoalRoomRole.FOLLOWER, LocalDateTime.now(), goalRoom, follower))); + when(roadmapGoalRoomService.findCompletedGoalRoomMember(anyLong(), any())) + .thenReturn(follower); when(roadmapReviewRepository.findByRoadmapAndMember(any(), any())) .thenReturn(Optional.empty()); @@ -205,8 +189,8 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 when(roadmapRepository.findById(anyLong())) .thenReturn(Optional.of(roadmap)); - when(goalRoomMemberRepository.findByRoadmapIdAndMemberIdentifierAndGoalRoomStatus(anyLong(), any(), any())) - .thenReturn(Optional.empty()); + when(roadmapGoalRoomService.findCompletedGoalRoomMember(anyLong(), any())) + .thenThrow(new BadRequestException("Error Message")); final RoadmapReviewSaveRequest roadmapReviewSaveRequest = new RoadmapReviewSaveRequest("리뷰 내용", null); @@ -229,13 +213,11 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 final Roadmap roadmap = 로드맵을_생성한다(MEMBER, category); final RoadmapContents roadmapContents = roadmap.getContents(); final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(MEMBER, targetRoadmapContent); when(roadmapRepository.findById(anyLong())) .thenReturn(Optional.of(roadmap)); - when(goalRoomMemberRepository.findByRoadmapIdAndMemberIdentifierAndGoalRoomStatus(anyLong(), any(), any())) - .thenReturn(Optional.of( - new GoalRoomMember(GoalRoomRole.FOLLOWER, LocalDateTime.now(), goalRoom, follower))); + when(roadmapGoalRoomService.findCompletedGoalRoomMember(anyLong(), any())) + .thenReturn(follower); when(roadmapReviewRepository.findByRoadmapAndMember(any(), any())) .thenReturn(Optional.of(new RoadmapReview("로드맵 짱!", 5.0, MEMBER))); @@ -256,8 +238,8 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 .thenReturn(Optional.of(roadmap)); when(roadmapRepository.findByIdAndMemberIdentifier(anyLong(), anyString())) .thenReturn(Optional.of(roadmap)); - when(goalRoomRepository.findByRoadmap(any())) - .thenReturn(Collections.emptyList()); + when(roadmapGoalRoomService.hasGoalRooms(roadmap)) + .thenReturn(false); // when // then @@ -277,14 +259,13 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 final RoadmapContents roadmapContents = roadmap.getContents(); final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(follower, targetRoadmapContent); when(roadmapRepository.findById(anyLong())) .thenReturn(Optional.of(roadmap)); when(roadmapRepository.findByIdAndMemberIdentifier(anyLong(), anyString())) .thenReturn(Optional.of(roadmap)); - when(goalRoomRepository.findByRoadmap(any())) - .thenReturn(List.of(goalRoom)); + when(roadmapGoalRoomService.hasGoalRooms(roadmap)) + .thenReturn(true); // when // then @@ -314,7 +295,6 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 final RoadmapContents roadmapContents = roadmap.getContents(); final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - 골룸을_생성한다(MEMBER, targetRoadmapContent); when(roadmapRepository.findById(anyLong())) .thenReturn(Optional.of(roadmap)); @@ -361,8 +341,4 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 roadmap.addContent(content); return roadmap; } - - private GoalRoom 골룸을_생성한다(final Member member, final RoadmapContent roadmapContent) { - return new GoalRoom(new GoalRoomName("골룸"), new LimitedMemberCount(10), roadmapContent, member); - } } From 91f128bfce8b829ad918b0fd8354911881d93296 Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Wed, 20 Dec 2023 05:30:37 +0900 Subject: [PATCH 03/22] =?UTF-8?q?refactor:=20RoadmapReadService=EC=97=90?= =?UTF-8?q?=EC=84=9C=20goalRoom=20=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/RoadmapGoalRoomService.java | 8 ++ .../roadmap/service/RoadmapReadService.java | 77 ++++------- .../member/RoadmapGoalRoomServiceImpl.java | 54 +++++++- .../fixture/RoadmapAPIFixture.java | 13 +- .../service/RoadmapReadServiceTest.java | 120 +++++------------- 5 files changed, 123 insertions(+), 149 deletions(-) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java index a39428874..aec48defd 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java @@ -2,10 +2,18 @@ import co.kirikiri.domain.member.Member; import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomNumberDto; +import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomsOrderTypeDto; +import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; +import co.kirikiri.service.dto.CustomScrollRequest; public interface RoadmapGoalRoomService { Member findCompletedGoalRoomMember(final Long roadmapId, final String identifier); boolean hasGoalRooms(final Roadmap roadmap); + + RoadmapGoalRoomNumberDto findRoadmapGoalRoomsByRoadmap(final Roadmap roadmap); + + RoadmapGoalRoomResponses makeRoadmapGoalRoomResponsesByOrderType(final Roadmap roadmap, final RoadmapGoalRoomsOrderTypeDto orderTypeDto, final CustomScrollRequest scrollRequest); } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java index ca0824606..c9906e609 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java @@ -1,8 +1,10 @@ package co.kirikiri.roadmap.service; -import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.member.Member; import co.kirikiri.domain.member.vo.Identifier; +import co.kirikiri.persistence.dto.RoadmapOrderType; +import co.kirikiri.persistence.dto.RoadmapSearchDto; +import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; @@ -10,21 +12,10 @@ import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.roadmap.domain.RoadmapReview; import co.kirikiri.roadmap.domain.RoadmapTags; -import co.kirikiri.persistence.dto.RoadmapOrderType; -import co.kirikiri.persistence.dto.RoadmapSearchDto; -import co.kirikiri.persistence.goalroom.GoalRoomRepository; -import co.kirikiri.persistence.goalroom.dto.RoadmapGoalRoomsOrderType; -import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import co.kirikiri.roadmap.persistence.RoadmapReviewRepository; -import co.kirikiri.service.FileService; -import co.kirikiri.service.aop.ExceptionConvert; -import co.kirikiri.service.dto.CustomScrollRequest; -import co.kirikiri.service.dto.goalroom.RoadmapGoalRoomDto; -import co.kirikiri.service.dto.goalroom.RoadmapGoalRoomScrollDto; -import co.kirikiri.service.dto.member.MemberDto; import co.kirikiri.roadmap.service.dto.RoadmapCategoryDto; import co.kirikiri.roadmap.service.dto.RoadmapContentDto; import co.kirikiri.roadmap.service.dto.RoadmapDto; @@ -43,18 +34,22 @@ import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; -import co.kirikiri.service.exception.NotFoundException; -import co.kirikiri.service.mapper.GoalRoomMapper; import co.kirikiri.roadmap.service.mapper.RoadmapMapper; +import co.kirikiri.service.FileService; +import co.kirikiri.service.aop.ExceptionConvert; +import co.kirikiri.service.dto.CustomScrollRequest; +import co.kirikiri.service.dto.member.MemberDto; +import co.kirikiri.service.exception.NotFoundException; import co.kirikiri.service.mapper.ScrollResponseMapper; -import java.net.URL; -import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.cache.annotation.Cacheable; import org.springframework.http.HttpMethod; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.net.URL; +import java.util.List; + @Service @Transactional(readOnly = true) @RequiredArgsConstructor @@ -65,7 +60,7 @@ public class RoadmapReadService { private final RoadmapCategoryRepository roadmapCategoryRepository; private final RoadmapContentRepository roadmapContentRepository; private final RoadmapReviewRepository roadmapReviewRepository; - private final GoalRoomRepository goalRoomRepository; + private final RoadmapGoalRoomService roadmapGoalRoomService; private final MemberRepository memberRepository; private final FileService fileService; @@ -73,12 +68,21 @@ public class RoadmapReadService { public RoadmapResponse findRoadmap(final Long id) { final Roadmap roadmap = findRoadmapById(id); final RoadmapContent recentRoadmapContent = findRecentContent(roadmap); - final List goalRooms = goalRoomRepository.findByRoadmap(roadmap); - final RoadmapGoalRoomNumberDto roadmapGoalRoomNumberDto = GoalRoomMapper.convertRoadmapGoalRoomDto(goalRooms); + final RoadmapGoalRoomNumberDto roadmapGoalRoomNumberDto = roadmapGoalRoomService.findRoadmapGoalRoomsByRoadmap(roadmap); final RoadmapDto roadmapDto = makeRoadmapDto(roadmap, recentRoadmapContent); return RoadmapMapper.convertToRoadmapResponse(roadmapDto, roadmapGoalRoomNumberDto); } + private Roadmap findRoadmapById(final Long id) { + return roadmapRepository.findRoadmapById(id) + .orElseThrow(() -> new NotFoundException("존재하지 않는 로드맵입니다. roadmapId = " + id)); + } + + private RoadmapContent findRecentContent(final Roadmap roadmap) { + return roadmapContentRepository.findFirstByRoadmapOrderByCreatedAtDesc(roadmap) + .orElseThrow(() -> new NotFoundException("로드맵에 컨텐츠가 존재하지 않습니다.")); + } + private RoadmapDto makeRoadmapDto(final Roadmap roadmap, final RoadmapContent roadmapContent) { final RoadmapCategory category = roadmap.getCategory(); final Member creator = roadmap.getCreator(); @@ -120,16 +124,6 @@ private List makeRoadmapTagDtos(final RoadmapTags roadmapTags) { .toList(); } - private Roadmap findRoadmapById(final Long id) { - return roadmapRepository.findRoadmapById(id) - .orElseThrow(() -> new NotFoundException("존재하지 않는 로드맵입니다. roadmapId = " + id)); - } - - private RoadmapContent findRecentContent(final Roadmap roadmap) { - return roadmapContentRepository.findFirstByRoadmapOrderByCreatedAtDesc(roadmap) - .orElseThrow(() -> new NotFoundException("로드맵에 컨텐츠가 존재하지 않습니다.")); - } - @Cacheable(value = "roadmapList", keyGenerator = "cacheKeyGenerator", cacheManager = "redisCacheManager") public RoadmapForListResponses findRoadmapsByOrderType(final Long categoryId, final RoadmapOrderTypeRequest orderTypeRequest, @@ -226,30 +220,7 @@ public RoadmapGoalRoomResponses findRoadmapGoalRoomsByOrderType(final Long roadm final RoadmapGoalRoomsOrderTypeDto orderTypeDto, final CustomScrollRequest scrollRequest) { final Roadmap roadmap = findRoadmapById(roadmapId); - final RoadmapGoalRoomsOrderType orderType = GoalRoomMapper.convertToGoalRoomOrderType(orderTypeDto); - final List goalRooms = goalRoomRepository.findGoalRoomsByRoadmapAndCond( - roadmap, orderType, scrollRequest.lastId(), scrollRequest.size()); - final RoadmapGoalRoomScrollDto roadmapGoalRoomScrollDto = makeGoalRoomDtos(goalRooms, - scrollRequest.size()); - return GoalRoomMapper.convertToRoadmapGoalRoomResponses(roadmapGoalRoomScrollDto); - } - - public RoadmapGoalRoomScrollDto makeGoalRoomDtos(final List goalRooms, - final int requestSize) { - final List roadmapGoalRoomDtos = goalRooms.stream() - .map(this::makeGoalRoomDto) - .toList(); - final List subDtos = ScrollResponseMapper.getSubResponses(roadmapGoalRoomDtos, requestSize); - final boolean hasNext = ScrollResponseMapper.hasNext(roadmapGoalRoomDtos.size(), requestSize); - return new RoadmapGoalRoomScrollDto(subDtos, hasNext); - } - - private RoadmapGoalRoomDto makeGoalRoomDto(final GoalRoom goalRoom) { - final Member goalRoomLeader = goalRoom.findGoalRoomLeader(); - return new RoadmapGoalRoomDto(goalRoom.getId(), goalRoom.getName().getValue(), goalRoom.getStatus(), - goalRoom.getCurrentMemberCount(), goalRoom.getLimitedMemberCount().getValue(), - goalRoom.getCreatedAt(), goalRoom.getStartDate(), - goalRoom.getEndDate(), makeMemberDto(goalRoomLeader)); + return roadmapGoalRoomService.makeRoadmapGoalRoomResponsesByOrderType(roadmap, orderTypeDto, scrollRequest); } public List findRoadmapReviews(final Long roadmapId, diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/member/RoadmapGoalRoomServiceImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/service/member/RoadmapGoalRoomServiceImpl.java index 2253d9bec..19b4892c9 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/member/RoadmapGoalRoomServiceImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/member/RoadmapGoalRoomServiceImpl.java @@ -1,18 +1,34 @@ package co.kirikiri.service.member; +import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomStatus; import co.kirikiri.domain.member.Member; import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; import co.kirikiri.persistence.goalroom.GoalRoomRepository; +import co.kirikiri.persistence.goalroom.dto.RoadmapGoalRoomsOrderType; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.service.RoadmapGoalRoomService; +import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomNumberDto; +import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomsOrderTypeDto; +import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; +import co.kirikiri.service.FileService; import co.kirikiri.service.aop.ExceptionConvert; +import co.kirikiri.service.dto.CustomScrollRequest; +import co.kirikiri.service.dto.goalroom.RoadmapGoalRoomDto; +import co.kirikiri.service.dto.goalroom.RoadmapGoalRoomScrollDto; +import co.kirikiri.service.dto.member.MemberDto; import co.kirikiri.service.exception.BadRequestException; +import co.kirikiri.service.mapper.GoalRoomMapper; +import co.kirikiri.service.mapper.ScrollResponseMapper; import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpMethod; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.net.URL; +import java.util.List; + @Service @Transactional @RequiredArgsConstructor @@ -21,6 +37,7 @@ public class RoadmapGoalRoomServiceImpl implements RoadmapGoalRoomService { private final GoalRoomRepository goalRoomRepository; private final GoalRoomMemberRepository goalRoomMemberRepository; + private final FileService fileService; @Override public Member findCompletedGoalRoomMember(final Long roadmapId, final String identifier) { @@ -33,6 +50,41 @@ public Member findCompletedGoalRoomMember(final Long roadmapId, final String ide @Override public boolean hasGoalRooms(final Roadmap roadmap) { - return !goalRoomRepository.findByRoadmap(roadmap).isEmpty(); + return !findGoalRoomsByRoadmap(roadmap).isEmpty(); + } + + private List findGoalRoomsByRoadmap(final Roadmap roadmap) { + return goalRoomRepository.findByRoadmap(roadmap); + } + + @Override + public RoadmapGoalRoomNumberDto findRoadmapGoalRoomsByRoadmap(final Roadmap roadmap) { + return GoalRoomMapper.convertRoadmapGoalRoomDto(findGoalRoomsByRoadmap(roadmap)); + } + + @Override + public RoadmapGoalRoomResponses makeRoadmapGoalRoomResponsesByOrderType(final Roadmap roadmap, final RoadmapGoalRoomsOrderTypeDto orderTypeDto, final CustomScrollRequest scrollRequest) { + final RoadmapGoalRoomsOrderType orderType = GoalRoomMapper.convertToGoalRoomOrderType(orderTypeDto); + final List roadmapGoalRoomDtos = goalRoomRepository.findGoalRoomsByRoadmapAndCond(roadmap, orderType, scrollRequest.lastId(), scrollRequest.size()) + .stream() + .map(this::makeGoalRoomDto) + .toList(); + final List subDtos = ScrollResponseMapper.getSubResponses(roadmapGoalRoomDtos, scrollRequest.size()); + final boolean hasNext = ScrollResponseMapper.hasNext(roadmapGoalRoomDtos.size(), scrollRequest.size()); + + return GoalRoomMapper.convertToRoadmapGoalRoomResponses(new RoadmapGoalRoomScrollDto(subDtos, hasNext)); + } + + private RoadmapGoalRoomDto makeGoalRoomDto(final GoalRoom goalRoom) { + final Member goalRoomLeader = goalRoom.findGoalRoomLeader(); + return new RoadmapGoalRoomDto(goalRoom.getId(), goalRoom.getName().getValue(), goalRoom.getStatus(), + goalRoom.getCurrentMemberCount(), goalRoom.getLimitedMemberCount().getValue(), + goalRoom.getCreatedAt(), goalRoom.getStartDate(), + goalRoom.getEndDate(), makeMemberDto(goalRoomLeader)); + } + + private MemberDto makeMemberDto(final Member creator) { + final URL url = fileService.generateUrl(creator.getImage().getServerFilePath(), HttpMethod.GET); + return new MemberDto(creator.getId(), creator.getNickname().getValue(), url.toExternalForm()); } } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java index a6109bd48..f5c6f4261 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java @@ -1,17 +1,13 @@ package co.kirikiri.integration.fixture; -import static co.kirikiri.integration.fixture.CommonFixture.API_PREFIX; -import static co.kirikiri.integration.fixture.CommonFixture.AUTHORIZATION; -import static io.restassured.RestAssured.given; - -import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.persistence.dto.RoadmapOrderType; -import co.kirikiri.service.dto.CustomScrollRequest; +import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.service.dto.request.RoadmapCategorySaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; +import co.kirikiri.service.dto.CustomScrollRequest; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import io.restassured.response.ExtractableResponse; @@ -20,10 +16,15 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.mock.web.MockMultipartFile; + import java.io.IOException; import java.util.ArrayList; import java.util.List; +import static co.kirikiri.integration.fixture.CommonFixture.API_PREFIX; +import static co.kirikiri.integration.fixture.CommonFixture.AUTHORIZATION; +import static io.restassured.RestAssured.given; + public class RoadmapAPIFixture { private static final ObjectMapper objectMapper = new ObjectMapper() diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapReadServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapReadServiceTest.java index 93cdecb95..3d161b533 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapReadServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapReadServiceTest.java @@ -1,22 +1,7 @@ package co.kirikiri.service; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.when; - import co.kirikiri.domain.ImageContentType; -import co.kirikiri.domain.goalroom.GoalRoom; -import co.kirikiri.domain.goalroom.GoalRoomRoadmapNode; -import co.kirikiri.domain.goalroom.GoalRoomRoadmapNodes; import co.kirikiri.domain.goalroom.GoalRoomStatus; -import co.kirikiri.domain.goalroom.vo.GoalRoomName; -import co.kirikiri.domain.goalroom.vo.LimitedMemberCount; -import co.kirikiri.domain.goalroom.vo.Period; import co.kirikiri.domain.member.EncryptedPassword; import co.kirikiri.domain.member.Gender; import co.kirikiri.domain.member.Member; @@ -25,6 +10,7 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; +import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; @@ -35,15 +21,13 @@ import co.kirikiri.roadmap.domain.RoadmapTag; import co.kirikiri.roadmap.domain.RoadmapTags; import co.kirikiri.roadmap.domain.vo.RoadmapTagName; -import co.kirikiri.persistence.goalroom.GoalRoomRepository; -import co.kirikiri.persistence.goalroom.dto.RoadmapGoalRoomsOrderType; -import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import co.kirikiri.roadmap.persistence.RoadmapReviewRepository; -import co.kirikiri.service.dto.CustomScrollRequest; -import co.kirikiri.service.dto.member.response.MemberResponse; +import co.kirikiri.roadmap.service.RoadmapGoalRoomService; +import co.kirikiri.roadmap.service.RoadmapReadService; +import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomNumberDto; import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomsOrderTypeDto; import co.kirikiri.roadmap.service.dto.request.RoadmapOrderTypeRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapSearchRequest; @@ -59,8 +43,15 @@ import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapTagResponse; +import co.kirikiri.service.dto.CustomScrollRequest; +import co.kirikiri.service.dto.member.response.MemberResponse; import co.kirikiri.service.exception.NotFoundException; -import co.kirikiri.roadmap.service.RoadmapReadService; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; + import java.net.MalformedURLException; import java.net.URL; import java.time.LocalDate; @@ -68,11 +59,12 @@ import java.util.Collections; import java.util.List; import java.util.Optional; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) class RoadmapReadServiceTest { @@ -85,6 +77,9 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 new MemberProfile(Gender.FEMALE, "kirikiri1@email.com")); private final LocalDateTime now = LocalDateTime.now(); + @Mock + private MemberRepository memberRepository; + @Mock private RoadmapRepository roadmapRepository; @@ -95,13 +90,10 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 private RoadmapContentRepository roadmapContentRepository; @Mock - private GoalRoomRepository goalRoomRepository; - - @Mock - private MemberRepository memberRepository; + private RoadmapReviewRepository roadmapReviewRepository; @Mock - private RoadmapReviewRepository roadmapReviewRepository; + private RoadmapGoalRoomService roadmapGoalRoomService; @Mock private FileService fileService; @@ -112,21 +104,18 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 @Test void 특정_아이디를_가지는_로드맵_단일_조회시_해당_로드맵의_정보를_반환한다() throws MalformedURLException { //given - final Member member = 사용자를_생성한다(1L, "identifier1", "코끼리"); final RoadmapCategory category = 로드맵_카테고리를_생성한다(1L, "운동"); final RoadmapContent content = 로드맵_컨텐츠를_생성한다(1L, "콘텐츠 내용"); final Roadmap roadmap = 로드맵을_생성한다("로드맵 제목", category); roadmap.addContent(content); final Long roadmapId = 1L; - final List goalRooms = 상태별_골룸_목록을_생성한다(); - when(roadmapRepository.findRoadmapById(anyLong())) .thenReturn(Optional.of(roadmap)); when(roadmapContentRepository.findFirstByRoadmapOrderByCreatedAtDesc(any())) .thenReturn(Optional.of(roadmap.getContents().getValues().get(0))); - when(goalRoomRepository.findByRoadmap(any())) - .thenReturn(goalRooms); + when(roadmapGoalRoomService.findRoadmapGoalRoomsByRoadmap(any())) + .thenReturn(new RoadmapGoalRoomNumberDto(2, 2, 2)); when(fileService.generateUrl(anyString(), any())) .thenReturn(new URL("http://example.com/serverFilePath")); @@ -469,40 +458,11 @@ roadmapId, new RoadmapCategoryResponse(1L, "운동"), "로드맵 제목", "로 final Roadmap roadmap = new Roadmap(1L, "로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.DIFFICULT, member1, new RoadmapCategory("it")); - final GoalRoomRoadmapNode goalRoomRoadmapNode1 = new GoalRoomRoadmapNode(new Period(TODAY, TODAY.plusDays(10)), - 1, roadmapNode1); - final GoalRoomRoadmapNode goalRoomRoadmapNode2 = new GoalRoomRoadmapNode( - new Period(TODAY.plusDays(11), TODAY.plusDays(20)), 1, roadmapNode2); - final GoalRoomRoadmapNode goalRoomRoadmapNode3 = new GoalRoomRoadmapNode(new Period(TODAY, TODAY.plusDays(10)), - 1, roadmapNode1); - final GoalRoomRoadmapNode goalRoomRoadmapNode4 = new GoalRoomRoadmapNode( - new Period(TODAY.plusDays(11), TODAY.plusDays(20)), 1, roadmapNode2); - final Member member2 = 사용자를_생성한다(2L, "identifier2", "name2"); - final GoalRoom goalRoom1 = new GoalRoom(1L, new GoalRoomName("goalroom1"), new LimitedMemberCount(10), - roadmapContent, member2); - goalRoom1.addAllGoalRoomRoadmapNodes( - new GoalRoomRoadmapNodes(List.of(goalRoomRoadmapNode1, goalRoomRoadmapNode2))); - final Member member3 = 사용자를_생성한다(3L, "identifier2", "name3"); - final GoalRoom goalRoom2 = new GoalRoom(2L, new GoalRoomName("goalroom2"), new LimitedMemberCount(10), - roadmapContent, member3); - goalRoom2.addAllGoalRoomRoadmapNodes( - new GoalRoomRoadmapNodes(List.of(goalRoomRoadmapNode3, goalRoomRoadmapNode4))); - final List goalRooms = List.of(goalRoom2, goalRoom1); given(roadmapRepository.findRoadmapById(anyLong())) .willReturn(Optional.of(roadmap)); - given(goalRoomRepository.findGoalRoomsByRoadmapAndCond(roadmap, - RoadmapGoalRoomsOrderType.LATEST, null, 10)) - .willReturn(goalRooms); - given(fileService.generateUrl(anyString(), any())) - .willReturn(new URL("http://example.com/serverFilePath")); - - // when - final RoadmapGoalRoomResponses result = roadmapService.findRoadmapGoalRoomsByOrderType(1L, - RoadmapGoalRoomsOrderTypeDto.LATEST, new CustomScrollRequest(null, 10)); - final RoadmapGoalRoomResponses expected = new RoadmapGoalRoomResponses(List.of( new RoadmapGoalRoomResponse(2L, "goalroom2", GoalRoomStatus.RECRUITING, 1, 10, @@ -515,6 +475,12 @@ roadmapId, new RoadmapCategoryResponse(1L, "운동"), "로드맵 제목", "로 TODAY, TODAY.plusDays(20), new MemberResponse(member2.getId(), member2.getNickname().getValue(), "http://example.com/serverFilePath"))), false); + given(roadmapGoalRoomService.makeRoadmapGoalRoomResponsesByOrderType(any(), any(), any())) + .willReturn(expected); + + // when + final RoadmapGoalRoomResponses result = roadmapService.findRoadmapGoalRoomsByOrderType(1L, + RoadmapGoalRoomsOrderTypeDto.LATEST, new CustomScrollRequest(null, 10)); assertThat(result) .usingRecursiveComparison() @@ -651,28 +617,4 @@ null, new EncryptedPassword(new Password("password1!")), return List.of(category1, category2, category3, category4, category5, category6, category7, category8, category9); } - - private List 상태별_골룸_목록을_생성한다() { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 내용"); - final GoalRoom recruitedGoalRoom1 = new GoalRoom(new GoalRoomName("모집 중 골룸 1"), - new LimitedMemberCount(20), roadmapContent, member); - final GoalRoom recruitedGoalRoom2 = new GoalRoom(new GoalRoomName("모집 중 골룸 2"), - new LimitedMemberCount(20), roadmapContent, member); - final GoalRoom runningGoalRoom1 = new GoalRoom(new GoalRoomName("진행 중 골룸 1"), - new LimitedMemberCount(20), roadmapContent, member); - final GoalRoom runningGoalRoom2 = new GoalRoom(new GoalRoomName("진행 중 골룸 2"), - new LimitedMemberCount(20), roadmapContent, member); - final GoalRoom completedGoalRoom1 = new GoalRoom(new GoalRoomName("완료된 골룸 1"), - new LimitedMemberCount(20), roadmapContent, member); - final GoalRoom completedGoalRoom2 = new GoalRoom(new GoalRoomName("완료된 골룸 2"), - new LimitedMemberCount(20), roadmapContent, member); - - runningGoalRoom1.start(); - runningGoalRoom2.start(); - completedGoalRoom1.complete(); - completedGoalRoom2.complete(); - - return List.of(recruitedGoalRoom1, recruitedGoalRoom2, runningGoalRoom1, runningGoalRoom2, - completedGoalRoom1, completedGoalRoom2); - } } From 7085619fd58dc5ebd6a9f701e5b4d2f848763ddd Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Wed, 20 Dec 2023 08:00:45 +0900 Subject: [PATCH 04/22] =?UTF-8?q?refactor:=20RoadmapScheduler=EC=97=90?= =?UTF-8?q?=EC=84=9C=20goalRoom=20=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0=20=EB=B0=8F=20=ED=85=8C=EC=8A=A4=ED=8A=B8=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=ED=8C=A8=ED=82=A4=EC=A7=80=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goalroom/GoalRoomRepository.java | 5 +- .../persistence/RoadmapQueryRepository.java | 5 +- .../RoadmapQueryRepositoryImpl.java | 10 +-- .../persistence/dto/RoadmapOrderType.java | 2 +- .../dto/RoadmapSearchCreatorNickname.java | 2 +- .../persistence/dto/RoadmapSearchDto.java | 2 +- .../persistence/dto/RoadmapSearchTagName.java | 2 +- .../persistence/dto/RoadmapSearchTitle.java | 2 +- .../service/RoadmapGoalRoomService.java | 2 + .../roadmap/service/RoadmapReadService.java | 4 +- .../roadmap/service/mapper/RoadmapMapper.java | 2 +- .../service/scheduler/RoadmapScheduler.java | 20 +---- .../RoadmapGoalRoomServiceImpl.java | 19 ++++- .../RoadmapReadIntegrationTest.java | 2 +- .../RoadmapReadOrderIntegrationTest.java | 2 +- .../fixture/RoadmapAPIFixture.java | 2 +- .../dto/RoadmapSearchTagNameTest.java | 1 + .../dto/RoadmapSearchTitleTest.java | 1 + .../controller/RoadmapCreateApiTest.java | 50 +++++-------- .../controller/RoadmapReadApiTest.java | 52 +++++++------ .../domain}/RoadmapCategoryTest.java | 2 +- .../domain}/RoadmapContentTest.java | 2 +- .../domain}/RoadmapContentsTest.java | 2 +- .../domain}/RoadmapNodeImagesTest.java | 2 +- .../domain}/RoadmapNodeTest.java | 2 +- .../domain}/RoadmapNodesTest.java | 2 +- .../domain}/RoadmapReviewTest.java | 2 +- .../domain}/RoadmapTagsTest.java | 2 +- .../domain}/RoadmapTest.java | 2 +- .../domain}/vo/RoadmapTagNameTest.java | 3 +- .../RoadmapContentRepositoryTest.java | 15 ++-- .../persistence}/RoadmapRepositoryTest.java | 24 +++--- .../RoadmapReviewRepositoryTest.java | 16 ++-- .../RoadmapCreateEventListenerTest.java | 20 ++--- .../service/RoadmapCreateServiceTest.java | 4 +- .../service/RoadmapReadServiceTest.java | 5 +- .../service/RoadmapSchedulerTest.java | 74 ++++--------------- 37 files changed, 155 insertions(+), 211 deletions(-) rename backend/kirikiri/src/main/java/co/kirikiri/{ => roadmap}/persistence/dto/RoadmapOrderType.java (67%) rename backend/kirikiri/src/main/java/co/kirikiri/{ => roadmap}/persistence/dto/RoadmapSearchCreatorNickname.java (85%) rename backend/kirikiri/src/main/java/co/kirikiri/{ => roadmap}/persistence/dto/RoadmapSearchDto.java (95%) rename backend/kirikiri/src/main/java/co/kirikiri/{ => roadmap}/persistence/dto/RoadmapSearchTagName.java (94%) rename backend/kirikiri/src/main/java/co/kirikiri/{ => roadmap}/persistence/dto/RoadmapSearchTitle.java (94%) rename backend/kirikiri/src/main/java/co/kirikiri/service/{member => goalroom}/RoadmapGoalRoomServiceImpl.java (86%) rename backend/kirikiri/src/test/java/co/kirikiri/{ => roadmap}/controller/RoadmapCreateApiTest.java (97%) rename backend/kirikiri/src/test/java/co/kirikiri/{ => roadmap}/controller/RoadmapReadApiTest.java (99%) rename backend/kirikiri/src/test/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapCategoryTest.java (97%) rename backend/kirikiri/src/test/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapContentTest.java (98%) rename backend/kirikiri/src/test/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapContentsTest.java (97%) rename backend/kirikiri/src/test/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapNodeImagesTest.java (99%) rename backend/kirikiri/src/test/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapNodeTest.java (96%) rename backend/kirikiri/src/test/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapNodesTest.java (97%) rename backend/kirikiri/src/test/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapReviewTest.java (98%) rename backend/kirikiri/src/test/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapTagsTest.java (98%) rename backend/kirikiri/src/test/java/co/kirikiri/{domain/roadmap => roadmap/domain}/RoadmapTest.java (99%) rename backend/kirikiri/src/test/java/co/kirikiri/{domain/roadmap => roadmap/domain}/vo/RoadmapTagNameTest.java (95%) rename backend/kirikiri/src/test/java/co/kirikiri/{persistence/roadmap => roadmap/persistence}/RoadmapContentRepositoryTest.java (94%) rename backend/kirikiri/src/test/java/co/kirikiri/{persistence/roadmap => roadmap/persistence}/RoadmapRepositoryTest.java (99%) rename backend/kirikiri/src/test/java/co/kirikiri/{persistence/roadmap => roadmap/persistence}/RoadmapReviewRepositoryTest.java (97%) rename backend/kirikiri/src/test/java/co/kirikiri/{ => roadmap}/service/RoadmapCreateEventListenerTest.java (98%) rename backend/kirikiri/src/test/java/co/kirikiri/{ => roadmap}/service/RoadmapCreateServiceTest.java (99%) rename backend/kirikiri/src/test/java/co/kirikiri/{ => roadmap}/service/RoadmapReadServiceTest.java (99%) rename backend/kirikiri/src/test/java/co/kirikiri/{ => roadmap}/service/RoadmapSchedulerTest.java (63%) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomRepository.java index 7f517ae99..339654cc5 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomRepository.java @@ -1,13 +1,14 @@ package co.kirikiri.persistence.goalroom; import co.kirikiri.domain.goalroom.GoalRoom; +import org.springframework.data.jpa.repository.JpaRepository; + import java.time.LocalDate; import java.util.List; import java.util.Optional; -import org.springframework.data.jpa.repository.JpaRepository; public interface GoalRoomRepository extends JpaRepository, GoalRoomQueryRepository { - + Optional findById(final Long goalRoomId); List findAllByEndDate(final LocalDate endDate); diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepository.java index 6ea8dbd48..b17a7a2e4 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepository.java @@ -4,8 +4,9 @@ import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapStatus; -import co.kirikiri.persistence.dto.RoadmapOrderType; -import co.kirikiri.persistence.dto.RoadmapSearchDto; +import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; +import co.kirikiri.roadmap.persistence.dto.RoadmapSearchDto; + import java.util.List; import java.util.Optional; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepositoryImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepositoryImpl.java index 2c19ba527..5ed3b1ee2 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepositoryImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepositoryImpl.java @@ -3,14 +3,14 @@ import co.kirikiri.domain.member.Member; import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.persistence.QuerydslRepositorySupporter; -import co.kirikiri.persistence.dto.RoadmapOrderType; -import co.kirikiri.persistence.dto.RoadmapSearchCreatorNickname; -import co.kirikiri.persistence.dto.RoadmapSearchDto; -import co.kirikiri.persistence.dto.RoadmapSearchTagName; -import co.kirikiri.persistence.dto.RoadmapSearchTitle; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapStatus; +import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; +import co.kirikiri.roadmap.persistence.dto.RoadmapSearchCreatorNickname; +import co.kirikiri.roadmap.persistence.dto.RoadmapSearchDto; +import co.kirikiri.roadmap.persistence.dto.RoadmapSearchTagName; +import co.kirikiri.roadmap.persistence.dto.RoadmapSearchTitle; import com.querydsl.core.types.Order; import com.querydsl.core.types.OrderSpecifier; import com.querydsl.core.types.dsl.BooleanExpression; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/dto/RoadmapOrderType.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapOrderType.java similarity index 67% rename from backend/kirikiri/src/main/java/co/kirikiri/persistence/dto/RoadmapOrderType.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapOrderType.java index fb4ccb0b6..bafb11c4c 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/dto/RoadmapOrderType.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapOrderType.java @@ -1,4 +1,4 @@ -package co.kirikiri.persistence.dto; +package co.kirikiri.roadmap.persistence.dto; public enum RoadmapOrderType { LATEST, GOAL_ROOM_COUNT, PARTICIPANT_COUNT, REVIEW_RATE diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/dto/RoadmapSearchCreatorNickname.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchCreatorNickname.java similarity index 85% rename from backend/kirikiri/src/main/java/co/kirikiri/persistence/dto/RoadmapSearchCreatorNickname.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchCreatorNickname.java index 70ab96d1d..34d7d650b 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/dto/RoadmapSearchCreatorNickname.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchCreatorNickname.java @@ -1,4 +1,4 @@ -package co.kirikiri.persistence.dto; +package co.kirikiri.roadmap.persistence.dto; public record RoadmapSearchCreatorNickname( String value diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/dto/RoadmapSearchDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchDto.java similarity index 95% rename from backend/kirikiri/src/main/java/co/kirikiri/persistence/dto/RoadmapSearchDto.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchDto.java index adde60018..92b34371d 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/dto/RoadmapSearchDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchDto.java @@ -1,4 +1,4 @@ -package co.kirikiri.persistence.dto; +package co.kirikiri.roadmap.persistence.dto; import lombok.AccessLevel; import lombok.AllArgsConstructor; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/dto/RoadmapSearchTagName.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTagName.java similarity index 94% rename from backend/kirikiri/src/main/java/co/kirikiri/persistence/dto/RoadmapSearchTagName.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTagName.java index c090385c1..1b7d42866 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/dto/RoadmapSearchTagName.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTagName.java @@ -1,4 +1,4 @@ -package co.kirikiri.persistence.dto; +package co.kirikiri.roadmap.persistence.dto; import co.kirikiri.service.exception.BadRequestException; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/dto/RoadmapSearchTitle.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTitle.java similarity index 94% rename from backend/kirikiri/src/main/java/co/kirikiri/persistence/dto/RoadmapSearchTitle.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTitle.java index 8469ce5d7..620604980 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/dto/RoadmapSearchTitle.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTitle.java @@ -1,4 +1,4 @@ -package co.kirikiri.persistence.dto; +package co.kirikiri.roadmap.persistence.dto; import co.kirikiri.service.exception.BadRequestException; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java index aec48defd..4c52b2a82 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java @@ -16,4 +16,6 @@ public interface RoadmapGoalRoomService { RoadmapGoalRoomNumberDto findRoadmapGoalRoomsByRoadmap(final Roadmap roadmap); RoadmapGoalRoomResponses makeRoadmapGoalRoomResponsesByOrderType(final Roadmap roadmap, final RoadmapGoalRoomsOrderTypeDto orderTypeDto, final CustomScrollRequest scrollRequest); + + boolean canDeleteGoalRoomsInRoadmap(final Roadmap roadmap); } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java index c9906e609..1d92295c4 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java @@ -2,8 +2,8 @@ import co.kirikiri.domain.member.Member; import co.kirikiri.domain.member.vo.Identifier; -import co.kirikiri.persistence.dto.RoadmapOrderType; -import co.kirikiri.persistence.dto.RoadmapSearchDto; +import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; +import co.kirikiri.roadmap.persistence.dto.RoadmapSearchDto; import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java index 1064fb618..e0a085088 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java @@ -1,7 +1,7 @@ package co.kirikiri.roadmap.service.mapper; import co.kirikiri.domain.member.Member; -import co.kirikiri.persistence.dto.RoadmapOrderType; +import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.service.dto.RoadmapCategoryDto; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java index 22dc685e2..75f2db430 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java @@ -1,10 +1,9 @@ package co.kirikiri.roadmap.service.scheduler; -import co.kirikiri.domain.goalroom.GoalRoom; -import co.kirikiri.persistence.goalroom.GoalRoomRepository; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapStatus; import co.kirikiri.roadmap.persistence.RoadmapRepository; +import co.kirikiri.roadmap.service.RoadmapGoalRoomService; import co.kirikiri.service.aop.ExceptionConvert; import lombok.RequiredArgsConstructor; import org.springframework.scheduling.annotation.Scheduled; @@ -19,10 +18,8 @@ @ExceptionConvert public class RoadmapScheduler { - private static final int DELETE_AFTER_MONTH = 3; - private final RoadmapRepository roadmapRepository; - private final GoalRoomRepository goalRoomRepository; + private final RoadmapGoalRoomService roadmapGoalRoomService; @Scheduled(cron = "0 0 4 * * *") public void deleteRoadmaps() { @@ -34,23 +31,12 @@ public void deleteRoadmaps() { } private void delete(final Roadmap roadmap) { - final List goalRooms = goalRoomRepository.findByRoadmap(roadmap); - final boolean canDelete = canDeleteRoadmapBasedOnGoalRooms(goalRooms); + final boolean canDelete = roadmapGoalRoomService.canDeleteGoalRoomsInRoadmap(roadmap); if (canDelete) { - deleteGoalRooms(goalRooms); deleteRoadmap(roadmap); } } - private boolean canDeleteRoadmapBasedOnGoalRooms(final List goalRooms) { - return goalRooms.stream() - .allMatch(goalRoom -> goalRoom.isCompleted() && goalRoom.isCompletedAfterMonths(DELETE_AFTER_MONTH)); - } - - private void deleteGoalRooms(final List goalRooms) { - goalRoomRepository.deleteAll(goalRooms); - } - private void deleteRoadmap(final Roadmap roadmap) { roadmapRepository.delete(roadmap); } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/member/RoadmapGoalRoomServiceImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java similarity index 86% rename from backend/kirikiri/src/main/java/co/kirikiri/service/member/RoadmapGoalRoomServiceImpl.java rename to backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java index 19b4892c9..d563a7b1f 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/member/RoadmapGoalRoomServiceImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.member; +package co.kirikiri.service.goalroom; import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomStatus; @@ -35,6 +35,8 @@ @ExceptionConvert public class RoadmapGoalRoomServiceImpl implements RoadmapGoalRoomService { + private static final int DELETE_AFTER_MONTH = 3; + private final GoalRoomRepository goalRoomRepository; private final GoalRoomMemberRepository goalRoomMemberRepository; private final FileService fileService; @@ -87,4 +89,19 @@ private MemberDto makeMemberDto(final Member creator) { final URL url = fileService.generateUrl(creator.getImage().getServerFilePath(), HttpMethod.GET); return new MemberDto(creator.getId(), creator.getNickname().getValue(), url.toExternalForm()); } + + @Override + public boolean canDeleteGoalRoomsInRoadmap(final Roadmap roadmap) { + final List goalRooms = goalRoomRepository.findByRoadmap(roadmap); + final boolean canDelete = canDeleteRoadmapBasedOnGoalRooms(goalRooms); + if (canDelete) { + goalRoomRepository.deleteAll(goalRooms); + } + return canDelete; + } + + private boolean canDeleteRoadmapBasedOnGoalRooms(final List goalRooms) { + return goalRooms.stream() + .allMatch(goalRoom -> goalRoom.isCompleted() && goalRoom.isCompletedAfterMonths(DELETE_AFTER_MONTH)); + } } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadIntegrationTest.java index 582602e94..a2420041b 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadIntegrationTest.java @@ -15,7 +15,7 @@ import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.integration.helper.InitIntegrationTest; -import co.kirikiri.persistence.dto.RoadmapOrderType; +import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadOrderIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadOrderIntegrationTest.java index 787365448..6981604bd 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadOrderIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadOrderIntegrationTest.java @@ -21,7 +21,7 @@ import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.integration.helper.InitIntegrationTest; -import co.kirikiri.persistence.dto.RoadmapOrderType; +import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; import co.kirikiri.service.dto.goalroom.request.GoalRoomCreateRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomRoadmapNodeRequest; import co.kirikiri.service.dto.member.response.MemberInformationResponse; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java index f5c6f4261..94176c97e 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java @@ -1,6 +1,6 @@ package co.kirikiri.integration.fixture; -import co.kirikiri.persistence.dto.RoadmapOrderType; +import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.service.dto.request.RoadmapCategorySaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTagNameTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTagNameTest.java index 23459fce2..1b3a1144d 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTagNameTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTagNameTest.java @@ -4,6 +4,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import co.kirikiri.roadmap.persistence.dto.RoadmapSearchTagName; import co.kirikiri.service.exception.BadRequestException; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTitleTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTitleTest.java index add4ecca9..1250fb43e 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTitleTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTitleTest.java @@ -4,6 +4,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import co.kirikiri.roadmap.persistence.dto.RoadmapSearchTitle; import co.kirikiri.service.exception.BadRequestException; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/controller/RoadmapCreateApiTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/controller/RoadmapCreateApiTest.java similarity index 97% rename from backend/kirikiri/src/test/java/co/kirikiri/controller/RoadmapCreateApiTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/controller/RoadmapCreateApiTest.java index 1041893d6..8c40d51f4 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/controller/RoadmapCreateApiTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/controller/RoadmapCreateApiTest.java @@ -1,48 +1,21 @@ -package co.kirikiri.controller; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doThrow; -import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName; -import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders; -import static org.springframework.restdocs.headers.HeaderDocumentation.responseHeaders; -import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.delete; -import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.multipart; -import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post; -import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; -import static org.springframework.restdocs.payload.PayloadDocumentation.requestFields; -import static org.springframework.restdocs.payload.PayloadDocumentation.requestPartFields; -import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; -import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName; -import static org.springframework.restdocs.request.RequestDocumentation.partWithName; -import static org.springframework.restdocs.request.RequestDocumentation.pathParameters; -import static org.springframework.restdocs.request.RequestDocumentation.requestParts; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +package co.kirikiri.roadmap.controller; import co.kirikiri.controller.helper.ControllerTestHelper; -import co.kirikiri.roadmap.controller.RoadmapController; -import co.kirikiri.service.dto.ErrorResponse; +import co.kirikiri.roadmap.service.RoadmapCreateService; +import co.kirikiri.roadmap.service.RoadmapReadService; import co.kirikiri.roadmap.service.dto.request.RoadmapCategorySaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapTagSaveRequest; +import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.exception.AuthenticationException; import co.kirikiri.service.exception.BadRequestException; import co.kirikiri.service.exception.ConflictException; import co.kirikiri.service.exception.ForbiddenException; import co.kirikiri.service.exception.NotFoundException; -import co.kirikiri.roadmap.service.RoadmapCreateService; -import co.kirikiri.roadmap.service.RoadmapReadService; import com.fasterxml.jackson.core.type.TypeReference; -import java.util.ArrayList; -import java.util.List; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; @@ -57,6 +30,21 @@ import org.springframework.test.web.servlet.ResultMatcher; import org.springframework.test.web.servlet.request.MockMultipartHttpServletRequestBuilder; +import java.util.ArrayList; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doThrow; +import static org.springframework.restdocs.headers.HeaderDocumentation.*; +import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.*; +import static org.springframework.restdocs.payload.PayloadDocumentation.*; +import static org.springframework.restdocs.request.RequestDocumentation.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + @WebMvcTest(RoadmapController.class) class RoadmapCreateApiTest extends ControllerTestHelper { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/controller/RoadmapReadApiTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/controller/RoadmapReadApiTest.java similarity index 99% rename from backend/kirikiri/src/test/java/co/kirikiri/controller/RoadmapReadApiTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/controller/RoadmapReadApiTest.java index 0696fe1d7..3aa4c2b14 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/controller/RoadmapReadApiTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/controller/RoadmapReadApiTest.java @@ -1,28 +1,10 @@ -package co.kirikiri.controller; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.when; -import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName; -import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders; -import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; -import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; -import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; -import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName; -import static org.springframework.restdocs.request.RequestDocumentation.pathParameters; -import static org.springframework.restdocs.request.RequestDocumentation.queryParameters; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +package co.kirikiri.roadmap.controller; import co.kirikiri.controller.helper.ControllerTestHelper; import co.kirikiri.domain.goalroom.GoalRoomStatus; import co.kirikiri.roadmap.domain.RoadmapDifficulty; -import co.kirikiri.roadmap.controller.RoadmapController; -import co.kirikiri.service.dto.CustomScrollRequest; -import co.kirikiri.service.dto.ErrorResponse; -import co.kirikiri.service.dto.member.response.MemberResponse; +import co.kirikiri.roadmap.service.RoadmapCreateService; +import co.kirikiri.roadmap.service.RoadmapReadService; import co.kirikiri.roadmap.service.dto.request.RoadmapOrderTypeRequest; import co.kirikiri.roadmap.service.dto.response.MemberRoadmapResponse; import co.kirikiri.roadmap.service.dto.response.MemberRoadmapResponses; @@ -36,14 +18,11 @@ import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapTagResponse; +import co.kirikiri.service.dto.CustomScrollRequest; +import co.kirikiri.service.dto.ErrorResponse; +import co.kirikiri.service.dto.member.response.MemberResponse; import co.kirikiri.service.exception.NotFoundException; -import co.kirikiri.roadmap.service.RoadmapCreateService; -import co.kirikiri.roadmap.service.RoadmapReadService; import com.fasterxml.jackson.core.type.TypeReference; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.Collections; -import java.util.List; import org.junit.jupiter.api.Test; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; @@ -52,6 +31,25 @@ import org.springframework.restdocs.snippet.Attributes; import org.springframework.test.web.servlet.MvcResult; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.when; +import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName; +import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders; +import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; +import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; +import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; +import static org.springframework.restdocs.request.RequestDocumentation.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + @WebMvcTest(RoadmapController.class) class RoadmapReadApiTest extends ControllerTestHelper { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapCategoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapCategoryTest.java similarity index 97% rename from backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapCategoryTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapCategoryTest.java index 20c59c7ea..3b81e13b5 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapCategoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapCategoryTest.java @@ -1,4 +1,4 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapContentTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentTest.java similarity index 98% rename from backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapContentTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentTest.java index 5aa1e6c33..33e0bf18c 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapContentTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentTest.java @@ -1,4 +1,4 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; import static co.kirikiri.roadmap.domain.RoadmapDifficulty.DIFFICULT; import static org.assertj.core.api.Assertions.assertThat; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapContentsTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentsTest.java similarity index 97% rename from backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapContentsTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentsTest.java index 6fb70baaf..8aee48bb8 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapContentsTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentsTest.java @@ -1,4 +1,4 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; import static org.assertj.core.api.Assertions.assertThat; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodeImagesTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodeImagesTest.java similarity index 99% rename from backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodeImagesTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodeImagesTest.java index 1c65d6c4d..f79497108 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodeImagesTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodeImagesTest.java @@ -1,4 +1,4 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodeTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodeTest.java similarity index 96% rename from backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodeTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodeTest.java index 353817bf7..4ac41db42 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodeTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodeTest.java @@ -1,4 +1,4 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; import static org.assertj.core.api.Assertions.assertThatThrownBy; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodesTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodesTest.java similarity index 97% rename from backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodesTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodesTest.java index 0cf698575..0f897fa1a 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapNodesTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodesTest.java @@ -1,4 +1,4 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertAll; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapReviewTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapReviewTest.java similarity index 98% rename from backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapReviewTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapReviewTest.java index 63ad2a2c6..3e794fff3 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapReviewTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapReviewTest.java @@ -1,4 +1,4 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapTagsTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTagsTest.java similarity index 98% rename from backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapTagsTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTagsTest.java index 9ed0db9f2..2d578fbe7 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapTagsTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTagsTest.java @@ -1,4 +1,4 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTest.java similarity index 99% rename from backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTest.java index 30e81411d..92006cdaa 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/RoadmapTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTest.java @@ -1,4 +1,4 @@ -package co.kirikiri.domain.roadmap; +package co.kirikiri.roadmap.domain; import static co.kirikiri.roadmap.domain.RoadmapDifficulty.DIFFICULT; import static org.assertj.core.api.Assertions.assertThat; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/vo/RoadmapTagNameTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/vo/RoadmapTagNameTest.java similarity index 95% rename from backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/vo/RoadmapTagNameTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/vo/RoadmapTagNameTest.java index 99b1b4f31..84fdd7532 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/roadmap/vo/RoadmapTagNameTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/vo/RoadmapTagNameTest.java @@ -1,11 +1,10 @@ -package co.kirikiri.domain.roadmap.vo; +package co.kirikiri.roadmap.domain.vo; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import co.kirikiri.roadmap.domain.exception.RoadmapException; -import co.kirikiri.roadmap.domain.vo.RoadmapTagName; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.ValueSource; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapContentRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapContentRepositoryTest.java similarity index 94% rename from backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapContentRepositoryTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapContentRepositoryTest.java index 8dfd8bd6b..a7951c67d 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapContentRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapContentRepositoryTest.java @@ -1,7 +1,4 @@ -package co.kirikiri.persistence.roadmap; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertAll; +package co.kirikiri.roadmap.persistence; import co.kirikiri.domain.member.EncryptedPassword; import co.kirikiri.domain.member.Gender; @@ -10,17 +7,17 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; +import co.kirikiri.persistence.helper.RepositoryTest; +import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; import co.kirikiri.roadmap.domain.RoadmapDifficulty; -import co.kirikiri.persistence.helper.RepositoryTest; -import co.kirikiri.persistence.member.MemberRepository; -import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; -import co.kirikiri.roadmap.persistence.RoadmapContentRepository; -import co.kirikiri.roadmap.persistence.RoadmapRepository; import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertAll; + @RepositoryTest class RoadmapContentRepositoryTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapRepositoryTest.java similarity index 99% rename from backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapRepositoryTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapRepositoryTest.java index 450923f6e..3cacee0da 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapRepositoryTest.java @@ -1,7 +1,4 @@ -package co.kirikiri.persistence.roadmap; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertAll; +package co.kirikiri.roadmap.persistence; import co.kirikiri.domain.ImageContentType; import co.kirikiri.domain.goalroom.GoalRoom; @@ -20,6 +17,10 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; +import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; +import co.kirikiri.persistence.goalroom.GoalRoomRepository; +import co.kirikiri.persistence.helper.RepositoryTest; +import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; @@ -31,20 +32,17 @@ import co.kirikiri.roadmap.domain.RoadmapTag; import co.kirikiri.roadmap.domain.RoadmapTags; import co.kirikiri.roadmap.domain.vo.RoadmapTagName; -import co.kirikiri.persistence.dto.RoadmapOrderType; -import co.kirikiri.persistence.dto.RoadmapSearchDto; -import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; -import co.kirikiri.persistence.goalroom.GoalRoomRepository; -import co.kirikiri.persistence.helper.RepositoryTest; -import co.kirikiri.persistence.member.MemberRepository; +import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; +import co.kirikiri.roadmap.persistence.dto.RoadmapSearchDto; +import org.junit.jupiter.api.Test; + import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; import java.util.Optional; -import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; -import co.kirikiri.roadmap.persistence.RoadmapRepository; -import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertAll; @RepositoryTest class RoadmapRepositoryTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapReviewRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepositoryTest.java similarity index 97% rename from backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapReviewRepositoryTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepositoryTest.java index 0a428a301..648142179 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/roadmap/RoadmapReviewRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepositoryTest.java @@ -1,7 +1,4 @@ -package co.kirikiri.persistence.roadmap; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertAll; +package co.kirikiri.roadmap.persistence; import co.kirikiri.domain.ImageContentType; import co.kirikiri.domain.member.EncryptedPassword; @@ -12,6 +9,8 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; +import co.kirikiri.persistence.helper.RepositoryTest; +import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; @@ -19,15 +18,14 @@ import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.roadmap.domain.RoadmapReview; -import co.kirikiri.persistence.helper.RepositoryTest; -import co.kirikiri.persistence.member.MemberRepository; -import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; -import co.kirikiri.roadmap.persistence.RoadmapRepository; -import co.kirikiri.roadmap.persistence.RoadmapReviewRepository; import org.junit.jupiter.api.Test; + import java.util.List; import java.util.Optional; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertAll; + @RepositoryTest class RoadmapReviewRepositoryTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapCreateEventListenerTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java similarity index 98% rename from backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapCreateEventListenerTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java index 19df3d06c..31b639392 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapCreateEventListenerTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java @@ -1,8 +1,4 @@ -package co.kirikiri.service; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +package co.kirikiri.roadmap.service; import co.kirikiri.domain.member.EncryptedPassword; import co.kirikiri.domain.member.Gender; @@ -18,17 +14,16 @@ import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.roadmap.persistence.RoadmapContentRepository; -import co.kirikiri.service.dto.FileInformation; import co.kirikiri.roadmap.service.dto.RoadmapNodeSaveDto; import co.kirikiri.roadmap.service.dto.RoadmapSaveDto; import co.kirikiri.roadmap.service.dto.RoadmapTagSaveDto; import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; import co.kirikiri.roadmap.service.event.RoadmapCreateEvent; +import co.kirikiri.service.FilePathGenerator; +import co.kirikiri.service.FileService; +import co.kirikiri.service.dto.FileInformation; import co.kirikiri.service.exception.BadRequestException; import co.kirikiri.service.exception.ServerException; -import co.kirikiri.roadmap.service.RoadmapCreateEventListener; -import java.io.IOException; -import java.util.List; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; @@ -37,6 +32,13 @@ import org.springframework.mock.web.MockMultipartFile; import org.springframework.web.multipart.MultipartFile; +import java.io.IOException; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + @ExtendWith(MockitoExtension.class) class RoadmapCreateEventListenerTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapCreateServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateServiceTest.java similarity index 99% rename from backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapCreateServiceTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateServiceTest.java index c21bfffb2..745f3dd17 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapCreateServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateServiceTest.java @@ -1,4 +1,4 @@ -package co.kirikiri.service; +package co.kirikiri.roadmap.service; import co.kirikiri.domain.member.EncryptedPassword; import co.kirikiri.domain.member.Gender; @@ -17,8 +17,6 @@ import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import co.kirikiri.roadmap.persistence.RoadmapReviewRepository; -import co.kirikiri.roadmap.service.RoadmapCreateService; -import co.kirikiri.roadmap.service.RoadmapGoalRoomService; import co.kirikiri.roadmap.service.dto.request.RoadmapCategorySaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapReadServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java similarity index 99% rename from backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapReadServiceTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java index 3d161b533..2bd8e6401 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapReadServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java @@ -1,4 +1,4 @@ -package co.kirikiri.service; +package co.kirikiri.roadmap.service; import co.kirikiri.domain.ImageContentType; import co.kirikiri.domain.goalroom.GoalRoomStatus; @@ -25,8 +25,6 @@ import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import co.kirikiri.roadmap.persistence.RoadmapReviewRepository; -import co.kirikiri.roadmap.service.RoadmapGoalRoomService; -import co.kirikiri.roadmap.service.RoadmapReadService; import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomNumberDto; import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomsOrderTypeDto; import co.kirikiri.roadmap.service.dto.request.RoadmapOrderTypeRequest; @@ -43,6 +41,7 @@ import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapTagResponse; +import co.kirikiri.service.FileService; import co.kirikiri.service.dto.CustomScrollRequest; import co.kirikiri.service.dto.member.response.MemberResponse; import co.kirikiri.service.exception.NotFoundException; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapSchedulerTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapSchedulerTest.java similarity index 63% rename from backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapSchedulerTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapSchedulerTest.java index 04b410fa3..0aa56e8dd 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/RoadmapSchedulerTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapSchedulerTest.java @@ -1,17 +1,5 @@ -package co.kirikiri.service; +package co.kirikiri.roadmap.service; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; - -import co.kirikiri.domain.goalroom.GoalRoom; -import co.kirikiri.domain.goalroom.GoalRoomRoadmapNode; -import co.kirikiri.domain.goalroom.GoalRoomRoadmapNodes; -import co.kirikiri.domain.goalroom.vo.GoalRoomName; -import co.kirikiri.domain.goalroom.vo.LimitedMemberCount; -import co.kirikiri.domain.goalroom.vo.Period; import co.kirikiri.domain.member.EncryptedPassword; import co.kirikiri.domain.member.Gender; import co.kirikiri.domain.member.Member; @@ -25,7 +13,6 @@ import co.kirikiri.roadmap.domain.RoadmapDifficulty; import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodes; -import co.kirikiri.persistence.goalroom.GoalRoomRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import co.kirikiri.roadmap.service.scheduler.RoadmapScheduler; import org.junit.jupiter.api.Test; @@ -33,10 +20,17 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; + import java.time.LocalDate; import java.util.Collections; import java.util.List; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; + @ExtendWith(MockitoExtension.class) class RoadmapSchedulerTest { @@ -47,7 +41,7 @@ class RoadmapSchedulerTest { private RoadmapRepository roadmapRepository; @Mock - private GoalRoomRepository goalRoomRepository; + private RoadmapGoalRoomService roadmapGoalRoomService; @InjectMocks private RoadmapScheduler roadmapScheduler; @@ -58,9 +52,6 @@ class RoadmapSchedulerTest { final Member member1 = new Member(new Identifier("identifier1"), new EncryptedPassword(new Password("password1!")), new Nickname("name1"), null, new MemberProfile(Gender.FEMALE, "kirikiri@email.com")); - final Member member2 = new Member(new Identifier("identifier2"), - new EncryptedPassword(new Password("password2!")), new Nickname("name2"), null, - new MemberProfile(Gender.FEMALE, "kirikiri@email.com")); final RoadmapCategory category = new RoadmapCategory("여행"); final RoadmapContent roadmapContent1_1 = new RoadmapContent("로드맵 본문2"); @@ -68,32 +59,21 @@ class RoadmapSchedulerTest { final RoadmapNode roadmapNode1 = new RoadmapNode("로드맵1 노드", "로드맵 노드 내용"); roadmapContent1_1.addNodes(new RoadmapNodes(List.of(roadmapNode1))); roadmapContent1_2.addNodes(new RoadmapNodes(List.of(roadmapNode1))); + final Roadmap roadmap1 = new Roadmap("로드맵2", "로드맵 설명2", 30, RoadmapDifficulty.DIFFICULT, member1, category); roadmap1.addContent(roadmapContent1_1); roadmap1.addContent(roadmapContent1_2); - final GoalRoom goalRoom1_1 = new GoalRoom(new GoalRoomName("골룸2"), new LimitedMemberCount(10), - roadmapContent1_1, member2); - final GoalRoom goalRoom1_2 = new GoalRoom(new GoalRoomName("골룸2-1"), new LimitedMemberCount(10), - roadmapContent1_2, member2); - - final GoalRoomRoadmapNodes goalRoomRoadmapNodes1 = new GoalRoomRoadmapNodes(List.of( - new GoalRoomRoadmapNode(new Period(TODAY, TEN_DAY_LATER), 5, roadmapNode1))); - goalRoom1_1.addAllGoalRoomRoadmapNodes(goalRoomRoadmapNodes1); - goalRoom1_2.addAllGoalRoomRoadmapNodes(goalRoomRoadmapNodes1); - given(roadmapRepository.findWithRoadmapContentByStatus(any())) .willReturn(List.of(roadmap1)); - given(goalRoomRepository.findByRoadmap(roadmap1)) - .willReturn(List.of(goalRoom1_1, goalRoom1_2)); + given(roadmapGoalRoomService.canDeleteGoalRoomsInRoadmap(any())) + .willReturn(false); // when roadmap1.delete(); - goalRoom1_1.complete(); // then assertDoesNotThrow(() -> roadmapScheduler.deleteRoadmaps()); - verify(goalRoomRepository, never()).deleteAll(any()); verify(roadmapRepository, never()).delete(any()); } @@ -103,9 +83,6 @@ class RoadmapSchedulerTest { final Member member1 = new Member(new Identifier("identifier1"), new EncryptedPassword(new Password("password1!")), new Nickname("name1"), null, new MemberProfile(Gender.FEMALE, "kirikiri@email.com")); - final Member member2 = new Member(new Identifier("identifier2"), - new EncryptedPassword(new Password("password2!")), new Nickname("name2"), null, - new MemberProfile(Gender.FEMALE, "kirikiri@email.com")); final RoadmapCategory category = new RoadmapCategory("여행"); final RoadmapContent roadmapContent1 = new RoadmapContent("로드맵 본문1"); @@ -115,24 +92,16 @@ class RoadmapSchedulerTest { final Roadmap roadmap1 = new Roadmap("로드맵1", "로드맵 설명1", 30, RoadmapDifficulty.DIFFICULT, member1, category); roadmap1.addContent(roadmapContent1); - final GoalRoom goalRoom1 = new GoalRoom(new GoalRoomName("골룸1"), new LimitedMemberCount(10), roadmapContent1, - member2); - final GoalRoomRoadmapNodes goalRoomRoadmapNodes1 = new GoalRoomRoadmapNodes(List.of( - new GoalRoomRoadmapNode(new Period(TODAY, TEN_DAY_LATER), 5, roadmapNode1))); - goalRoom1.addAllGoalRoomRoadmapNodes(goalRoomRoadmapNodes1); - given(roadmapRepository.findWithRoadmapContentByStatus(any())) .willReturn(List.of(roadmap1)); - given(goalRoomRepository.findByRoadmap(roadmap1)) - .willReturn(List.of(goalRoom1)); + given(roadmapGoalRoomService.canDeleteGoalRoomsInRoadmap(any())) + .willReturn(false); // when roadmap1.delete(); - goalRoom1.complete(); // then assertDoesNotThrow(() -> roadmapScheduler.deleteRoadmaps()); - verify(goalRoomRepository, never()).deleteAll(any()); verify(roadmapRepository, never()).delete(any()); } @@ -142,24 +111,14 @@ class RoadmapSchedulerTest { final Member member1 = new Member(new Identifier("identifier1"), new EncryptedPassword(new Password("password1!")), new Nickname("name1"), null, new MemberProfile(Gender.FEMALE, "kirikiri@email.com")); - final Member member2 = new Member(new Identifier("identifier2"), - new EncryptedPassword(new Password("password2!")), new Nickname("name2"), null, - new MemberProfile(Gender.FEMALE, "kirikiri@email.com")); final RoadmapCategory category = new RoadmapCategory("여행"); final RoadmapContent roadmapContent1 = new RoadmapContent("로드맵 본문1"); final RoadmapNode roadmapNode = new RoadmapNode("로드맵 노드", "로드맵 노드 내용"); - final Roadmap roadmap1 = new Roadmap("로드맵1", "로드맵 설명1", 30, RoadmapDifficulty.DIFFICULT, member1, category); roadmapContent1.addNodes(new RoadmapNodes(List.of(roadmapNode))); - roadmap1.addContent(roadmapContent1); - final GoalRoom goalRoom1 = new GoalRoom(new GoalRoomName("골룸1"), new LimitedMemberCount(10), roadmapContent1, - member2); - - final GoalRoomRoadmapNodes goalRoomRoadmapNodes = new GoalRoomRoadmapNodes(List.of( - new GoalRoomRoadmapNode(new Period(TODAY, TEN_DAY_LATER), 5, roadmapNode))); - goalRoom1.addAllGoalRoomRoadmapNodes(goalRoomRoadmapNodes); - goalRoom1.complete(); + final Roadmap roadmap1 = new Roadmap("로드맵1", "로드맵 설명1", 30, RoadmapDifficulty.DIFFICULT, member1, category); + roadmap1.addContent(roadmapContent1); given(roadmapRepository.findWithRoadmapContentByStatus(any())) .willReturn(Collections.emptyList()); @@ -167,7 +126,6 @@ class RoadmapSchedulerTest { // when // then assertDoesNotThrow(() -> roadmapScheduler.deleteRoadmaps()); - verify(goalRoomRepository, never()).findByRoadmap(any()); verify(roadmapRepository, never()).deleteAll(any()); } } From 3c0ba17ca9c3b79c66d71e43b739d2df3c241b93 Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Fri, 22 Dec 2023 14:06:48 +0900 Subject: [PATCH 05/22] =?UTF-8?q?refactor:=20Roadmap=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=B0=9C=EC=83=9D=ED=95=9C=20=EC=98=88=EC=99=B8=EB=8A=94=20Roa?= =?UTF-8?q?admapException=EC=9D=84=20=EB=8D=98=EC=A7=80=EB=8F=84=EB=A1=9D?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../roadmap/persistence/dto/RoadmapSearchTagName.java | 4 ++-- .../kirikiri/roadmap/persistence/dto/RoadmapSearchTitle.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTagName.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTagName.java index 1b7d42866..85b2649e2 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTagName.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTagName.java @@ -1,6 +1,6 @@ package co.kirikiri.roadmap.persistence.dto; -import co.kirikiri.service.exception.BadRequestException; +import co.kirikiri.roadmap.domain.exception.RoadmapException; public record RoadmapSearchTagName( String value @@ -20,7 +20,7 @@ private String removeBlank(final String name) { private void validateLength(final String name) { if (name.length() < MIN_LENGTH) { - throw new BadRequestException( + throw new RoadmapException( String.format("검색어는 최소 %d자부터 가능합니다.", MIN_LENGTH)); } } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTitle.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTitle.java index 620604980..9b7b139ad 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTitle.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTitle.java @@ -1,6 +1,6 @@ package co.kirikiri.roadmap.persistence.dto; -import co.kirikiri.service.exception.BadRequestException; +import co.kirikiri.roadmap.domain.exception.RoadmapException; public record RoadmapSearchTitle( String value @@ -20,7 +20,7 @@ private String removeBlank(final String title) { private void validateLength(final String title) { if (title.length() < MIN_LENGTH) { - throw new BadRequestException( + throw new RoadmapException( String.format("검색어는 최소 %d자부터 가능합니다.", MIN_LENGTH)); } } From 354f9b60f07d03d3bd4469a5d9788b4d9626c2e7 Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Fri, 22 Dec 2023 14:27:16 +0900 Subject: [PATCH 06/22] =?UTF-8?q?refactor:=20RoadmapSaveArgumentResolver?= =?UTF-8?q?=20=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=97=AD=EC=A0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resolver/RoadmapSaveArgumentResolver.java | 94 +--------------- .../RoadmapSaveArgumentResolverImpl.java | 100 ++++++++++++++++++ 2 files changed, 101 insertions(+), 93 deletions(-) create mode 100644 backend/kirikiri/src/main/java/co/kirikiri/roadmap/resolver/RoadmapSaveArgumentResolverImpl.java diff --git a/backend/kirikiri/src/main/java/co/kirikiri/common/resolver/RoadmapSaveArgumentResolver.java b/backend/kirikiri/src/main/java/co/kirikiri/common/resolver/RoadmapSaveArgumentResolver.java index f0bf30836..f23d7f97e 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/common/resolver/RoadmapSaveArgumentResolver.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/common/resolver/RoadmapSaveArgumentResolver.java @@ -1,98 +1,6 @@ package co.kirikiri.common.resolver; -import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; -import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; -import co.kirikiri.service.exception.BadRequestException; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import jakarta.servlet.http.HttpServletRequest; -import java.util.List; -import lombok.RequiredArgsConstructor; -import org.springframework.core.MethodParameter; -import org.springframework.stereotype.Component; -import org.springframework.validation.DataBinder; -import org.springframework.validation.Validator; -import org.springframework.web.bind.MethodArgumentNotValidException; -import org.springframework.web.bind.support.WebDataBinderFactory; -import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.method.support.HandlerMethodArgumentResolver; -import org.springframework.web.method.support.ModelAndViewContainer; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; -import org.springframework.web.multipart.MultipartResolver; -import org.springframework.web.multipart.support.StandardServletMultipartResolver; -@Component -@RequiredArgsConstructor -public class RoadmapSaveArgumentResolver implements HandlerMethodArgumentResolver { - - private final ObjectMapper objectMapper; - private final Validator validator; - - @Override - public boolean supportsParameter(final MethodParameter parameter) { - return parameter.getParameterType().equals(RoadmapSaveRequest.class); - } - - @Override - public Object resolveArgument(final MethodParameter parameter, final ModelAndViewContainer mavContainer, - final NativeWebRequest nativeWebRequest, final WebDataBinderFactory binderFactory) - throws MethodArgumentNotValidException { - final HttpServletRequest request = (HttpServletRequest) nativeWebRequest.getNativeRequest(); - checkMultipart(request); - final MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; - final RoadmapSaveRequest roadmapSaveRequestNotIncludeImage = makeRoadmapSaveRequestNotIncludeImage( - multipartRequest); - validateRequest(parameter, roadmapSaveRequestNotIncludeImage); - return makeRoadmapSaveRequestIncludeImage(roadmapSaveRequestNotIncludeImage, multipartRequest); - } - - private void checkMultipart(final HttpServletRequest request) { - final MultipartResolver multipartResolver = new StandardServletMultipartResolver(); - if (!multipartResolver.isMultipart(request)) { - throw new BadRequestException("multipart/form-data 형식으로 들어와야합니다."); - } - } - - private RoadmapSaveRequest makeRoadmapSaveRequestNotIncludeImage( - final MultipartHttpServletRequest multipartRequest) { - final String jsonData = getJsonData(multipartRequest); - return bindRoadmapSaveRequest(jsonData); - } - - private void validateRequest(final MethodParameter parameter, final RoadmapSaveRequest roadmapSaveRequest) - throws MethodArgumentNotValidException { - final DataBinder binder = new DataBinder(roadmapSaveRequest); - binder.setValidator(validator); - binder.validate(); - - if (binder.getBindingResult().hasErrors()) { - throw new MethodArgumentNotValidException(parameter, binder.getBindingResult()); - } - } - - private RoadmapSaveRequest makeRoadmapSaveRequestIncludeImage(final RoadmapSaveRequest roadmapSaveRequest, - final MultipartHttpServletRequest multipartRequest) { - for (final RoadmapNodeSaveRequest roadmapNode : roadmapSaveRequest.roadmapNodes()) { - final List images = multipartRequest.getFiles(roadmapNode.getTitle()); - roadmapNode.setImages(images); - } - return roadmapSaveRequest; - } - - private String getJsonData(final MultipartHttpServletRequest multipartRequest) { - final String jsonData = multipartRequest.getParameter("jsonData"); - if (jsonData == null) { - throw new BadRequestException("로드맵 생성 시 jsonData는 필수입니다."); - } - return multipartRequest.getParameter("jsonData"); - } - - private RoadmapSaveRequest bindRoadmapSaveRequest(final String jsonData) { - try { - return objectMapper.readValue(jsonData, RoadmapSaveRequest.class); - } catch (final JsonProcessingException exception) { - throw new BadRequestException("로드맵 생성 요청 형식이 틀렸습니다."); - } - } +public interface RoadmapSaveArgumentResolver extends HandlerMethodArgumentResolver { } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/resolver/RoadmapSaveArgumentResolverImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/resolver/RoadmapSaveArgumentResolverImpl.java new file mode 100644 index 000000000..4dbf0035a --- /dev/null +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/resolver/RoadmapSaveArgumentResolverImpl.java @@ -0,0 +1,100 @@ +package co.kirikiri.roadmap.resolver; + +import co.kirikiri.common.resolver.RoadmapSaveArgumentResolver; +import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; +import co.kirikiri.service.exception.BadRequestException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.servlet.http.HttpServletRequest; +import lombok.RequiredArgsConstructor; +import org.springframework.core.MethodParameter; +import org.springframework.stereotype.Component; +import org.springframework.validation.DataBinder; +import org.springframework.validation.Validator; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.support.WebDataBinderFactory; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.method.support.ModelAndViewContainer; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.multipart.MultipartResolver; +import org.springframework.web.multipart.support.StandardServletMultipartResolver; + +import java.util.List; + +@Component +@RequiredArgsConstructor +public class RoadmapSaveArgumentResolverImpl implements RoadmapSaveArgumentResolver { + + + private final ObjectMapper objectMapper; + private final Validator validator; + + @Override + public boolean supportsParameter(final MethodParameter parameter) { + return parameter.getParameterType().equals(RoadmapSaveRequest.class); + } + + @Override + public Object resolveArgument(final MethodParameter parameter, final ModelAndViewContainer mavContainer, + final NativeWebRequest nativeWebRequest, final WebDataBinderFactory binderFactory) + throws MethodArgumentNotValidException { + final HttpServletRequest request = (HttpServletRequest) nativeWebRequest.getNativeRequest(); + checkMultipart(request); + final MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + final RoadmapSaveRequest roadmapSaveRequestNotIncludeImage = makeRoadmapSaveRequestNotIncludeImage( + multipartRequest); + validateRequest(parameter, roadmapSaveRequestNotIncludeImage); + return makeRoadmapSaveRequestIncludeImage(roadmapSaveRequestNotIncludeImage, multipartRequest); + } + + private void checkMultipart(final HttpServletRequest request) { + final MultipartResolver multipartResolver = new StandardServletMultipartResolver(); + if (!multipartResolver.isMultipart(request)) { + throw new BadRequestException("multipart/form-data 형식으로 들어와야합니다."); + } + } + + private RoadmapSaveRequest makeRoadmapSaveRequestNotIncludeImage( + final MultipartHttpServletRequest multipartRequest) { + final String jsonData = getJsonData(multipartRequest); + return bindRoadmapSaveRequest(jsonData); + } + + private void validateRequest(final MethodParameter parameter, final RoadmapSaveRequest roadmapSaveRequest) + throws MethodArgumentNotValidException { + final DataBinder binder = new DataBinder(roadmapSaveRequest); + binder.setValidator(validator); + binder.validate(); + + if (binder.getBindingResult().hasErrors()) { + throw new MethodArgumentNotValidException(parameter, binder.getBindingResult()); + } + } + + private RoadmapSaveRequest makeRoadmapSaveRequestIncludeImage(final RoadmapSaveRequest roadmapSaveRequest, + final MultipartHttpServletRequest multipartRequest) { + for (final RoadmapNodeSaveRequest roadmapNode : roadmapSaveRequest.roadmapNodes()) { + final List images = multipartRequest.getFiles(roadmapNode.getTitle()); + roadmapNode.setImages(images); + } + return roadmapSaveRequest; + } + + private String getJsonData(final MultipartHttpServletRequest multipartRequest) { + final String jsonData = multipartRequest.getParameter("jsonData"); + if (jsonData == null) { + throw new BadRequestException("로드맵 생성 시 jsonData는 필수입니다."); + } + return multipartRequest.getParameter("jsonData"); + } + + private RoadmapSaveRequest bindRoadmapSaveRequest(final String jsonData) { + try { + return objectMapper.readValue(jsonData, RoadmapSaveRequest.class); + } catch (final JsonProcessingException exception) { + throw new BadRequestException("로드맵 생성 요청 형식이 틀렸습니다."); + } + } +} From c8fc8f400ab73f485f97968d4cd1a9ea2f10c717 Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Fri, 22 Dec 2023 14:43:13 +0900 Subject: [PATCH 07/22] =?UTF-8?q?test:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/RoadmapSearchTagNameTest.java | 12 +++++----- .../dto/RoadmapSearchTitleTest.java | 12 +++++----- .../RoadmapSaveArgumentResolverImplTest.java} | 22 +++++++++---------- 3 files changed, 22 insertions(+), 24 deletions(-) rename backend/kirikiri/src/test/java/co/kirikiri/{common/resolver/RoadmapSaveArgumentResolverTest.java => roadmap/resolver/RoadmapSaveArgumentResolverImplTest.java} (95%) diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTagNameTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTagNameTest.java index 1b3a1144d..8a1df63d2 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTagNameTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTagNameTest.java @@ -1,15 +1,15 @@ package co.kirikiri.persistence.dto; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - +import co.kirikiri.roadmap.domain.exception.RoadmapException; import co.kirikiri.roadmap.persistence.dto.RoadmapSearchTagName; -import co.kirikiri.service.exception.BadRequestException; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.ValueSource; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + class RoadmapSearchTagNameTest { @ParameterizedTest @@ -41,6 +41,6 @@ class RoadmapSearchTagNameTest { // expected assertThatThrownBy(() -> new RoadmapSearchTagName(name)) - .isInstanceOf(BadRequestException.class); + .isInstanceOf(RoadmapException.class); } } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTitleTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTitleTest.java index 1250fb43e..c951e1fc0 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTitleTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTitleTest.java @@ -1,15 +1,15 @@ package co.kirikiri.persistence.dto; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - +import co.kirikiri.roadmap.domain.exception.RoadmapException; import co.kirikiri.roadmap.persistence.dto.RoadmapSearchTitle; -import co.kirikiri.service.exception.BadRequestException; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.ValueSource; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + class RoadmapSearchTitleTest { @ParameterizedTest @@ -41,6 +41,6 @@ class RoadmapSearchTitleTest { // expected assertThatThrownBy(() -> new RoadmapSearchTitle(title)) - .isInstanceOf(BadRequestException.class); + .isInstanceOf(RoadmapException.class); } } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/common/resolver/RoadmapSaveArgumentResolverTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/resolver/RoadmapSaveArgumentResolverImplTest.java similarity index 95% rename from backend/kirikiri/src/test/java/co/kirikiri/common/resolver/RoadmapSaveArgumentResolverTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/resolver/RoadmapSaveArgumentResolverImplTest.java index 5b22e1772..5a7e9d2b1 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/common/resolver/RoadmapSaveArgumentResolverTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/resolver/RoadmapSaveArgumentResolverImplTest.java @@ -1,15 +1,10 @@ -package co.kirikiri.common.resolver; +package co.kirikiri.roadmap.resolver; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.Mockito.when; - -import co.kirikiri.service.dto.member.request.MemberJoinRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; +import co.kirikiri.service.dto.member.request.MemberJoinRequest; import co.kirikiri.service.exception.BadRequestException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import javax.xml.validation.Validator; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; @@ -23,15 +18,18 @@ import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.method.support.ModelAndViewContainer; +import javax.xml.validation.Validator; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.Mockito.when; + @ExtendWith(MockitoExtension.class) -class RoadmapSaveArgumentResolverTest { +class RoadmapSaveArgumentResolverImplTest { @Mock private ObjectMapper objectMapper; - @Mock - private Validator validator; - @Mock private MethodParameter parameter; @@ -45,7 +43,7 @@ class RoadmapSaveArgumentResolverTest { private WebDataBinderFactory binderFactory; @InjectMocks - private RoadmapSaveArgumentResolver resolver; + private RoadmapSaveArgumentResolverImpl resolver; @Test void 정상적으로_핸들러의_파라미터가_객체를_타도록_한다() { From a3075252f623e0b4d936b1738d3ba50719595ce2 Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Fri, 22 Dec 2023 15:13:06 +0900 Subject: [PATCH 08/22] =?UTF-8?q?chore:=20build.gradle=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(jacoco=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BB=A4?= =?UTF-8?q?=EB=B2=84=EB=A6=AC=EC=A7=80)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/kirikiri/build.gradle | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/kirikiri/build.gradle b/backend/kirikiri/build.gradle index 7bd653e1d..8325548e4 100644 --- a/backend/kirikiri/build.gradle +++ b/backend/kirikiri/build.gradle @@ -73,6 +73,7 @@ jacocoTestReport { fileTree(dir: it, excludes: [ "co/kirikiri/persistence/QuerydslRepositorySupporter", "co/kirikiri/domain/**", + "co/kirikiri/**/domain/**", "co/kirikiri/persistence/goalroom/dto/**", "**/*Application*", "**/*Config*", @@ -115,7 +116,8 @@ jacocoTestCoverageVerification { excludes = [ "co.kirikiri.persistence.QuerydslRepositorySupporter", - "co.kirikiri.domain.**.**", + "co.kirikiri.domain.**", + "co.kirikiri.**.domain.**", "co.kirikiri.persistence.goalroom.dto.**", "**.*Application*", "**.*Config*", From 7ce0184ac887acc8a051200f7a48c3d13c4a49d4 Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Fri, 12 Jan 2024 23:51:20 +0900 Subject: [PATCH 09/22] =?UTF-8?q?refactor:=20roadmap=EA=B3=BC=20roadmapRev?= =?UTF-8?q?iew=EC=97=90=EC=84=9C=20member=20=EC=A7=81=EC=A0=91=20=EC=B0=B8?= =?UTF-8?q?=EC=A1=B0=EB=A5=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kirikiri/common/config/RedisConfig.java | 3 +- .../co/kirikiri/common/config/WebConfig.java | 1 + .../kirikiri/controller/AuthController.java | 1 + .../controller/GlobalExceptionHandler.java | 3 +- .../controller/GoalRoomController.java | 5 +- .../kirikiri/controller/MemberController.java | 3 +- .../domain/BaseCreatedTimeEntity.java | 1 + .../java/co/kirikiri/domain/BaseEntity.java | 1 + .../domain/BaseUpdatedTimeEntity.java | 1 + .../co/kirikiri/domain/ImageContentType.java | 1 + .../domain/goalroom/BaseGoalRoomMember.java | 7 ++- .../kirikiri/domain/goalroom/CheckFeed.java | 1 + .../co/kirikiri/domain/goalroom/GoalRoom.java | 5 +- .../domain/goalroom/GoalRoomMember.java | 1 + .../domain/goalroom/GoalRoomMembers.java | 7 ++- .../goalroom/GoalRoomPendingMember.java | 3 +- .../goalroom/GoalRoomPendingMembers.java | 7 ++- .../domain/goalroom/GoalRoomRoadmapNode.java | 3 +- .../domain/goalroom/GoalRoomRoadmapNodes.java | 5 +- .../domain/goalroom/GoalRoomToDo.java | 1 + .../domain/goalroom/GoalRoomToDos.java | 1 + .../kirikiri/domain/goalroom/vo/Period.java | 5 +- .../domain/member/EncryptedPassword.java | 5 +- .../kirikiri/domain/member/vo/Identifier.java | 3 +- .../kirikiri/domain/member/vo/Nickname.java | 3 +- .../kirikiri/infra/AmazonS3FileService.java | 7 ++- .../co/kirikiri/infra/CloudFrontService.java | 5 +- .../infra/NaverOauthNetworkService.java | 1 + .../QuerydslRepositorySupporter.java | 3 +- .../auth/RefreshTokenRepositoryImpl.java | 5 +- .../goalroom/CheckFeedQueryRepository.java | 1 + .../CheckFeedQueryRepositoryImpl.java | 11 ++-- .../goalroom/CheckFeedRepository.java | 1 + .../GoalRoomMemberJdbcRepository.java | 1 + .../GoalRoomMemberJdbcRepositoryImpl.java | 3 +- .../GoalRoomMemberQueryRepository.java | 1 + .../goalroom/GoalRoomMemberRepository.java | 5 +- .../GoalRoomPendingMemberQueryRepository.java | 1 + ...lRoomPendingMemberQueryRepositoryImpl.java | 11 ++-- .../GoalRoomPendingMemberRepository.java | 5 +- .../goalroom/GoalRoomQueryRepository.java | 3 +- .../goalroom/GoalRoomToDoCheckRepository.java | 1 + .../member/MemberQueryRepository.java | 1 + .../member/MemberQueryRepositoryImpl.java | 9 +-- .../persistence/member/MemberRepository.java | 1 + .../co/kirikiri/roadmap/domain/Roadmap.java | 34 +++++------ .../roadmap/domain/RoadmapContent.java | 3 +- .../roadmap/domain/RoadmapContents.java | 1 + .../roadmap/domain/RoadmapNodeImages.java | 3 +- .../kirikiri/roadmap/domain/RoadmapNodes.java | 5 +- .../roadmap/domain/RoadmapReview.java | 16 +++-- .../roadmap/domain/RoadmapReviews.java | 1 + .../kirikiri/roadmap/domain/RoadmapTag.java | 1 + .../kirikiri/roadmap/domain/RoadmapTags.java | 7 ++- .../roadmap/domain/vo/RoadmapTagName.java | 3 +- .../RoadmapCategoryRepository.java | 1 + .../persistence/RoadmapContentRepository.java | 1 + .../persistence/RoadmapNodeRepository.java | 1 + .../persistence/RoadmapQueryRepository.java | 6 +- .../RoadmapQueryRepositoryImpl.java | 24 ++++---- .../RoadmapReviewQueryRepository.java | 7 ++- .../RoadmapReviewQueryRepositoryImpl.java | 9 +-- .../persistence/RoadmapReviewRepository.java | 4 +- .../roadmap/service/RoadmapCreateService.java | 35 +++++------ .../roadmap/service/RoadmapReadService.java | 19 +++--- .../roadmap/service/dto/RoadmapDto.java | 1 + .../service/dto/RoadmapForListDto.java | 1 + .../service/dto/RoadmapNodeSaveDto.java | 1 + .../roadmap/service/dto/RoadmapReviewDto.java | 4 +- .../service/dto/RoadmapReviewReadDto.java | 1 + .../roadmap/service/dto/RoadmapSaveDto.java | 1 + .../dto/request/RoadmapNodeSaveRequest.java | 1 + .../dto/request/RoadmapSaveRequest.java | 1 + .../dto/response/RoadmapForListResponse.java | 1 + .../dto/response/RoadmapGoalRoomResponse.java | 1 + .../service/dto/response/RoadmapResponse.java | 1 + .../dto/response/RoadmapReviewResponse.java | 1 + .../roadmap/service/mapper/RoadmapMapper.java | 7 +-- .../kirikiri/service/CacheKeyGenerator.java | 5 +- .../java/co/kirikiri/service/FileService.java | 1 + .../kirikiri/service/OauthNetworkService.java | 1 + .../service/RandomNumberGenerator.java | 1 + .../service/UUIDFilePathGenerator.java | 3 +- .../co/kirikiri/service/auth/AuthService.java | 3 +- .../service/auth/JwtTokenProvider.java | 7 ++- .../service/auth/NaverOauthService.java | 9 +-- .../dto/goalroom/GoalRoomCreateDto.java | 1 + .../goalroom/MemberGoalRoomForListDto.java | 1 + .../request/GoalRoomCreateRequest.java | 1 + .../request/GoalRoomRoadmapNodeRequest.java | 1 + .../goalroom/request/GoalRoomTodoRequest.java | 1 + .../dto/member/request/GenderType.java | 1 + .../response/MemberGoalRoomResponse.java | 1 + .../goalroom/GoalRoomCreateService.java | 13 +++-- .../service/goalroom/GoalRoomReadService.java | 11 ++-- .../service/mapper/GoalRoomMapper.java | 15 ++--- .../service/mapper/ScrollResponseMapper.java | 1 + .../service/member/MemberService.java | 7 ++- .../service/scheduler/GoalRoomScheduler.java | 5 +- .../interceptor/AuthInterceptorTest.java | 12 ++-- .../MemberIdentifierArgumentResolverTest.java | 13 +++-- .../controller/AuthCreateApiTest.java | 25 ++++---- .../controller/GoalRoomCreateApiTest.java | 42 +++++--------- .../controller/GoalRoomReadApiTest.java | 41 +++++++------ .../controller/MemberCreateApiTest.java | 25 ++++---- .../controller/MemberReadApiTest.java | 24 ++++---- .../helper/ControllerTestHelper.java | 7 ++- .../helper/FieldDescriptionHelper.java | 6 +- .../controller/helper/RestDocsHelper.java | 5 +- .../domain/goalroom/GoalRoomMemberTest.java | 5 +- .../domain/goalroom/GoalRoomMembersTest.java | 5 +- .../goalroom/GoalRoomPendingMemberTest.java | 5 +- .../goalroom/GoalRoomPendingMembersTest.java | 9 +-- .../goalroom/GoalRoomRoadmapNodeTest.java | 11 ++-- .../goalroom/GoalRoomRoadmapNodesTest.java | 17 +++--- .../domain/goalroom/GoalRoomTest.java | 15 ++--- .../domain/goalroom/GoalRoomToDoTest.java | 9 +-- .../domain/goalroom/GoalRoomToDosTest.java | 5 +- .../domain/goalroom/vo/GoalRoomNameTest.java | 6 +- .../goalroom/vo/GoalRoomTodoContentTest.java | 6 +- .../goalroom/vo/LimitedMemberCountTest.java | 6 +- .../member/vo/EncryptedPasswordTest.java | 4 +- .../domain/member/vo/IdentifierTest.java | 6 +- .../domain/member/vo/NicknameTest.java | 6 +- .../domain/member/vo/PasswordTest.java | 6 +- .../infra/AmazonS3FileServiceTest.java | 21 +++---- .../kirikiri/infra/CloudFrontServiceTest.java | 13 +++-- .../infra/NaverOauthNetworkServiceTest.java | 15 +++-- .../AuthenticationIntegrationTest.java | 15 ++--- .../GoalRoomCreateIntegrationTest.java | 52 +++++------------ .../GoalRoomReadIntegrationTest.java | 58 ++++++------------- .../GoalRoomSchedulerIntegrationTest.java | 37 +++++------- .../MemberCreateIntegrationTest.java | 8 +-- .../MemberReadIntegrationTest.java | 12 +--- .../RoadmapCreateIntegrationTest.java | 28 ++++----- .../RoadmapReadIntegrationTest.java | 22 +++---- .../RoadmapReadOrderIntegrationTest.java | 35 ++++------- .../RoadmapReviewCreateIntegrationTest.java | 28 ++++----- .../RoadmapReviewReadIntegrationTest.java | 26 ++++----- .../RoadmapSearchIntegrationTest.java | 14 ++--- .../fixture/AuthenticationAPIFixture.java | 10 ++-- .../integration/fixture/CommonFixture.java | 4 +- .../fixture/GoalRoomAPIFixture.java | 11 ++-- .../integration/fixture/MemberAPIFixture.java | 10 ++-- .../fixture/RoadmapAPIFixture.java | 2 +- .../integration/helper/DatabaseCleaner.java | 1 + .../helper/InitIntegrationTest.java | 11 ++-- .../integration/helper/TestFileService.java | 1 + .../helper/TestRefreshTokenRepository.java | 5 +- .../helper/TestTransactionService.java | 18 +++--- .../auth/RefreshTokenRepositoryTest.java | 11 ++-- .../goalroom/CheckFeedRepositoryTest.java | 15 ++--- .../GoalRoomMemberRepositoryTest.java | 17 +++--- .../GoalRoomPendingMemberRepositoryTest.java | 13 +++-- .../goalroom/GoalRoomRepositoryTest.java | 15 ++--- .../GoalRoomToDoCheckRepositoryTest.java | 13 +++-- .../persistence/helper/RepositoryTest.java | 9 +-- .../member/MemberRepositoryTest.java | 7 ++- .../roadmap/domain/RoadmapCategoryTest.java | 7 +-- .../roadmap/domain/RoadmapContentTest.java | 27 +++------ .../roadmap/domain/RoadmapContentsTest.java | 9 +-- .../roadmap/domain/RoadmapNodeImagesTest.java | 11 ++-- .../roadmap/domain/RoadmapNodeTest.java | 5 +- .../roadmap/domain/RoadmapNodesTest.java | 10 ++-- .../roadmap/domain/RoadmapReviewTest.java | 34 ++++------- .../roadmap/domain/RoadmapTagsTest.java | 13 ++--- .../kirikiri/roadmap/domain/RoadmapTest.java | 31 +++++----- .../roadmap/domain/vo/RoadmapTagNameTest.java | 8 +-- .../RoadmapContentRepositoryTest.java | 2 +- .../persistence/RoadmapRepositoryTest.java | 22 +++---- .../RoadmapReviewRepositoryTest.java | 33 +++++------ .../RoadmapSaveArgumentResolverImplTest.java | 2 - .../RoadmapCreateEventListenerTest.java | 19 ++---- .../service/RoadmapCreateServiceTest.java | 10 ++-- .../service/RoadmapReadServiceTest.java | 28 ++++++--- .../roadmap/service/RoadmapSchedulerTest.java | 6 +- .../co/kirikiri/service/AuthServiceTest.java | 13 +++-- .../service/CacheKeyGeneratorTest.java | 5 +- .../service/GoalRoomCreateServiceTest.java | 53 ++++++++--------- .../service/GoalRoomReadServiceTest.java | 41 ++++++------- .../service/GoalRoomSchedulerTest.java | 35 ++++++----- .../service/JwtTokenProviderTest.java | 11 ++-- .../kirikiri/service/MemberServiceTest.java | 19 +++--- .../service/NaverOauthServiceTest.java | 11 ++-- .../service/UUIDFilePathGeneratorTest.java | 6 +- .../dto/member/request/GenderTypeTest.java | 4 +- 186 files changed, 877 insertions(+), 921 deletions(-) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/common/config/RedisConfig.java b/backend/kirikiri/src/main/java/co/kirikiri/common/config/RedisConfig.java index e49a413d9..408248209 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/common/config/RedisConfig.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/common/config/RedisConfig.java @@ -2,7 +2,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import java.time.Duration; import org.springframework.cache.CacheManager; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; @@ -17,6 +16,8 @@ import org.springframework.data.redis.serializer.RedisSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer; +import java.time.Duration; + @Configuration @EnableCaching @Profile(value = {"prod", "dev", "local"}) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/common/config/WebConfig.java b/backend/kirikiri/src/main/java/co/kirikiri/common/config/WebConfig.java index 73fca7c9f..2e4d0d052 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/common/config/WebConfig.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/common/config/WebConfig.java @@ -8,6 +8,7 @@ import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + import java.util.List; @Configuration diff --git a/backend/kirikiri/src/main/java/co/kirikiri/controller/AuthController.java b/backend/kirikiri/src/main/java/co/kirikiri/controller/AuthController.java index dfbdd8620..95c7355d6 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/controller/AuthController.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/controller/AuthController.java @@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; + import java.util.Map; @RestController diff --git a/backend/kirikiri/src/main/java/co/kirikiri/controller/GlobalExceptionHandler.java b/backend/kirikiri/src/main/java/co/kirikiri/controller/GlobalExceptionHandler.java index 181ac9cb0..77834c63a 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/controller/GlobalExceptionHandler.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/controller/GlobalExceptionHandler.java @@ -8,7 +8,6 @@ import co.kirikiri.service.exception.NotFoundException; import co.kirikiri.service.exception.ServerException; import com.fasterxml.jackson.databind.exc.InvalidFormatException; -import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; @@ -17,6 +16,8 @@ import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; +import java.util.List; + @RestControllerAdvice public class GlobalExceptionHandler { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/controller/GoalRoomController.java b/backend/kirikiri/src/main/java/co/kirikiri/controller/GoalRoomController.java index 671c65dd8..0f51809cb 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/controller/GoalRoomController.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/controller/GoalRoomController.java @@ -19,8 +19,6 @@ import co.kirikiri.service.goalroom.GoalRoomCreateService; import co.kirikiri.service.goalroom.GoalRoomReadService; import jakarta.validation.Valid; -import java.net.URI; -import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -34,6 +32,9 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import java.net.URI; +import java.util.List; + @RestController @RequestMapping("/goal-rooms") @RequiredArgsConstructor diff --git a/backend/kirikiri/src/main/java/co/kirikiri/controller/MemberController.java b/backend/kirikiri/src/main/java/co/kirikiri/controller/MemberController.java index 84c47dead..9088ed454 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/controller/MemberController.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/controller/MemberController.java @@ -2,10 +2,10 @@ import co.kirikiri.common.interceptor.Authenticated; import co.kirikiri.common.resolver.MemberIdentifier; -import co.kirikiri.service.member.MemberService; import co.kirikiri.service.dto.member.request.MemberJoinRequest; import co.kirikiri.service.dto.member.response.MemberInformationForPublicResponse; import co.kirikiri.service.dto.member.response.MemberInformationResponse; +import co.kirikiri.service.member.MemberService; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; @@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; + import java.net.URI; @RestController diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/BaseCreatedTimeEntity.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/BaseCreatedTimeEntity.java index 383bd9634..669a6e991 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/BaseCreatedTimeEntity.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/BaseCreatedTimeEntity.java @@ -3,6 +3,7 @@ import jakarta.persistence.Column; import jakarta.persistence.MappedSuperclass; import jakarta.persistence.PrePersist; + import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/BaseEntity.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/BaseEntity.java index a66368c62..16bc4d1ee 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/BaseEntity.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/BaseEntity.java @@ -4,6 +4,7 @@ import jakarta.persistence.GenerationType; import jakarta.persistence.Id; import jakarta.persistence.MappedSuperclass; + import java.util.Objects; @MappedSuperclass diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/BaseUpdatedTimeEntity.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/BaseUpdatedTimeEntity.java index 7434bf778..04b45f71a 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/BaseUpdatedTimeEntity.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/BaseUpdatedTimeEntity.java @@ -3,6 +3,7 @@ import jakarta.persistence.Column; import jakarta.persistence.MappedSuperclass; import jakarta.persistence.PreUpdate; + import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/ImageContentType.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/ImageContentType.java index 9d8a4df07..ec98711f7 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/ImageContentType.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/ImageContentType.java @@ -1,6 +1,7 @@ package co.kirikiri.domain; import co.kirikiri.domain.exception.ImageExtensionException; + import java.util.Arrays; public enum ImageContentType { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/BaseGoalRoomMember.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/BaseGoalRoomMember.java index e034bc6d6..bb87a1069 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/BaseGoalRoomMember.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/BaseGoalRoomMember.java @@ -10,13 +10,14 @@ import jakarta.persistence.ManyToOne; import jakarta.persistence.MappedSuperclass; import jakarta.persistence.PrePersist; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.Objects; import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.springframework.data.annotation.CreatedDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Objects; + @MappedSuperclass @NoArgsConstructor(access = AccessLevel.PROTECTED) public abstract class BaseGoalRoomMember extends BaseEntity { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/CheckFeed.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/CheckFeed.java index f77f8fe01..3750c09a5 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/CheckFeed.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/CheckFeed.java @@ -12,6 +12,7 @@ import jakarta.persistence.ManyToOne; import lombok.AccessLevel; import lombok.NoArgsConstructor; + import java.time.LocalDateTime; @Entity diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoom.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoom.java index 474549cdb..be56b50fa 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoom.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoom.java @@ -14,13 +14,14 @@ import jakarta.persistence.FetchType; import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + import java.time.LocalDate; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; import java.util.Optional; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; @Entity @NoArgsConstructor(access = AccessLevel.PROTECTED) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomMember.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomMember.java index d99074fcd..fb3937c7a 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomMember.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomMember.java @@ -5,6 +5,7 @@ import jakarta.persistence.Entity; import lombok.AccessLevel; import lombok.NoArgsConstructor; + import java.time.LocalDateTime; @Entity diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomMembers.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomMembers.java index f05d9d369..2452ad244 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomMembers.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomMembers.java @@ -6,13 +6,14 @@ import jakarta.persistence.Embeddable; import jakarta.persistence.FetchType; import jakarta.persistence.OneToMany; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.hibernate.annotations.BatchSize; + import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Optional; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import org.hibernate.annotations.BatchSize; @Embeddable @NoArgsConstructor(access = AccessLevel.PROTECTED) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomPendingMember.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomPendingMember.java index ab671fb74..cd784be54 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomPendingMember.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomPendingMember.java @@ -2,10 +2,11 @@ import co.kirikiri.domain.member.Member; import jakarta.persistence.Entity; -import java.time.LocalDateTime; import lombok.AccessLevel; import lombok.NoArgsConstructor; +import java.time.LocalDateTime; + @Entity @NoArgsConstructor(access = AccessLevel.PROTECTED) public class GoalRoomPendingMember extends BaseGoalRoomMember { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembers.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembers.java index 6cd84a26c..9744dfc1f 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembers.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembers.java @@ -6,13 +6,14 @@ import jakarta.persistence.Embeddable; import jakarta.persistence.FetchType; import jakarta.persistence.OneToMany; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.hibernate.annotations.BatchSize; + import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Optional; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import org.hibernate.annotations.BatchSize; @Embeddable @NoArgsConstructor(access = AccessLevel.PROTECTED) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNode.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNode.java index eb1f0b49b..16d6e4ed7 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNode.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNode.java @@ -9,10 +9,11 @@ import jakarta.persistence.FetchType; import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; -import java.time.LocalDate; import lombok.AccessLevel; import lombok.NoArgsConstructor; +import java.time.LocalDate; + @Entity @NoArgsConstructor(access = AccessLevel.PROTECTED) public class GoalRoomRoadmapNode extends BaseEntity { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodes.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodes.java index 83401f80d..ada2fe776 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodes.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodes.java @@ -6,6 +6,9 @@ import jakarta.persistence.FetchType; import jakarta.persistence.JoinColumn; import jakarta.persistence.OneToMany; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + import java.time.LocalDate; import java.time.temporal.ChronoUnit; import java.util.ArrayList; @@ -13,8 +16,6 @@ import java.util.List; import java.util.Optional; import java.util.stream.IntStream; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; @Embeddable @NoArgsConstructor(access = AccessLevel.PROTECTED) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomToDo.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomToDo.java index 3f84a708b..e17a05e14 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomToDo.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomToDo.java @@ -7,6 +7,7 @@ import jakarta.persistence.Entity; import lombok.AccessLevel; import lombok.NoArgsConstructor; + import java.time.LocalDate; @Entity diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomToDos.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomToDos.java index 1a1106bba..84c52a8a9 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomToDos.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomToDos.java @@ -7,6 +7,7 @@ import jakarta.persistence.OneToMany; import lombok.AccessLevel; import lombok.NoArgsConstructor; + import java.util.ArrayList; import java.util.List; import java.util.Optional; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/vo/Period.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/vo/Period.java index 881202f46..e8fa79720 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/vo/Period.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/vo/Period.java @@ -3,11 +3,12 @@ import co.kirikiri.domain.goalroom.exception.GoalRoomException; import jakarta.persistence.Column; import jakarta.persistence.Embeddable; -import java.time.LocalDate; -import java.time.temporal.ChronoUnit; import lombok.AccessLevel; import lombok.NoArgsConstructor; +import java.time.LocalDate; +import java.time.temporal.ChronoUnit; + @Embeddable @NoArgsConstructor(access = AccessLevel.PROTECTED) public class Period { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/member/EncryptedPassword.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/member/EncryptedPassword.java index 3dfb27793..9ec198275 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/member/EncryptedPassword.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/member/EncryptedPassword.java @@ -2,13 +2,14 @@ import co.kirikiri.domain.exception.UnexpectedDomainException; import co.kirikiri.domain.member.vo.Password; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.util.Base64; import java.util.Objects; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; @NoArgsConstructor(access = AccessLevel.PROTECTED) public class EncryptedPassword { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/member/vo/Identifier.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/member/vo/Identifier.java index f3ee6e3c1..af5778003 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/member/vo/Identifier.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/member/vo/Identifier.java @@ -2,10 +2,11 @@ import co.kirikiri.domain.member.exception.MemberException; import jakarta.persistence.Column; -import java.util.Objects; import lombok.AccessLevel; import lombok.NoArgsConstructor; +import java.util.Objects; + @NoArgsConstructor(access = AccessLevel.PROTECTED) public class Identifier { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/member/vo/Nickname.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/member/vo/Nickname.java index 3032a52a4..b3ede9a53 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/member/vo/Nickname.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/member/vo/Nickname.java @@ -2,9 +2,10 @@ import co.kirikiri.domain.member.exception.MemberException; import jakarta.persistence.Column; -import java.util.Objects; import lombok.NoArgsConstructor; +import java.util.Objects; + @NoArgsConstructor public class Nickname { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/infra/AmazonS3FileService.java b/backend/kirikiri/src/main/java/co/kirikiri/infra/AmazonS3FileService.java index 429359a26..a412f13d9 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/infra/AmazonS3FileService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/infra/AmazonS3FileService.java @@ -7,14 +7,15 @@ import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.model.GeneratePresignedUrlRequest; import com.amazonaws.services.s3.model.ObjectMetadata; -import java.io.InputStream; -import java.net.URL; -import java.util.Date; import lombok.RequiredArgsConstructor; import org.springframework.core.env.Environment; import org.springframework.http.HttpMethod; import org.springframework.stereotype.Service; +import java.io.InputStream; +import java.net.URL; +import java.util.Date; + @Service @RequiredArgsConstructor public class AmazonS3FileService implements FileService { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/infra/CloudFrontService.java b/backend/kirikiri/src/main/java/co/kirikiri/infra/CloudFrontService.java index 2c95c30ff..d041f1347 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/infra/CloudFrontService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/infra/CloudFrontService.java @@ -1,12 +1,13 @@ package co.kirikiri.infra; import co.kirikiri.service.exception.ServerException; -import java.net.MalformedURLException; -import java.net.URL; import lombok.RequiredArgsConstructor; import org.springframework.core.env.Environment; import org.springframework.stereotype.Service; +import java.net.MalformedURLException; +import java.net.URL; + @Service @RequiredArgsConstructor public class CloudFrontService { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/infra/NaverOauthNetworkService.java b/backend/kirikiri/src/main/java/co/kirikiri/infra/NaverOauthNetworkService.java index 6cd0e7cd1..9eafb79a1 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/infra/NaverOauthNetworkService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/infra/NaverOauthNetworkService.java @@ -9,6 +9,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; + import java.util.Map; @Service diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/QuerydslRepositorySupporter.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/QuerydslRepositorySupporter.java index 685533ef7..178cf0e92 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/QuerydslRepositorySupporter.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/QuerydslRepositorySupporter.java @@ -9,7 +9,6 @@ import com.querydsl.jpa.impl.JPAQueryFactory; import jakarta.annotation.PostConstruct; import jakarta.persistence.EntityManager; -import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cglib.core.internal.Function; import org.springframework.data.domain.Page; @@ -18,6 +17,8 @@ import org.springframework.data.support.PageableExecutionUtils; import org.springframework.stereotype.Repository; +import java.util.List; + @Repository public abstract class QuerydslRepositorySupporter { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/auth/RefreshTokenRepositoryImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/auth/RefreshTokenRepositoryImpl.java index 7ca0a5de2..fe89127c8 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/auth/RefreshTokenRepositoryImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/auth/RefreshTokenRepositoryImpl.java @@ -1,11 +1,12 @@ package co.kirikiri.persistence.auth; -import java.util.Optional; -import java.util.concurrent.TimeUnit; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Repository; +import java.util.Optional; +import java.util.concurrent.TimeUnit; + @Repository public class RefreshTokenRepositoryImpl implements RefreshTokenRepository { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/CheckFeedQueryRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/CheckFeedQueryRepository.java index 5cb828965..677a8bace 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/CheckFeedQueryRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/CheckFeedQueryRepository.java @@ -3,6 +3,7 @@ import co.kirikiri.domain.goalroom.CheckFeed; import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomRoadmapNode; + import java.util.List; public interface CheckFeedQueryRepository { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/CheckFeedQueryRepositoryImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/CheckFeedQueryRepositoryImpl.java index be35407bd..aa0b79680 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/CheckFeedQueryRepositoryImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/CheckFeedQueryRepositoryImpl.java @@ -1,17 +1,18 @@ package co.kirikiri.persistence.goalroom; -import static co.kirikiri.domain.goalroom.QCheckFeed.checkFeed; -import static co.kirikiri.domain.goalroom.QGoalRoomMember.goalRoomMember; -import static co.kirikiri.domain.member.QMember.member; -import static co.kirikiri.domain.member.QMemberImage.memberImage; - import co.kirikiri.domain.goalroom.CheckFeed; import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomRoadmapNode; import co.kirikiri.persistence.QuerydslRepositorySupporter; import com.querydsl.core.types.dsl.BooleanExpression; + import java.util.List; +import static co.kirikiri.domain.goalroom.QCheckFeed.checkFeed; +import static co.kirikiri.domain.goalroom.QGoalRoomMember.goalRoomMember; +import static co.kirikiri.domain.member.QMember.member; +import static co.kirikiri.domain.member.QMemberImage.memberImage; + public class CheckFeedQueryRepositoryImpl extends QuerydslRepositorySupporter implements CheckFeedQueryRepository { public CheckFeedQueryRepositoryImpl() { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/CheckFeedRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/CheckFeedRepository.java index 25f009dcd..805b89009 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/CheckFeedRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/CheckFeedRepository.java @@ -6,6 +6,7 @@ import co.kirikiri.domain.goalroom.GoalRoomRoadmapNode; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; + import java.time.LocalDateTime; import java.util.List; import java.util.Optional; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberJdbcRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberJdbcRepository.java index 9a7b2e8b5..65e97ed21 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberJdbcRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberJdbcRepository.java @@ -1,6 +1,7 @@ package co.kirikiri.persistence.goalroom; import co.kirikiri.domain.goalroom.GoalRoomMember; + import java.util.List; public interface GoalRoomMemberJdbcRepository { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberJdbcRepositoryImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberJdbcRepositoryImpl.java index 28758b191..af197737f 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberJdbcRepositoryImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberJdbcRepositoryImpl.java @@ -1,10 +1,11 @@ package co.kirikiri.persistence.goalroom; import co.kirikiri.domain.goalroom.GoalRoomMember; -import java.util.List; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Repository; +import java.util.List; + @Repository public class GoalRoomMemberJdbcRepositoryImpl implements GoalRoomMemberJdbcRepository { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberQueryRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberQueryRepository.java index 0087e6a93..6e887fcc0 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberQueryRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberQueryRepository.java @@ -5,6 +5,7 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.persistence.goalroom.dto.GoalRoomMemberSortType; import org.springframework.data.repository.query.Param; + import java.util.List; import java.util.Optional; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepository.java index aa1f912c8..f9d825e74 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepository.java @@ -3,12 +3,13 @@ import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomMember; import co.kirikiri.domain.member.vo.Identifier; -import java.util.List; -import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; +import java.util.List; +import java.util.Optional; + public interface GoalRoomMemberRepository extends JpaRepository, GoalRoomMemberQueryRepository, GoalRoomMemberJdbcRepository { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberQueryRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberQueryRepository.java index ab5d88527..34a07b485 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberQueryRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberQueryRepository.java @@ -2,6 +2,7 @@ import co.kirikiri.domain.goalroom.GoalRoomPendingMember; import co.kirikiri.persistence.goalroom.dto.GoalRoomMemberSortType; + import java.util.List; public interface GoalRoomPendingMemberQueryRepository { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberQueryRepositoryImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberQueryRepositoryImpl.java index 036c074d8..5a9cc8683 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberQueryRepositoryImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberQueryRepositoryImpl.java @@ -1,16 +1,17 @@ package co.kirikiri.persistence.goalroom; -import static co.kirikiri.domain.goalroom.QGoalRoomPendingMember.goalRoomPendingMember; -import static co.kirikiri.domain.member.QMember.member; -import static co.kirikiri.domain.member.QMemberImage.memberImage; -import static co.kirikiri.persistence.goalroom.dto.GoalRoomMemberSortType.JOINED_DESC; - import co.kirikiri.domain.goalroom.GoalRoomPendingMember; import co.kirikiri.persistence.QuerydslRepositorySupporter; import co.kirikiri.persistence.goalroom.dto.GoalRoomMemberSortType; import com.querydsl.core.types.OrderSpecifier; + import java.util.List; +import static co.kirikiri.domain.goalroom.QGoalRoomPendingMember.goalRoomPendingMember; +import static co.kirikiri.domain.member.QMember.member; +import static co.kirikiri.domain.member.QMemberImage.memberImage; +import static co.kirikiri.persistence.goalroom.dto.GoalRoomMemberSortType.JOINED_DESC; + public class GoalRoomPendingMemberQueryRepositoryImpl extends QuerydslRepositorySupporter implements GoalRoomPendingMemberQueryRepository { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepository.java index cdd2d45db..1c8dc0eb9 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepository.java @@ -3,13 +3,14 @@ import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomPendingMember; import co.kirikiri.domain.member.vo.Identifier; -import java.util.List; -import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; +import java.util.List; +import java.util.Optional; + public interface GoalRoomPendingMemberRepository extends JpaRepository, GoalRoomPendingMemberQueryRepository { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepository.java index c4ca95054..ee15abe48 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepository.java @@ -3,8 +3,9 @@ import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomStatus; import co.kirikiri.domain.member.Member; -import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.persistence.goalroom.dto.RoadmapGoalRoomsOrderType; +import co.kirikiri.roadmap.domain.Roadmap; + import java.time.LocalDate; import java.util.List; import java.util.Optional; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepository.java index bc5609216..060cb4987 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepository.java @@ -8,6 +8,7 @@ import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; + import java.util.List; import java.util.Optional; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/member/MemberQueryRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/member/MemberQueryRepository.java index 8a11d80b8..e3b7c07e7 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/member/MemberQueryRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/member/MemberQueryRepository.java @@ -1,6 +1,7 @@ package co.kirikiri.persistence.member; import co.kirikiri.domain.member.Member; + import java.util.Optional; public interface MemberQueryRepository { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/member/MemberQueryRepositoryImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/member/MemberQueryRepositoryImpl.java index 9d725af72..364e0a4b8 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/member/MemberQueryRepositoryImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/member/MemberQueryRepositoryImpl.java @@ -1,13 +1,14 @@ package co.kirikiri.persistence.member; -import static co.kirikiri.domain.member.QMember.member; -import static co.kirikiri.domain.member.QMemberImage.memberImage; -import static co.kirikiri.domain.member.QMemberProfile.memberProfile; - import co.kirikiri.domain.member.Member; import co.kirikiri.persistence.QuerydslRepositorySupporter; + import java.util.Optional; +import static co.kirikiri.domain.member.QMember.member; +import static co.kirikiri.domain.member.QMemberImage.memberImage; +import static co.kirikiri.domain.member.QMemberProfile.memberProfile; + public class MemberQueryRepositoryImpl extends QuerydslRepositorySupporter implements MemberQueryRepository { public MemberQueryRepositoryImpl() { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/member/MemberRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/member/MemberRepository.java index 4dd4e97ca..09a712f1a 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/member/MemberRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/member/MemberRepository.java @@ -4,6 +4,7 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import org.springframework.data.jpa.repository.JpaRepository; + import java.util.Optional; public interface MemberRepository extends JpaRepository, MemberQueryRepository { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/Roadmap.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/Roadmap.java index 6af0662b4..384c6c00a 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/Roadmap.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/Roadmap.java @@ -1,7 +1,6 @@ package co.kirikiri.roadmap.domain; import co.kirikiri.domain.BaseCreatedTimeEntity; -import co.kirikiri.domain.member.Member; import co.kirikiri.roadmap.domain.exception.RoadmapException; import jakarta.persistence.Column; import jakarta.persistence.Embedded; @@ -11,12 +10,13 @@ import jakarta.persistence.FetchType; import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; -import java.util.Objects; -import java.util.Optional; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; +import java.util.Objects; +import java.util.Optional; + @Entity @NoArgsConstructor(access = AccessLevel.PROTECTED) @AllArgsConstructor @@ -46,9 +46,7 @@ public class Roadmap extends BaseCreatedTimeEntity { @Column(length = 10, nullable = false) private RoadmapStatus status = RoadmapStatus.CREATED; - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "member_id", nullable = false, updatable = false) - private Member creator; + private Long creatorId; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "category_id", nullable = false) @@ -64,23 +62,23 @@ public class Roadmap extends BaseCreatedTimeEntity { private RoadmapReviews reviews = new RoadmapReviews(); public Roadmap(final String title, final String introduction, final int requiredPeriod, - final RoadmapDifficulty difficulty, final Member creator, final RoadmapCategory category) { - this(null, title, introduction, requiredPeriod, difficulty, RoadmapStatus.CREATED, creator, category); + final RoadmapDifficulty difficulty, final Long creatorId, final RoadmapCategory category) { + this(null, title, introduction, requiredPeriod, difficulty, RoadmapStatus.CREATED, creatorId, category); } public Roadmap(final String title, final String introduction, final Integer requiredPeriod, - final RoadmapDifficulty difficulty, final RoadmapStatus status, final Member creator, + final RoadmapDifficulty difficulty, final RoadmapStatus status, final Long creatorId, final RoadmapCategory category) { - this(null, title, introduction, requiredPeriod, difficulty, status, creator, category); + this(null, title, introduction, requiredPeriod, difficulty, status, creatorId, category); } public Roadmap(final Long id, final String title, final String introduction, final Integer requiredPeriod, - final RoadmapDifficulty difficulty, final Member creator, final RoadmapCategory category) { - this(id, title, introduction, requiredPeriod, difficulty, RoadmapStatus.CREATED, creator, category); + final RoadmapDifficulty difficulty, final Long creatorId, final RoadmapCategory category) { + this(id, title, introduction, requiredPeriod, difficulty, RoadmapStatus.CREATED, creatorId, category); } public Roadmap(final Long id, final String title, final String introduction, final Integer requiredPeriod, - final RoadmapDifficulty difficulty, final RoadmapStatus status, final Member creator, + final RoadmapDifficulty difficulty, final RoadmapStatus status, final Long creatorId, final RoadmapCategory category) { validate(title, introduction, requiredPeriod); this.id = id; @@ -89,7 +87,7 @@ public Roadmap(final Long id, final String title, final String introduction, fin this.requiredPeriod = requiredPeriod; this.difficulty = difficulty; this.status = status; - this.creator = creator; + this.creatorId = creatorId; this.category = category; } @@ -136,8 +134,8 @@ public void addTags(final RoadmapTags tags) { this.tags.addAll(tags); } - public boolean isCreator(final Member member) { - return Objects.equals(creator.getId(), member.getId()); + public boolean isCreator(final Long memberId) { + return Objects.equals(creatorId, memberId); } public void addReview(final RoadmapReview review) { @@ -159,8 +157,8 @@ public boolean isDeleted() { return status == RoadmapStatus.DELETED; } - public Member getCreator() { - return creator; + public Long getCreatorId() { + return creatorId; } public String getTitle() { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContent.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContent.java index 692b6dfc8..dfa9db0d8 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContent.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContent.java @@ -8,11 +8,12 @@ import jakarta.persistence.FetchType; import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; -import java.util.Optional; import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; +import java.util.Optional; + @Entity @NoArgsConstructor(access = AccessLevel.PROTECTED) @Getter diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContents.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContents.java index 18eb219ca..99b0816de 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContents.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContents.java @@ -7,6 +7,7 @@ import jakarta.persistence.OneToMany; import lombok.AccessLevel; import lombok.NoArgsConstructor; + import java.util.ArrayList; import java.util.List; import java.util.Optional; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodeImages.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodeImages.java index 4af543a71..bc4c85ae1 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodeImages.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodeImages.java @@ -6,9 +6,10 @@ import jakarta.persistence.FetchType; import jakarta.persistence.JoinColumn; import jakarta.persistence.OneToMany; +import lombok.NoArgsConstructor; + import java.util.ArrayList; import java.util.List; -import lombok.NoArgsConstructor; @Embeddable @NoArgsConstructor diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodes.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodes.java index 6f6440960..ee8a0236e 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodes.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodes.java @@ -5,12 +5,13 @@ import jakarta.persistence.Embeddable; import jakarta.persistence.FetchType; import jakarta.persistence.OneToMany; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; @Embeddable @NoArgsConstructor(access = AccessLevel.PROTECTED) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReview.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReview.java index af3bf5c2a..9a507b2cf 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReview.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReview.java @@ -1,17 +1,17 @@ package co.kirikiri.roadmap.domain; import co.kirikiri.domain.BaseUpdatedTimeEntity; -import co.kirikiri.domain.member.Member; import co.kirikiri.roadmap.domain.exception.RoadmapException; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; -import java.util.regex.Pattern; import lombok.AccessLevel; import lombok.NoArgsConstructor; +import java.util.regex.Pattern; + @Entity @NoArgsConstructor(access = AccessLevel.PROTECTED) public class RoadmapReview extends BaseUpdatedTimeEntity { @@ -29,21 +29,19 @@ public class RoadmapReview extends BaseUpdatedTimeEntity { @Column(nullable = false) private Double rate = 0.0; - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "member_id") - private Member member; + private Long memberId; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "roadmap_id") private Roadmap roadmap; - public RoadmapReview(final String content, final Double rate, final Member member) { + public RoadmapReview(final String content, final Double rate, final Long memberId) { if (content != null) { validate(content, rate); } this.content = content; this.rate = rate; - this.member = member; + this.memberId = memberId; } private void validate(final String content, final Double rate) { @@ -82,7 +80,7 @@ public Double getRate() { return rate; } - public Member getMember() { - return member; + public Long getMemberId() { + return memberId; } } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReviews.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReviews.java index 9880cd83d..98fcc7353 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReviews.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReviews.java @@ -6,6 +6,7 @@ import jakarta.persistence.OneToMany; import lombok.AccessLevel; import lombok.NoArgsConstructor; + import java.util.ArrayList; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapTag.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapTag.java index e536bc274..d13c71da0 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapTag.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapTag.java @@ -6,6 +6,7 @@ import jakarta.persistence.Entity; import lombok.AccessLevel; import lombok.NoArgsConstructor; + import java.util.Objects; @Entity diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapTags.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapTags.java index 4b6b079c7..183011fe4 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapTags.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapTags.java @@ -7,13 +7,14 @@ import jakarta.persistence.FetchType; import jakarta.persistence.JoinColumn; import jakarta.persistence.OneToMany; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.hibernate.annotations.BatchSize; + import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.stream.Collectors; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import org.hibernate.annotations.BatchSize; @Embeddable @NoArgsConstructor(access = AccessLevel.PROTECTED) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/vo/RoadmapTagName.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/vo/RoadmapTagName.java index 41d519546..ca565b294 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/vo/RoadmapTagName.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/vo/RoadmapTagName.java @@ -2,10 +2,11 @@ import co.kirikiri.roadmap.domain.exception.RoadmapException; import jakarta.persistence.Column; -import java.util.Objects; import lombok.AccessLevel; import lombok.NoArgsConstructor; +import java.util.Objects; + @NoArgsConstructor(access = AccessLevel.PROTECTED) public class RoadmapTagName { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapCategoryRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapCategoryRepository.java index a7250e476..037355644 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapCategoryRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapCategoryRepository.java @@ -2,6 +2,7 @@ import co.kirikiri.roadmap.domain.RoadmapCategory; import org.springframework.data.jpa.repository.JpaRepository; + import java.util.Optional; public interface RoadmapCategoryRepository extends JpaRepository { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapContentRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapContentRepository.java index c2202f00f..cdc7c8f7e 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapContentRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapContentRepository.java @@ -5,6 +5,7 @@ import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; + import java.util.Optional; public interface RoadmapContentRepository extends JpaRepository { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapNodeRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapNodeRepository.java index ad15f7806..888791a32 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapNodeRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapNodeRepository.java @@ -3,6 +3,7 @@ import co.kirikiri.roadmap.domain.RoadmapContent; import co.kirikiri.roadmap.domain.RoadmapNode; import org.springframework.data.jpa.repository.JpaRepository; + import java.util.List; public interface RoadmapNodeRepository extends JpaRepository { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepository.java index b17a7a2e4..b81b33520 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepository.java @@ -24,9 +24,9 @@ List findRoadmapsByCond(final RoadmapSearchDto searchRequest, final Long lastId, final int pageSize); - List findRoadmapsWithCategoryByMemberOrderByLatest(final Member member, - final Long lastId, - final int pageSize); + List findRoadmapsWithCategoryByMemberIdOrderByLatest(final Member member, + final Long lastId, + final int pageSize); Optional findByIdAndMemberIdentifier(final Long roadmapId, final String identifier); diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepositoryImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepositoryImpl.java index 5ed3b1ee2..ac3b03b6f 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepositoryImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepositoryImpl.java @@ -42,8 +42,6 @@ public RoadmapQueryRepositoryImpl() { @Override public Optional findRoadmapById(final Long roadmapId) { return Optional.ofNullable(selectFrom(roadmap) - .innerJoin(roadmap.creator, member) - .fetchJoin() .innerJoin(roadmap.category, roadmapCategory) .fetchJoin() .leftJoin(roadmap.tags.values, roadmapTag) @@ -58,8 +56,6 @@ public List findRoadmapsByCategory(final RoadmapCategory category, fina return selectFrom(roadmap) .innerJoin(roadmap.category, roadmapCategory) .fetchJoin() - .innerJoin(roadmap.creator, member) - .fetchJoin() .where( lessThanLastId(lastId, orderType), statusCond(RoadmapStatus.CREATED), @@ -75,8 +71,6 @@ public List findRoadmapsByCond(final RoadmapSearchDto searchRequest, fi return selectFrom(roadmap) .innerJoin(roadmap.category, roadmapCategory) .fetchJoin() - .innerJoin(roadmap.creator, member) - .fetchJoin() .where( lessThanLastId(lastId, orderType), statusCond(RoadmapStatus.CREATED), @@ -89,9 +83,9 @@ public List findRoadmapsByCond(final RoadmapSearchDto searchRequest, fi } @Override - public List findRoadmapsWithCategoryByMemberOrderByLatest(final Member member, - final Long lastId, - final int pageSize) { + public List findRoadmapsWithCategoryByMemberIdOrderByLatest(final Member member, + final Long lastId, + final int pageSize) { final RoadmapOrderType orderType = RoadmapOrderType.LATEST; return selectFrom(roadmap) .innerJoin(roadmap.category, roadmapCategory) @@ -151,14 +145,17 @@ private BooleanExpression creatorIdCond(final Long creatorId) { if (creatorId == null) { return null; } - return roadmap.creator.id.eq(creatorId); + return roadmap.creatorId.eq(creatorId); } private BooleanExpression creatorNicknameCond(final RoadmapSearchCreatorNickname creatorName) { if (creatorName == null) { return null; } - return roadmap.creator.nickname.value.eq(creatorName.value()); + return roadmap.creatorId + .eq(select(member.id) + .from(member) + .where(member.nickname.value.eq(creatorName.value()))); } private BooleanExpression tagCond(final RoadmapSearchTagName tagName) { @@ -239,6 +236,9 @@ private BooleanExpression lessThanLastId(final Long lastId, final RoadmapOrderTy private BooleanExpression creatorIdentifierCond(final String identifier) { final Identifier creatorIdentifier = new Identifier(identifier); - return roadmap.creator.identifier.eq(creatorIdentifier); + return roadmap.creatorId + .eq(select(member.id) + .from(member) + .where(member.identifier.eq(creatorIdentifier))); } } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepository.java index a4cd62e5c..182b4cf5f 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepository.java @@ -2,11 +2,12 @@ import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapReview; + import java.util.List; public interface RoadmapReviewQueryRepository { - List findRoadmapReviewWithMemberByRoadmapOrderByLatest(final Roadmap roadmap, - final Long lastId, - final int pageSize); + List findRoadmapReviewByRoadmapOrderByLatest(final Roadmap roadmap, + final Long lastId, + final int pageSize); } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepositoryImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepositoryImpl.java index 7c9ffcb94..609a77951 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepositoryImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepositoryImpl.java @@ -9,7 +9,6 @@ import java.time.LocalDateTime; import java.util.List; -import static co.kirikiri.domain.member.QMember.member; import static co.kirikiri.roadmap.domain.QRoadmapReview.roadmapReview; public class RoadmapReviewQueryRepositoryImpl extends QuerydslRepositorySupporter implements @@ -20,12 +19,10 @@ public RoadmapReviewQueryRepositoryImpl() { } @Override - public List findRoadmapReviewWithMemberByRoadmapOrderByLatest(final Roadmap roadmap, - final Long lastId, - final int pageSize) { + public List findRoadmapReviewByRoadmapOrderByLatest(final Roadmap roadmap, + final Long lastId, + final int pageSize) { return selectFrom(roadmapReview) - .innerJoin(roadmapReview.member, member) - .fetchJoin() .where(roadmapCond(roadmap), lessThanLastId(lastId)) .limit(pageSize) .orderBy(orderByCreatedAtDesc()) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepository.java index cf275af3d..a2b1f4bd5 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepository.java @@ -1,12 +1,12 @@ package co.kirikiri.roadmap.persistence; -import co.kirikiri.domain.member.Member; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapReview; import org.springframework.data.jpa.repository.JpaRepository; + import java.util.Optional; public interface RoadmapReviewRepository extends JpaRepository, RoadmapReviewQueryRepository { - Optional findByRoadmapAndMember(final Roadmap roadmap, final Member member); + Optional findByRoadmapAndMemberId(final Roadmap roadmap, final Long memberId); } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java index 8218242bf..3586c164e 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java @@ -57,7 +57,7 @@ public Long create(final RoadmapSaveRequest request, final String identifier) { final Member member = findMemberByIdentifier(identifier); final RoadmapCategory roadmapCategory = findRoadmapCategoryById(request.categoryId()); final RoadmapSaveDto roadmapSaveDto = RoadmapMapper.convertToRoadmapSaveDto(request); - final Roadmap roadmap = createRoadmap(member, roadmapSaveDto, roadmapCategory); + final Roadmap roadmap = createRoadmap(member.getId(), roadmapSaveDto, roadmapCategory); final Roadmap savedRoadmap = roadmapRepository.save(roadmap); applicationEventPublisher.publishEvent(new RoadmapCreateEvent(savedRoadmap, roadmapSaveDto)); @@ -75,12 +75,12 @@ private RoadmapCategory findRoadmapCategoryById(final Long categoryId) { .orElseThrow(() -> new NotFoundException("존재하지 않는 카테고리입니다. categoryId = " + categoryId)); } - private Roadmap createRoadmap(final Member member, final RoadmapSaveDto roadmapSaveDto, + private Roadmap createRoadmap(final Long memberId, final RoadmapSaveDto roadmapSaveDto, final RoadmapCategory roadmapCategory) { final RoadmapNodes roadmapNodes = makeRoadmapNodes(roadmapSaveDto.roadmapNodes()); final RoadmapContent roadmapContent = makeRoadmapContent(roadmapSaveDto, roadmapNodes); final RoadmapTags roadmapTags = makeRoadmapTags(roadmapSaveDto.tags()); - final Roadmap roadmap = makeRoadmap(member, roadmapSaveDto, roadmapCategory); + final Roadmap roadmap = makeRoadmap(memberId, roadmapSaveDto, roadmapCategory); roadmap.addContent(roadmapContent); roadmap.addTags(roadmapTags); return roadmap; @@ -108,21 +108,22 @@ private RoadmapTags makeRoadmapTags(final List roadmapTagSave ); } - private Roadmap makeRoadmap(final Member member, final RoadmapSaveDto roadmapSaveDto, + private Roadmap makeRoadmap(final Long memberId, final RoadmapSaveDto roadmapSaveDto, final RoadmapCategory roadmapCategory) { return new Roadmap(roadmapSaveDto.title(), roadmapSaveDto.introduction(), - roadmapSaveDto.requiredPeriod(), RoadmapDifficulty.valueOf(roadmapSaveDto.difficulty().name()), member, + roadmapSaveDto.requiredPeriod(), RoadmapDifficulty.valueOf(roadmapSaveDto.difficulty().name()), memberId, roadmapCategory); } public void createReview(final Long roadmapId, final String identifier, final RoadmapReviewSaveRequest request) { final Roadmap roadmap = findRoadmapById(roadmapId); - final Member member = roadmapGoalRoomService.findCompletedGoalRoomMember(roadmapId, identifier); - final RoadmapReviewDto roadmapReviewDto = RoadmapMapper.convertRoadmapReviewDto(request, member); - validateReviewQualification(roadmap, member); - validateReviewCount(roadmap, member); - final RoadmapReview roadmapReview = new RoadmapReview(roadmapReviewDto.content(), roadmapReviewDto.rate(), - roadmapReviewDto.member()); + final Long memberId = roadmapGoalRoomService.findCompletedGoalRoomMember(roadmapId, identifier) + .getId(); + + validateReviewQualification(roadmap, memberId); + validateReviewCount(roadmap, memberId); + final RoadmapReviewDto roadmapReviewDto = RoadmapMapper.convertRoadmapReviewDto(request, memberId); + final RoadmapReview roadmapReview = new RoadmapReview(roadmapReviewDto.content(), roadmapReviewDto.rate(), memberId); roadmap.addReview(roadmapReview); } @@ -131,17 +132,17 @@ private Roadmap findRoadmapById(final Long id) { .orElseThrow(() -> new NotFoundException("존재하지 않는 로드맵입니다. roadmapId = " + id)); } - private void validateReviewQualification(final Roadmap roadmap, final Member member) { - if (roadmap.isCreator(member)) { + private void validateReviewQualification(final Roadmap roadmap, final Long memberId) { + if (roadmap.isCreator(memberId)) { throw new BadRequestException( - "로드맵 생성자는 리뷰를 달 수 없습니다. roadmapId = " + roadmap.getId() + " memberId = " + member.getId()); + "로드맵 생성자는 리뷰를 달 수 없습니다. roadmapId = " + roadmap.getId() + " memberId = " + memberId); } } - private void validateReviewCount(final Roadmap roadmap, final Member member) { - if (roadmapReviewRepository.findByRoadmapAndMember(roadmap, member).isPresent()) { + private void validateReviewCount(final Roadmap roadmap, final Long memberId) { + if (roadmapReviewRepository.findByRoadmapAndMemberId(roadmap, memberId).isPresent()) { throw new BadRequestException( - "이미 작성한 리뷰가 존재합니다. roadmapId = " + roadmap.getId() + " memberId = " + member.getId()); + "이미 작성한 리뷰가 존재합니다. roadmapId = " + roadmap.getId() + " memberId = " + memberId); } } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java index 1d92295c4..e80458caa 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java @@ -2,8 +2,6 @@ import co.kirikiri.domain.member.Member; import co.kirikiri.domain.member.vo.Identifier; -import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; -import co.kirikiri.roadmap.persistence.dto.RoadmapSearchDto; import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; @@ -16,6 +14,8 @@ import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import co.kirikiri.roadmap.persistence.RoadmapReviewRepository; +import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; +import co.kirikiri.roadmap.persistence.dto.RoadmapSearchDto; import co.kirikiri.roadmap.service.dto.RoadmapCategoryDto; import co.kirikiri.roadmap.service.dto.RoadmapContentDto; import co.kirikiri.roadmap.service.dto.RoadmapDto; @@ -85,7 +85,7 @@ private RoadmapContent findRecentContent(final Roadmap roadmap) { private RoadmapDto makeRoadmapDto(final Roadmap roadmap, final RoadmapContent roadmapContent) { final RoadmapCategory category = roadmap.getCategory(); - final Member creator = roadmap.getCreator(); + final Member creator = findMemberById(roadmap.getCreatorId()); final RoadmapContentDto roadmapContentDto = new RoadmapContentDto( roadmapContent.getId(), roadmapContent.getContent(), @@ -96,6 +96,11 @@ private RoadmapDto makeRoadmapDto(final Roadmap roadmap, final RoadmapContent ro roadmap.getCreatedAt(), makeRoadmapTagDtos(roadmap.getTags())); } + private Member findMemberById(final Long memberId) { + return memberRepository.findWithMemberProfileAndImageById(memberId) + .orElseThrow(() -> new NotFoundException("존재하지 않는 회원입니다.")); + } + private MemberDto makeMemberDto(final Member creator) { final URL url = fileService.generateUrl(creator.getImage().getServerFilePath(), HttpMethod.GET); return new MemberDto(creator.getId(), creator.getNickname().getValue(), url.toExternalForm()); @@ -158,7 +163,7 @@ private RoadmapForListDto makeRoadmapForListDto(final Roadmap roadmap) { final RoadmapCategory category = roadmap.getCategory(); final RoadmapCategoryDto roadmapCategoryDto = new RoadmapCategoryDto(category.getId(), category.getName()); - final Member creator = roadmap.getCreator(); + final Member creator = findMemberById(roadmap.getCreatorId()); final URL creatorImageUrl = fileService.generateUrl(creator.getImage().getServerFilePath(), HttpMethod.GET); final MemberDto memberDto = new MemberDto(creator.getId(), creator.getNickname().getValue(), creatorImageUrl.toExternalForm()); @@ -206,7 +211,7 @@ public List findAllRoadmapCategories() { public MemberRoadmapResponses findAllMemberRoadmaps(final String identifier, final CustomScrollRequest scrollRequest) { final Member member = findMemberByIdentifier(identifier); - final List roadmaps = roadmapRepository.findRoadmapsWithCategoryByMemberOrderByLatest(member, + final List roadmaps = roadmapRepository.findRoadmapsWithCategoryByMemberIdOrderByLatest(member, scrollRequest.lastId(), scrollRequest.size()); return RoadmapMapper.convertMemberRoadmapResponses(roadmaps, scrollRequest.size()); } @@ -226,7 +231,7 @@ public RoadmapGoalRoomResponses findRoadmapGoalRoomsByOrderType(final Long roadm public List findRoadmapReviews(final Long roadmapId, final CustomScrollRequest scrollRequest) { final Roadmap roadmap = findRoadmapById(roadmapId); - final List roadmapReviews = roadmapReviewRepository.findRoadmapReviewWithMemberByRoadmapOrderByLatest( + final List roadmapReviews = roadmapReviewRepository.findRoadmapReviewByRoadmapOrderByLatest( roadmap, scrollRequest.lastId(), scrollRequest.size()); final List roadmapReviewReadDtos = makeRoadmapReviewReadDtos(roadmapReviews); return RoadmapMapper.convertToRoadmapReviewResponses(roadmapReviewReadDtos); @@ -239,7 +244,7 @@ public List makeRoadmapReviewReadDtos(final List convertRoadmapCategoryResponses( } public static RoadmapReviewDto convertRoadmapReviewDto(final RoadmapReviewSaveRequest request, - final Member member) { - return new RoadmapReviewDto(request.content(), request.rate(), member); + final Long memberId) { + return new RoadmapReviewDto(request.content(), request.rate(), memberId); } public static MemberRoadmapResponses convertMemberRoadmapResponses(final List roadmaps, diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/CacheKeyGenerator.java b/backend/kirikiri/src/main/java/co/kirikiri/service/CacheKeyGenerator.java index 2a11fcd5d..0b84a20fa 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/CacheKeyGenerator.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/CacheKeyGenerator.java @@ -1,10 +1,11 @@ package co.kirikiri.service; +import org.springframework.cache.interceptor.KeyGenerator; +import org.springframework.stereotype.Component; + import java.lang.reflect.Method; import java.util.Arrays; import java.util.stream.Collectors; -import org.springframework.cache.interceptor.KeyGenerator; -import org.springframework.stereotype.Component; @Component public class CacheKeyGenerator implements KeyGenerator { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/FileService.java b/backend/kirikiri/src/main/java/co/kirikiri/service/FileService.java index 74aa91ac8..38be87317 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/FileService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/FileService.java @@ -2,6 +2,7 @@ import co.kirikiri.service.dto.FileInformation; import org.springframework.http.HttpMethod; + import java.net.URL; public interface FileService { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/OauthNetworkService.java b/backend/kirikiri/src/main/java/co/kirikiri/service/OauthNetworkService.java index ad5f67286..42f5f49d2 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/OauthNetworkService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/OauthNetworkService.java @@ -1,6 +1,7 @@ package co.kirikiri.service; import org.springframework.http.ResponseEntity; + import java.util.Map; public interface OauthNetworkService { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/RandomNumberGenerator.java b/backend/kirikiri/src/main/java/co/kirikiri/service/RandomNumberGenerator.java index edc031a4b..c8a94bb34 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/RandomNumberGenerator.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/RandomNumberGenerator.java @@ -1,6 +1,7 @@ package co.kirikiri.service; import org.springframework.stereotype.Component; + import java.util.Random; @Component diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/UUIDFilePathGenerator.java b/backend/kirikiri/src/main/java/co/kirikiri/service/UUIDFilePathGenerator.java index 6d6450e2c..96b7117c5 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/UUIDFilePathGenerator.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/UUIDFilePathGenerator.java @@ -1,10 +1,11 @@ package co.kirikiri.service; import co.kirikiri.service.exception.BadRequestException; +import org.springframework.stereotype.Component; + import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.UUID; -import org.springframework.stereotype.Component; @Component public class UUIDFilePathGenerator implements FilePathGenerator { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/auth/AuthService.java b/backend/kirikiri/src/main/java/co/kirikiri/service/auth/AuthService.java index f8cc195f0..ba09ee06e 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/auth/AuthService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/auth/AuthService.java @@ -12,11 +12,12 @@ import co.kirikiri.service.dto.auth.response.AuthenticationResponse; import co.kirikiri.service.exception.AuthenticationException; import co.kirikiri.service.mapper.AuthMapper; -import java.util.Map; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.Map; + @Service @Transactional(readOnly = true) @RequiredArgsConstructor diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/auth/JwtTokenProvider.java b/backend/kirikiri/src/main/java/co/kirikiri/service/auth/JwtTokenProvider.java index 2b91cf904..6f04073ef 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/auth/JwtTokenProvider.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/auth/JwtTokenProvider.java @@ -7,6 +7,10 @@ import io.jsonwebtoken.JwtException; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.security.Keys; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import javax.crypto.SecretKey; import java.nio.charset.StandardCharsets; import java.time.LocalDateTime; import java.time.ZoneId; @@ -14,9 +18,6 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; -import javax.crypto.SecretKey; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; @Component public class JwtTokenProvider implements TokenProvider { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/auth/NaverOauthService.java b/backend/kirikiri/src/main/java/co/kirikiri/service/auth/NaverOauthService.java index d0630697e..af9005cc0 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/auth/NaverOauthService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/auth/NaverOauthService.java @@ -12,16 +12,17 @@ import co.kirikiri.service.dto.member.request.GenderType; import co.kirikiri.service.mapper.OauthMapper; import co.kirikiri.service.member.MemberService; -import java.math.BigInteger; -import java.security.SecureRandom; -import java.util.Map; -import java.util.Optional; import lombok.RequiredArgsConstructor; import org.springframework.core.env.Environment; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.math.BigInteger; +import java.security.SecureRandom; +import java.util.Map; +import java.util.Optional; + @Service @Transactional(readOnly = true) @RequiredArgsConstructor diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/GoalRoomCreateDto.java b/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/GoalRoomCreateDto.java index 8d7482748..5d2e0739e 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/GoalRoomCreateDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/GoalRoomCreateDto.java @@ -2,6 +2,7 @@ import co.kirikiri.domain.goalroom.vo.GoalRoomName; import co.kirikiri.domain.goalroom.vo.LimitedMemberCount; + import java.util.List; public record GoalRoomCreateDto( diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/MemberGoalRoomForListDto.java b/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/MemberGoalRoomForListDto.java index 6ee615c46..12d2298a4 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/MemberGoalRoomForListDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/MemberGoalRoomForListDto.java @@ -1,6 +1,7 @@ package co.kirikiri.service.dto.goalroom; import co.kirikiri.service.dto.member.MemberDto; + import java.time.LocalDate; import java.time.LocalDateTime; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/request/GoalRoomCreateRequest.java b/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/request/GoalRoomCreateRequest.java index 546273c53..8cc3a104c 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/request/GoalRoomCreateRequest.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/request/GoalRoomCreateRequest.java @@ -3,6 +3,7 @@ import jakarta.validation.Valid; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; + import java.util.List; public record GoalRoomCreateRequest( diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/request/GoalRoomRoadmapNodeRequest.java b/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/request/GoalRoomRoadmapNodeRequest.java index 91582039e..d33bade83 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/request/GoalRoomRoadmapNodeRequest.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/request/GoalRoomRoadmapNodeRequest.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import jakarta.validation.constraints.NotNull; + import java.time.LocalDate; public record GoalRoomRoadmapNodeRequest( diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/request/GoalRoomTodoRequest.java b/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/request/GoalRoomTodoRequest.java index 8f7da0ce8..08ebb89e7 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/request/GoalRoomTodoRequest.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/dto/goalroom/request/GoalRoomTodoRequest.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; + import java.time.LocalDate; public record GoalRoomTodoRequest( diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/member/request/GenderType.java b/backend/kirikiri/src/main/java/co/kirikiri/service/dto/member/request/GenderType.java index 164ebc537..2e162cc51 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/member/request/GenderType.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/dto/member/request/GenderType.java @@ -1,6 +1,7 @@ package co.kirikiri.service.dto.member.request; import co.kirikiri.service.exception.BadRequestException; + import java.util.Arrays; public enum GenderType { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/member/response/MemberGoalRoomResponse.java b/backend/kirikiri/src/main/java/co/kirikiri/service/dto/member/response/MemberGoalRoomResponse.java index 1204d182c..a55691e70 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/member/response/MemberGoalRoomResponse.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/dto/member/response/MemberGoalRoomResponse.java @@ -3,6 +3,7 @@ import co.kirikiri.service.dto.goalroom.response.CheckFeedResponse; import co.kirikiri.service.dto.goalroom.response.GoalRoomRoadmapNodesResponse; import co.kirikiri.service.dto.goalroom.response.GoalRoomTodoResponse; + import java.time.LocalDate; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomCreateService.java b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomCreateService.java index 4a9984b53..fecdae5f9 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomCreateService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomCreateService.java @@ -12,14 +12,14 @@ import co.kirikiri.domain.goalroom.vo.Period; import co.kirikiri.domain.member.Member; import co.kirikiri.domain.member.vo.Identifier; -import co.kirikiri.roadmap.domain.Roadmap; -import co.kirikiri.roadmap.domain.RoadmapContent; -import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.persistence.goalroom.CheckFeedRepository; import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; import co.kirikiri.persistence.goalroom.GoalRoomRepository; import co.kirikiri.persistence.goalroom.GoalRoomToDoCheckRepository; import co.kirikiri.persistence.member.MemberRepository; +import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapContent; +import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.service.FilePathGenerator; import co.kirikiri.service.FileService; @@ -35,15 +35,16 @@ import co.kirikiri.service.exception.BadRequestException; import co.kirikiri.service.exception.NotFoundException; import co.kirikiri.service.mapper.GoalRoomMapper; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpMethod; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + @Service @Transactional @RequiredArgsConstructor diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomReadService.java b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomReadService.java index 84dd262a5..5c4009479 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomReadService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomReadService.java @@ -11,7 +11,6 @@ import co.kirikiri.domain.goalroom.GoalRoomToDos; import co.kirikiri.domain.member.Member; import co.kirikiri.domain.member.vo.Identifier; -import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.persistence.goalroom.CheckFeedRepository; import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; import co.kirikiri.persistence.goalroom.GoalRoomPendingMemberRepository; @@ -19,6 +18,7 @@ import co.kirikiri.persistence.goalroom.GoalRoomToDoCheckRepository; import co.kirikiri.persistence.goalroom.dto.GoalRoomMemberSortType; import co.kirikiri.persistence.member.MemberRepository; +import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.service.FileService; import co.kirikiri.service.aop.ExceptionConvert; import co.kirikiri.service.dto.goalroom.CheckFeedDto; @@ -40,16 +40,17 @@ import co.kirikiri.service.exception.ForbiddenException; import co.kirikiri.service.exception.NotFoundException; import co.kirikiri.service.mapper.GoalRoomMapper; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpMethod; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + import java.net.URL; import java.time.LocalDate; import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpMethod; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; @Service @Transactional(readOnly = true) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/GoalRoomMapper.java b/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/GoalRoomMapper.java index 2dde127c7..6f37b962f 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/GoalRoomMapper.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/GoalRoomMapper.java @@ -13,6 +13,10 @@ import co.kirikiri.domain.goalroom.vo.Period; import co.kirikiri.persistence.goalroom.dto.GoalRoomMemberSortType; import co.kirikiri.persistence.goalroom.dto.RoadmapGoalRoomsOrderType; +import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomNumberDto; +import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomsOrderTypeDto; +import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; import co.kirikiri.service.dto.FileInformation; import co.kirikiri.service.dto.goalroom.CheckFeedDto; import co.kirikiri.service.dto.goalroom.GoalRoomCheckFeedDto; @@ -42,20 +46,17 @@ import co.kirikiri.service.dto.member.response.MemberGoalRoomForListResponse; import co.kirikiri.service.dto.member.response.MemberGoalRoomResponse; import co.kirikiri.service.dto.member.response.MemberResponse; -import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomNumberDto; -import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomsOrderTypeDto; -import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponse; -import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; import co.kirikiri.service.exception.ServerException; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.springframework.web.multipart.MultipartFile; + import java.io.IOException; import java.time.LocalDate; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import org.springframework.web.multipart.MultipartFile; @NoArgsConstructor(access = AccessLevel.PRIVATE) public class GoalRoomMapper { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/ScrollResponseMapper.java b/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/ScrollResponseMapper.java index c9d3b4c64..c9111e99e 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/ScrollResponseMapper.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/ScrollResponseMapper.java @@ -2,6 +2,7 @@ import lombok.AccessLevel; import lombok.NoArgsConstructor; + import java.util.List; @NoArgsConstructor(access = AccessLevel.PRIVATE) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/member/MemberService.java b/backend/kirikiri/src/main/java/co/kirikiri/service/member/MemberService.java index 2fec1552c..9c72245f6 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/member/MemberService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/member/MemberService.java @@ -26,15 +26,16 @@ import co.kirikiri.service.exception.NotFoundException; import co.kirikiri.service.mapper.AuthMapper; import co.kirikiri.service.mapper.MemberMapper; -import java.net.URL; -import java.util.Map; -import java.util.UUID; import lombok.RequiredArgsConstructor; import org.springframework.core.env.Environment; import org.springframework.http.HttpMethod; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.net.URL; +import java.util.Map; +import java.util.UUID; + @Service @Transactional(readOnly = true) @RequiredArgsConstructor diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/scheduler/GoalRoomScheduler.java b/backend/kirikiri/src/main/java/co/kirikiri/service/scheduler/GoalRoomScheduler.java index 71792ac6b..90a5713d3 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/scheduler/GoalRoomScheduler.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/scheduler/GoalRoomScheduler.java @@ -8,13 +8,14 @@ import co.kirikiri.persistence.goalroom.GoalRoomPendingMemberRepository; import co.kirikiri.persistence.goalroom.GoalRoomRepository; import co.kirikiri.service.aop.ExceptionConvert; -import java.time.LocalDate; -import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDate; +import java.util.List; + @Component @Transactional @RequiredArgsConstructor diff --git a/backend/kirikiri/src/test/java/co/kirikiri/common/interceptor/AuthInterceptorTest.java b/backend/kirikiri/src/test/java/co/kirikiri/common/interceptor/AuthInterceptorTest.java index 606505846..322f4f6b8 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/common/interceptor/AuthInterceptorTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/common/interceptor/AuthInterceptorTest.java @@ -1,11 +1,5 @@ package co.kirikiri.common.interceptor; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.when; - import co.kirikiri.service.auth.AuthService; import co.kirikiri.service.exception.AuthenticationException; import org.junit.jupiter.api.BeforeEach; @@ -19,6 +13,12 @@ import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.web.method.HandlerMethod; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.when; + @ExtendWith(MockitoExtension.class) class AuthInterceptorTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/common/resolver/MemberIdentifierArgumentResolverTest.java b/backend/kirikiri/src/test/java/co/kirikiri/common/resolver/MemberIdentifierArgumentResolverTest.java index c9843407f..ba7f05691 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/common/resolver/MemberIdentifierArgumentResolverTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/common/resolver/MemberIdentifierArgumentResolverTest.java @@ -1,15 +1,9 @@ package co.kirikiri.common.resolver; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.when; - import co.kirikiri.common.interceptor.Authenticated; import co.kirikiri.service.auth.AuthService; import co.kirikiri.service.exception.AuthenticationException; import co.kirikiri.service.exception.ServerException; -import java.util.List; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; @@ -22,6 +16,13 @@ import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.method.support.ModelAndViewContainer; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.when; + @ExtendWith(MockitoExtension.class) class MemberIdentifierArgumentResolverTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/controller/AuthCreateApiTest.java b/backend/kirikiri/src/test/java/co/kirikiri/controller/AuthCreateApiTest.java index 8b1741f4c..52141a41a 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/controller/AuthCreateApiTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/controller/AuthCreateApiTest.java @@ -1,17 +1,5 @@ package co.kirikiri.controller; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.doThrow; -import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; -import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post; -import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; -import static org.springframework.restdocs.payload.PayloadDocumentation.requestFields; -import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; -import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - import co.kirikiri.controller.helper.ControllerTestHelper; import co.kirikiri.controller.helper.FieldDescriptionHelper.FieldDescription; import co.kirikiri.service.auth.AuthService; @@ -23,7 +11,6 @@ import co.kirikiri.service.dto.auth.response.AuthenticationResponse; import co.kirikiri.service.exception.AuthenticationException; import com.fasterxml.jackson.core.type.TypeReference; -import java.util.List; import org.junit.jupiter.api.Test; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; @@ -32,6 +19,18 @@ import org.springframework.test.web.servlet.ResultActions; import org.springframework.test.web.servlet.ResultMatcher; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.doThrow; +import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; +import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post; +import static org.springframework.restdocs.payload.PayloadDocumentation.*; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + @WebMvcTest(AuthController.class) class AuthCreateApiTest extends ControllerTestHelper { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/controller/GoalRoomCreateApiTest.java b/backend/kirikiri/src/test/java/co/kirikiri/controller/GoalRoomCreateApiTest.java index 01b22f4ee..700ef68c6 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/controller/GoalRoomCreateApiTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/controller/GoalRoomCreateApiTest.java @@ -1,29 +1,5 @@ package co.kirikiri.controller; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.when; -import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName; -import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders; -import static org.springframework.restdocs.headers.HeaderDocumentation.responseHeaders; -import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post; -import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; -import static org.springframework.restdocs.payload.PayloadDocumentation.requestFields; -import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; -import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName; -import static org.springframework.restdocs.request.RequestDocumentation.partWithName; -import static org.springframework.restdocs.request.RequestDocumentation.pathParameters; -import static org.springframework.restdocs.request.RequestDocumentation.requestParts; -import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - import co.kirikiri.controller.helper.ControllerTestHelper; import co.kirikiri.controller.helper.FieldDescriptionHelper.FieldDescription; import co.kirikiri.service.dto.ErrorResponse; @@ -36,9 +12,6 @@ import co.kirikiri.service.goalroom.GoalRoomCreateService; import co.kirikiri.service.goalroom.GoalRoomReadService; import com.fasterxml.jackson.core.type.TypeReference; -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.List; import org.junit.jupiter.api.Test; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; @@ -50,6 +23,21 @@ import org.springframework.test.web.servlet.ResultActions; import org.springframework.test.web.servlet.ResultMatcher; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.*; +import static org.springframework.restdocs.headers.HeaderDocumentation.*; +import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post; +import static org.springframework.restdocs.payload.PayloadDocumentation.*; +import static org.springframework.restdocs.request.RequestDocumentation.*; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + @WebMvcTest(GoalRoomController.class) class GoalRoomCreateApiTest extends ControllerTestHelper { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/controller/GoalRoomReadApiTest.java b/backend/kirikiri/src/test/java/co/kirikiri/controller/GoalRoomReadApiTest.java index 1ad346fbb..842586927 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/controller/GoalRoomReadApiTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/controller/GoalRoomReadApiTest.java @@ -1,23 +1,5 @@ package co.kirikiri.controller; -import static co.kirikiri.service.dto.goalroom.GoalRoomMemberSortTypeDto.ACCOMPLISHMENT_RATE; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.when; -import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName; -import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders; -import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; -import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; -import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; -import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName; -import static org.springframework.restdocs.request.RequestDocumentation.pathParameters; -import static org.springframework.restdocs.request.RequestDocumentation.queryParameters; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - import co.kirikiri.controller.helper.ControllerTestHelper; import co.kirikiri.domain.goalroom.GoalRoomStatus; import co.kirikiri.service.dto.ErrorResponse; @@ -41,14 +23,31 @@ import co.kirikiri.service.goalroom.GoalRoomCreateService; import co.kirikiri.service.goalroom.GoalRoomReadService; import com.fasterxml.jackson.core.type.TypeReference; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.List; import org.junit.jupiter.api.Test; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.web.servlet.MvcResult; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +import static co.kirikiri.service.dto.goalroom.GoalRoomMemberSortTypeDto.ACCOMPLISHMENT_RATE; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.when; +import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName; +import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders; +import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; +import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; +import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; +import static org.springframework.restdocs.request.RequestDocumentation.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + @WebMvcTest(GoalRoomController.class) class GoalRoomReadApiTest extends ControllerTestHelper { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/controller/MemberCreateApiTest.java b/backend/kirikiri/src/test/java/co/kirikiri/controller/MemberCreateApiTest.java index 0764ac644..5c3713fac 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/controller/MemberCreateApiTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/controller/MemberCreateApiTest.java @@ -1,16 +1,5 @@ package co.kirikiri.controller; -import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_EMAIL; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doThrow; -import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName; -import static org.springframework.restdocs.headers.HeaderDocumentation.responseHeaders; -import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post; -import static org.springframework.restdocs.payload.PayloadDocumentation.requestFields; -import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - import co.kirikiri.controller.helper.ControllerTestHelper; import co.kirikiri.controller.helper.FieldDescriptionHelper.FieldDescription; import co.kirikiri.service.dto.ErrorResponse; @@ -20,7 +9,6 @@ import co.kirikiri.service.exception.ConflictException; import co.kirikiri.service.member.MemberService; import com.fasterxml.jackson.core.type.TypeReference; -import java.util.List; import org.junit.jupiter.api.Test; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; @@ -30,6 +18,19 @@ import org.springframework.test.web.servlet.ResultActions; import org.springframework.test.web.servlet.ResultMatcher; +import java.util.List; + +import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_EMAIL; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doThrow; +import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName; +import static org.springframework.restdocs.headers.HeaderDocumentation.responseHeaders; +import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post; +import static org.springframework.restdocs.payload.PayloadDocumentation.requestFields; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + @WebMvcTest(MemberController.class) class MemberCreateApiTest extends ControllerTestHelper { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/controller/MemberReadApiTest.java b/backend/kirikiri/src/test/java/co/kirikiri/controller/MemberReadApiTest.java index cfb492596..95960acdf 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/controller/MemberReadApiTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/controller/MemberReadApiTest.java @@ -1,17 +1,5 @@ package co.kirikiri.controller; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.when; -import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName; -import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders; -import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; -import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; -import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - import co.kirikiri.controller.helper.ControllerTestHelper; import co.kirikiri.domain.member.Gender; import co.kirikiri.service.dto.ErrorResponse; @@ -25,6 +13,18 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.web.servlet.MvcResult; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.when; +import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName; +import static org.springframework.restdocs.headers.HeaderDocumentation.requestHeaders; +import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; +import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; +import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + @WebMvcTest(MemberController.class) class MemberReadApiTest extends ControllerTestHelper { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/controller/helper/ControllerTestHelper.java b/backend/kirikiri/src/test/java/co/kirikiri/controller/helper/ControllerTestHelper.java index 7fcf69214..29af43a5c 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/controller/helper/ControllerTestHelper.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/controller/helper/ControllerTestHelper.java @@ -1,15 +1,16 @@ package co.kirikiri.controller.helper; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.when; - import co.kirikiri.common.interceptor.AuthInterceptor; import co.kirikiri.common.resolver.MemberIdentifierArgumentResolver; import org.junit.jupiter.api.BeforeEach; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.restdocs.payload.FieldDescriptor; + import java.util.List; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + public class ControllerTestHelper extends RestDocsHelper { protected final String AUTHORIZATION = "Authorization"; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/controller/helper/FieldDescriptionHelper.java b/backend/kirikiri/src/test/java/co/kirikiri/controller/helper/FieldDescriptionHelper.java index e7cdaeb4f..6a5fa491d 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/controller/helper/FieldDescriptionHelper.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/controller/helper/FieldDescriptionHelper.java @@ -1,11 +1,11 @@ package co.kirikiri.controller.helper; -import static co.kirikiri.controller.helper.RestDocsHelper.RESTRICT; -import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; - import org.springframework.restdocs.payload.FieldDescriptor; import org.springframework.restdocs.snippet.Attributes; +import static co.kirikiri.controller.helper.RestDocsHelper.RESTRICT; +import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; + public class FieldDescriptionHelper { public static FieldDescriptor getDescriptor(final FieldDescription description) { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/controller/helper/RestDocsHelper.java b/backend/kirikiri/src/test/java/co/kirikiri/controller/helper/RestDocsHelper.java index f977002c7..53cd88d31 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/controller/helper/RestDocsHelper.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/controller/helper/RestDocsHelper.java @@ -1,7 +1,5 @@ package co.kirikiri.controller.helper; -import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; @@ -21,8 +19,11 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.filter.CharacterEncodingFilter; + import java.io.UnsupportedEncodingException; +import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration; + @ActiveProfiles("test") @Import(TestObjectMapperConfig.class) @ExtendWith(RestDocumentationExtension.class) diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomMemberTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomMemberTest.java index ba9af7109..5a77a9497 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomMemberTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomMemberTest.java @@ -1,15 +1,16 @@ package co.kirikiri.domain.goalroom; -import static org.assertj.core.api.Assertions.assertThat; - import co.kirikiri.domain.member.EncryptedPassword; import co.kirikiri.domain.member.Member; import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; import org.junit.jupiter.api.Test; + import java.time.LocalDateTime; +import static org.assertj.core.api.Assertions.assertThat; + class GoalRoomMemberTest { @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomMembersTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomMembersTest.java index eb9dbc68f..65837423c 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomMembersTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomMembersTest.java @@ -1,16 +1,17 @@ package co.kirikiri.domain.goalroom; -import static org.assertj.core.api.Assertions.assertThat; - import co.kirikiri.domain.member.EncryptedPassword; import co.kirikiri.domain.member.Member; import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; import org.junit.jupiter.api.Test; + import java.time.LocalDateTime; import java.util.List; +import static org.assertj.core.api.Assertions.assertThat; + class GoalRoomMembersTest { private static final Member MEMBER1 = new Member(1L, new Identifier("identifier1"), diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMemberTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMemberTest.java index 7e3714151..522e08673 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMemberTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMemberTest.java @@ -1,7 +1,5 @@ package co.kirikiri.domain.goalroom; -import static org.assertj.core.api.Assertions.assertThat; - import co.kirikiri.domain.goalroom.vo.GoalRoomName; import co.kirikiri.domain.goalroom.vo.LimitedMemberCount; import co.kirikiri.domain.member.EncryptedPassword; @@ -13,8 +11,11 @@ import co.kirikiri.domain.member.vo.Password; import co.kirikiri.roadmap.domain.RoadmapContent; import org.junit.jupiter.api.Test; + import java.time.LocalDateTime; +import static org.assertj.core.api.Assertions.assertThat; + class GoalRoomPendingMemberTest { @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembersTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembersTest.java index 7671004cc..1f4641d15 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembersTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembersTest.java @@ -1,8 +1,5 @@ package co.kirikiri.domain.goalroom; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - import co.kirikiri.domain.exception.UnexpectedDomainException; import co.kirikiri.domain.goalroom.vo.GoalRoomName; import co.kirikiri.domain.goalroom.vo.LimitedMemberCount; @@ -12,9 +9,13 @@ import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; import co.kirikiri.roadmap.domain.RoadmapContent; +import org.junit.jupiter.api.Test; + import java.time.LocalDateTime; import java.util.List; -import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; class GoalRoomPendingMembersTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodeTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodeTest.java index 304dec2a8..afed0e869 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodeTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodeTest.java @@ -1,16 +1,17 @@ package co.kirikiri.domain.goalroom; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - import co.kirikiri.domain.goalroom.exception.GoalRoomException; import co.kirikiri.domain.goalroom.vo.Period; import co.kirikiri.roadmap.domain.RoadmapNode; -import java.time.LocalDate; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import java.time.LocalDate; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + class GoalRoomRoadmapNodeTest { @ParameterizedTest diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodesTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodesTest.java index b0b93abd9..4e26b55de 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodesTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNodesTest.java @@ -1,20 +1,21 @@ package co.kirikiri.domain.goalroom; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertAll; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - import co.kirikiri.domain.goalroom.exception.GoalRoomException; import co.kirikiri.domain.goalroom.vo.Period; import co.kirikiri.roadmap.domain.RoadmapNode; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + import java.time.LocalDate; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; class GoalRoomRoadmapNodesTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomTest.java index 81fa94092..9f6745463 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomTest.java @@ -1,9 +1,5 @@ package co.kirikiri.domain.goalroom; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertAll; - import co.kirikiri.domain.goalroom.exception.GoalRoomException; import co.kirikiri.domain.goalroom.vo.GoalRoomName; import co.kirikiri.domain.goalroom.vo.LimitedMemberCount; @@ -23,11 +19,16 @@ import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodeImages; import co.kirikiri.roadmap.domain.RoadmapNodes; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import java.time.LocalDate; import java.util.Collections; import java.util.List; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertAll; class GoalRoomTest { @@ -259,7 +260,7 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 final RoadmapCategory category = new RoadmapCategory("게임"); final List roadmapNodes = 로드맵_노드들을_생성한다(); final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmapNodes); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator, category); + final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); roadmap.addContent(roadmapContent); return roadmap; } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomToDoTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomToDoTest.java index 16b3a5dce..019adb085 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomToDoTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomToDoTest.java @@ -1,15 +1,16 @@ package co.kirikiri.domain.goalroom; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - import co.kirikiri.domain.goalroom.exception.GoalRoomException; import co.kirikiri.domain.goalroom.vo.GoalRoomTodoContent; import co.kirikiri.domain.goalroom.vo.Period; -import java.time.LocalDate; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import java.time.LocalDate; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + class GoalRoomToDoTest { @ParameterizedTest diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomToDosTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomToDosTest.java index 3de322e61..a49d30264 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomToDosTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomToDosTest.java @@ -1,13 +1,14 @@ package co.kirikiri.domain.goalroom; -import static org.assertj.core.api.Assertions.assertThat; - import co.kirikiri.domain.goalroom.vo.GoalRoomTodoContent; import co.kirikiri.domain.goalroom.vo.Period; import org.junit.jupiter.api.Test; + import java.time.LocalDate; import java.util.List; +import static org.assertj.core.api.Assertions.assertThat; + class GoalRoomToDosTest { @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/vo/GoalRoomNameTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/vo/GoalRoomNameTest.java index b1eafe64e..ba2e70db5 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/vo/GoalRoomNameTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/vo/GoalRoomNameTest.java @@ -1,12 +1,12 @@ package co.kirikiri.domain.goalroom.vo; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - import co.kirikiri.domain.goalroom.exception.GoalRoomException; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + class GoalRoomNameTest { @ParameterizedTest diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/vo/GoalRoomTodoContentTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/vo/GoalRoomTodoContentTest.java index ef200e17c..48f532d0f 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/vo/GoalRoomTodoContentTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/vo/GoalRoomTodoContentTest.java @@ -1,12 +1,12 @@ package co.kirikiri.domain.goalroom.vo; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - import co.kirikiri.domain.goalroom.exception.GoalRoomException; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + class GoalRoomTodoContentTest { @ParameterizedTest diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/vo/LimitedMemberCountTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/vo/LimitedMemberCountTest.java index 66445598a..9f63aafe7 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/vo/LimitedMemberCountTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/vo/LimitedMemberCountTest.java @@ -1,12 +1,12 @@ package co.kirikiri.domain.goalroom.vo; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - import co.kirikiri.domain.goalroom.exception.GoalRoomException; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + class LimitedMemberCountTest { @ParameterizedTest diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/member/vo/EncryptedPasswordTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/member/vo/EncryptedPasswordTest.java index 83d2fa36d..18c17cfba 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/member/vo/EncryptedPasswordTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/member/vo/EncryptedPasswordTest.java @@ -1,10 +1,10 @@ package co.kirikiri.domain.member.vo; -import static org.assertj.core.api.Assertions.assertThat; - import co.kirikiri.domain.member.EncryptedPassword; import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; + class EncryptedPasswordTest { @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/member/vo/IdentifierTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/member/vo/IdentifierTest.java index 2555e7155..76cea1077 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/member/vo/IdentifierTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/member/vo/IdentifierTest.java @@ -1,12 +1,12 @@ package co.kirikiri.domain.member.vo; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - import co.kirikiri.domain.member.exception.MemberException; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + class IdentifierTest { @ParameterizedTest diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/member/vo/NicknameTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/member/vo/NicknameTest.java index 80876918e..97f4dfa27 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/member/vo/NicknameTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/member/vo/NicknameTest.java @@ -1,12 +1,12 @@ package co.kirikiri.domain.member.vo; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - import co.kirikiri.domain.member.exception.MemberException; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + class NicknameTest { @ParameterizedTest diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/member/vo/PasswordTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/member/vo/PasswordTest.java index a0fe0d3cb..316106689 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/member/vo/PasswordTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/member/vo/PasswordTest.java @@ -1,12 +1,12 @@ package co.kirikiri.domain.member.vo; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - import co.kirikiri.domain.member.exception.MemberException; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + class PasswordTest { @ParameterizedTest diff --git a/backend/kirikiri/src/test/java/co/kirikiri/infra/AmazonS3FileServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/infra/AmazonS3FileServiceTest.java index 602e83e4d..4dc9e4afe 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/infra/AmazonS3FileServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/infra/AmazonS3FileServiceTest.java @@ -1,21 +1,11 @@ package co.kirikiri.infra; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.when; - import co.kirikiri.service.dto.FileInformation; import co.kirikiri.service.exception.ServerException; import com.amazonaws.AmazonServiceException; import com.amazonaws.Protocol; import com.amazonaws.SdkClientException; import com.amazonaws.services.s3.AmazonS3; -import java.io.FileInputStream; -import java.net.MalformedURLException; -import java.net.URL; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; @@ -24,6 +14,17 @@ import org.springframework.core.env.Environment; import org.springframework.http.HttpMethod; +import java.io.FileInputStream; +import java.net.MalformedURLException; +import java.net.URL; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.when; + @ExtendWith(MockitoExtension.class) class AmazonS3FileServiceTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/infra/CloudFrontServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/infra/CloudFrontServiceTest.java index 1b56ff0d4..a8501291a 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/infra/CloudFrontServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/infra/CloudFrontServiceTest.java @@ -1,12 +1,6 @@ package co.kirikiri.infra; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.Mockito.when; - import co.kirikiri.service.exception.ServerException; -import java.net.MalformedURLException; -import java.net.URL; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; @@ -14,6 +8,13 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.core.env.Environment; +import java.net.MalformedURLException; +import java.net.URL; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.Mockito.when; + @ExtendWith(MockitoExtension.class) class CloudFrontServiceTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/infra/NaverOauthNetworkServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/infra/NaverOauthNetworkServiceTest.java index bdcfe98c2..8f97b56df 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/infra/NaverOauthNetworkServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/infra/NaverOauthNetworkServiceTest.java @@ -1,15 +1,7 @@ package co.kirikiri.infra; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.when; - import co.kirikiri.service.dto.auth.NaverOauthTokenDto; import co.kirikiri.service.dto.auth.response.AuthenticationResponse; -import java.util.Map; -import java.util.Optional; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; @@ -20,6 +12,13 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.client.RestTemplate; +import java.util.Map; +import java.util.Optional; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.when; + @ExtendWith(MockitoExtension.class) class NaverOauthNetworkServiceTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/AuthenticationIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/AuthenticationIntegrationTest.java index efc6e01a2..a5fdffdb9 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/AuthenticationIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/AuthenticationIntegrationTest.java @@ -1,11 +1,5 @@ package co.kirikiri.integration; -import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.응답을_반환하는_로그인; -import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.토큰_재발행; -import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_IDENTIFIER; -import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_PASSWORD; -import static org.assertj.core.api.Assertions.assertThat; - import co.kirikiri.integration.helper.InitIntegrationTest; import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.auth.request.LoginRequest; @@ -15,10 +9,17 @@ import com.fasterxml.jackson.core.type.TypeReference; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; -import java.util.List; import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; +import java.util.List; + +import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.응답을_반환하는_로그인; +import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.토큰_재발행; +import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_IDENTIFIER; +import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_PASSWORD; +import static org.assertj.core.api.Assertions.assertThat; + class AuthenticationIntegrationTest extends InitIntegrationTest { @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomCreateIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomCreateIntegrationTest.java index c5ad956bf..1c07a4cc0 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomCreateIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomCreateIntegrationTest.java @@ -1,36 +1,8 @@ package co.kirikiri.integration; -import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.로그인; -import static co.kirikiri.integration.fixture.CommonFixture.BEARER_TOKEN_FORMAT; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸_나가기_요청; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸_목록_조회_요청; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸_생성; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸_참가_요청; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸_투두리스트_추가; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸_투두리스트_추가후_아이디를_반환한다; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸_투두리스트를_체크한다; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸을_생성하고_아이디를_반환한다; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸을_시작한다; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸의_사용자_정보를_정렬_기준없이_조회; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.사용자의_특정_골룸_정보를_조회한다; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.십일_후; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.오늘; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.이십일_후; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.인증_피드_등록; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_노드_인증_횟수; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_생성; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_이름; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_제한_인원; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_투두_컨텐츠; -import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_EMAIL; -import static co.kirikiri.integration.fixture.MemberAPIFixture.요청을_받는_사용자_자신의_정보_조회_요청; -import static co.kirikiri.integration.fixture.MemberAPIFixture.회원가입; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵_생성; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵을_아이디로_조회하고_응답객체를_반환한다; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertAll; - import co.kirikiri.integration.helper.InitIntegrationTest; +import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.auth.request.LoginRequest; import co.kirikiri.service.dto.goalroom.GoalRoomFilterTypeDto; @@ -44,21 +16,29 @@ import co.kirikiri.service.dto.member.request.MemberJoinRequest; import co.kirikiri.service.dto.member.response.MemberGoalRoomResponse; import co.kirikiri.service.dto.member.response.MemberInformationResponse; -import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; -import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import com.fasterxml.jackson.core.JsonProcessingException; import io.restassured.common.mapper.TypeRef; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; -import java.io.IOException; -import java.time.temporal.ChronoUnit; -import java.util.Collections; -import java.util.List; import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.mock.web.MockMultipartFile; +import java.io.IOException; +import java.time.temporal.ChronoUnit; +import java.util.Collections; +import java.util.List; + +import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.로그인; +import static co.kirikiri.integration.fixture.CommonFixture.BEARER_TOKEN_FORMAT; +import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.*; +import static co.kirikiri.integration.fixture.MemberAPIFixture.*; +import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵_생성; +import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵을_아이디로_조회하고_응답객체를_반환한다; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertAll; + class GoalRoomCreateIntegrationTest extends InitIntegrationTest { @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomReadIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomReadIntegrationTest.java index 9772331fa..e3a8b93ef 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomReadIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomReadIntegrationTest.java @@ -1,39 +1,12 @@ package co.kirikiri.integration; -import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.로그인; -import static co.kirikiri.integration.fixture.CommonFixture.BEARER_TOKEN_FORMAT; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸_노드_조회; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸_아이디로_골룸을_조회; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸_아이디와_토큰으로_골룸_정보를_조회; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸_참가_요청; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸_투두리스트_조회; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸_투두리스트_추가; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸을_생성하고_아이디를_반환한다; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸을_시작한다; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸의_사용자_정보를_전체_조회; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸의_사용자_정보를_정렬_기준없이_조회; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.기본_골룸_생성; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.로드맵_아이디로_골룸_목록_조회; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.사용자가_참여한_골룸_중_골룸_진행_상태에_따라_목록을_조회; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.사용자의_모든_골룸_조회; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.사용자의_특정_골룸_정보를_조회한다; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.삼십일_후; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.십일_후; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.오늘; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.이십일_후; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.인증_피드_등록; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.인증_피드_전체_조회_요청; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_노드_인증_횟수; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_이름; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_제한_인원; -import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_EMAIL; -import static co.kirikiri.integration.fixture.MemberAPIFixture.회원가입; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵_생성; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵을_아이디로_조회하고_응답객체를_반환한다; -import static org.assertj.core.api.Assertions.assertThat; - import co.kirikiri.integration.helper.InitIntegrationTest; import co.kirikiri.persistence.goalroom.dto.RoadmapGoalRoomsOrderType; +import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; +import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; +import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; +import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.auth.request.LoginRequest; import co.kirikiri.service.dto.goalroom.GoalRoomMemberSortTypeDto; @@ -54,22 +27,27 @@ import co.kirikiri.service.dto.member.request.MemberJoinRequest; import co.kirikiri.service.dto.member.response.MemberGoalRoomForListResponse; import co.kirikiri.service.dto.member.response.MemberGoalRoomResponse; -import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; -import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; -import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; -import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; -import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import com.fasterxml.jackson.core.type.TypeReference; import io.restassured.common.mapper.TypeRef; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; -import java.io.IOException; -import java.time.LocalDate; -import java.util.List; import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; import org.springframework.mock.web.MockMultipartFile; +import java.io.IOException; +import java.time.LocalDate; +import java.util.List; + +import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.로그인; +import static co.kirikiri.integration.fixture.CommonFixture.BEARER_TOKEN_FORMAT; +import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.*; +import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_EMAIL; +import static co.kirikiri.integration.fixture.MemberAPIFixture.회원가입; +import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵_생성; +import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵을_아이디로_조회하고_응답객체를_반환한다; +import static org.assertj.core.api.Assertions.assertThat; + class GoalRoomReadIntegrationTest extends InitIntegrationTest { @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomSchedulerIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomSchedulerIntegrationTest.java index 86d0854b6..40bd41531 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomSchedulerIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomSchedulerIntegrationTest.java @@ -1,42 +1,33 @@ package co.kirikiri.integration; -import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.로그인; -import static co.kirikiri.integration.fixture.CommonFixture.BEARER_TOKEN_FORMAT; -import static co.kirikiri.integration.fixture.CommonFixture.LOCATION; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸_생성; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸_참가_요청; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸을_시작한다; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.기본_골룸_생성; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.사용자의_특정_골룸_정보를_조회한다; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.십일_후; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.오늘; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.이십일_후; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_노드_인증_횟수; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_이름; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_제한_인원; -import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_EMAIL; -import static co.kirikiri.integration.fixture.MemberAPIFixture.회원가입; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵_생성; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵을_아이디로_조회하고_응답객체를_반환한다; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertAll; - import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomStatus; import co.kirikiri.integration.helper.InitIntegrationTest; import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; import co.kirikiri.persistence.goalroom.GoalRoomPendingMemberRepository; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.service.dto.auth.request.LoginRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomCreateRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomRoadmapNodeRequest; import co.kirikiri.service.dto.member.request.GenderType; import co.kirikiri.service.dto.member.request.MemberJoinRequest; import co.kirikiri.service.dto.member.response.MemberGoalRoomResponse; -import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.service.scheduler.GoalRoomScheduler; +import org.junit.jupiter.api.Test; + import java.io.IOException; import java.util.List; -import org.junit.jupiter.api.Test; + +import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.로그인; +import static co.kirikiri.integration.fixture.CommonFixture.BEARER_TOKEN_FORMAT; +import static co.kirikiri.integration.fixture.CommonFixture.LOCATION; +import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.*; +import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_EMAIL; +import static co.kirikiri.integration.fixture.MemberAPIFixture.회원가입; +import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵_생성; +import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵을_아이디로_조회하고_응답객체를_반환한다; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertAll; class GoalRoomSchedulerIntegrationTest extends InitIntegrationTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/MemberCreateIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/MemberCreateIntegrationTest.java index 9d58ca281..6af575a26 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/MemberCreateIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/MemberCreateIntegrationTest.java @@ -1,9 +1,5 @@ package co.kirikiri.integration; -import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_EMAIL; -import static co.kirikiri.integration.fixture.MemberAPIFixture.요청을_받는_회원가입; -import static org.assertj.core.api.Assertions.assertThat; - import co.kirikiri.integration.helper.InitIntegrationTest; import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.member.request.GenderType; @@ -16,6 +12,10 @@ import org.junit.jupiter.params.provider.ValueSource; import org.springframework.http.HttpStatus; +import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_EMAIL; +import static co.kirikiri.integration.fixture.MemberAPIFixture.요청을_받는_회원가입; +import static org.assertj.core.api.Assertions.assertThat; + class MemberCreateIntegrationTest extends InitIntegrationTest { @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/MemberReadIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/MemberReadIntegrationTest.java index d86c9a31e..bc277f3c3 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/MemberReadIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/MemberReadIntegrationTest.java @@ -1,14 +1,5 @@ package co.kirikiri.integration; -import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_EMAIL; -import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_GENDER_TYPE; -import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_IDENTIFIER; -import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_NICKNAME; -import static co.kirikiri.integration.fixture.MemberAPIFixture.요청을_받는_사용자_자신의_정보_조회_요청; -import static co.kirikiri.integration.fixture.MemberAPIFixture.요청을_받는_특정_사용자의_정보_조회; -import static co.kirikiri.integration.fixture.MemberAPIFixture.회원가입; -import static org.assertj.core.api.Assertions.assertThat; - import co.kirikiri.domain.member.Gender; import co.kirikiri.integration.helper.InitIntegrationTest; import co.kirikiri.service.dto.ErrorResponse; @@ -22,6 +13,9 @@ import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; +import static co.kirikiri.integration.fixture.MemberAPIFixture.*; +import static org.assertj.core.api.Assertions.assertThat; + class MemberReadIntegrationTest extends InitIntegrationTest { @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapCreateIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapCreateIntegrationTest.java index fd0b3572c..8c24b1713 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapCreateIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapCreateIntegrationTest.java @@ -1,27 +1,15 @@ package co.kirikiri.integration; -import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.로그인; -import static co.kirikiri.integration.fixture.CommonFixture.BEARER_TOKEN_FORMAT; -import static co.kirikiri.integration.fixture.CommonFixture.아이디를_반환한다; -import static co.kirikiri.integration.fixture.CommonFixture.응답_상태_코드_검증; -import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_EMAIL; -import static co.kirikiri.integration.fixture.MemberAPIFixture.회원가입; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵_삭제; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵_생성; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵_카테고리를_생성한다; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.요청을_받는_이미지가_포함된_로드맵_생성; -import static org.assertj.core.api.Assertions.assertThat; - import co.kirikiri.integration.helper.InitIntegrationTest; -import co.kirikiri.service.dto.ErrorResponse; -import co.kirikiri.service.dto.auth.request.LoginRequest; -import co.kirikiri.service.dto.member.request.GenderType; -import co.kirikiri.service.dto.member.request.MemberJoinRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapCategorySaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapTagSaveRequest; +import co.kirikiri.service.dto.ErrorResponse; +import co.kirikiri.service.dto.auth.request.LoginRequest; +import co.kirikiri.service.dto.member.request.GenderType; +import co.kirikiri.service.dto.member.request.MemberJoinRequest; import io.restassured.common.mapper.TypeRef; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; @@ -29,10 +17,18 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import org.springframework.http.HttpStatus; + import java.io.IOException; import java.util.Collections; import java.util.List; +import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.로그인; +import static co.kirikiri.integration.fixture.CommonFixture.*; +import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_EMAIL; +import static co.kirikiri.integration.fixture.MemberAPIFixture.회원가입; +import static co.kirikiri.integration.fixture.RoadmapAPIFixture.*; +import static org.assertj.core.api.Assertions.assertThat; + class RoadmapCreateIntegrationTest extends InitIntegrationTest { @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadIntegrationTest.java index a2420041b..134238c3e 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadIntegrationTest.java @@ -1,22 +1,8 @@ package co.kirikiri.integration; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로그인한_사용자가_생성한_로드맵을_이전에_받은_로드맵의_제일마지막_아이디_이후의_조건으로_조회한다; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로그인한_사용자가_생성한_로드맵을_조회한다; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵_생성; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵을_아이디로_조회한다; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.모든_카테고리를_조회한다; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.사이즈_없이_로드맵을_조회한다; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.사이즈별로_로드맵을_조회한다; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.정렬된_카테고리별_로드맵_리스트_조회; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.카테고리_생성; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.카테고리들_생성; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertAll; - -import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.integration.helper.InitIntegrationTest; +import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; -import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; @@ -26,14 +12,20 @@ import co.kirikiri.roadmap.service.dto.response.RoadmapForListResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapForListResponses; import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; +import co.kirikiri.service.dto.ErrorResponse; import io.restassured.common.mapper.TypeRef; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; + import java.io.IOException; import java.util.List; +import static co.kirikiri.integration.fixture.RoadmapAPIFixture.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertAll; + class RoadmapReadIntegrationTest extends InitIntegrationTest { @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadOrderIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadOrderIntegrationTest.java index 6981604bd..31cd483c1 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadOrderIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadOrderIntegrationTest.java @@ -1,30 +1,9 @@ package co.kirikiri.integration; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸_참가_요청; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸을_생성하고_아이디를_반환한다; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸을_시작한다; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.십일_후; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.오늘; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_노드_인증_횟수; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_이름; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_제한_인원; -import static co.kirikiri.integration.fixture.MemberAPIFixture.사용자를_추가하고_토큰을_조회한다; -import static co.kirikiri.integration.fixture.MemberAPIFixture.요청을_받는_사용자_자신의_정보_조회_요청; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵_생성; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵을_아이디로_조회하고_응답객체를_반환한다; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.리뷰를_생성한다; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.정렬된_로드맵_리스트_조회; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.정렬된_카테고리별_로드맵_리스트_조회; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.카테고리_생성; -import static org.assertj.core.api.Assertions.assertThat; - import co.kirikiri.domain.goalroom.GoalRoom; -import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.integration.helper.InitIntegrationTest; +import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; -import co.kirikiri.service.dto.goalroom.request.GoalRoomCreateRequest; -import co.kirikiri.service.dto.goalroom.request.GoalRoomRoadmapNodeRequest; -import co.kirikiri.service.dto.member.response.MemberInformationResponse; import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; @@ -32,10 +11,20 @@ import co.kirikiri.roadmap.service.dto.request.RoadmapTagSaveRequest; import co.kirikiri.roadmap.service.dto.response.RoadmapForListResponses; import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; +import co.kirikiri.service.dto.goalroom.request.GoalRoomCreateRequest; +import co.kirikiri.service.dto.goalroom.request.GoalRoomRoadmapNodeRequest; +import co.kirikiri.service.dto.member.response.MemberInformationResponse; import io.restassured.common.mapper.TypeRef; +import org.junit.jupiter.api.Test; + import java.io.IOException; import java.util.List; -import org.junit.jupiter.api.Test; + +import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.*; +import static co.kirikiri.integration.fixture.MemberAPIFixture.사용자를_추가하고_토큰을_조회한다; +import static co.kirikiri.integration.fixture.MemberAPIFixture.요청을_받는_사용자_자신의_정보_조회_요청; +import static co.kirikiri.integration.fixture.RoadmapAPIFixture.*; +import static org.assertj.core.api.Assertions.assertThat; class RoadmapReadOrderIntegrationTest extends InitIntegrationTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewCreateIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewCreateIntegrationTest.java index 7eb747946..7c23fdb59 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewCreateIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewCreateIntegrationTest.java @@ -1,23 +1,9 @@ package co.kirikiri.integration; -import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.로그인; -import static co.kirikiri.integration.fixture.CommonFixture.BEARER_TOKEN_FORMAT; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸을_생성하고_아이디를_반환한다; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.십일_후; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.오늘; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_노드_인증_횟수; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_이름; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_제한_인원; -import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_EMAIL; -import static co.kirikiri.integration.fixture.MemberAPIFixture.요청을_받는_사용자_자신의_정보_조회_요청; -import static co.kirikiri.integration.fixture.MemberAPIFixture.회원가입; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵_생성; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵을_아이디로_조회하고_응답객체를_반환한다; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.리뷰를_생성한다; -import static org.assertj.core.api.Assertions.assertThat; - import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.integration.helper.InitIntegrationTest; +import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.auth.request.LoginRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomCreateRequest; @@ -25,16 +11,22 @@ import co.kirikiri.service.dto.member.request.GenderType; import co.kirikiri.service.dto.member.request.MemberJoinRequest; import co.kirikiri.service.dto.member.response.MemberInformationResponse; -import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; -import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import io.restassured.common.mapper.TypeRef; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; + import java.io.IOException; import java.util.List; +import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.로그인; +import static co.kirikiri.integration.fixture.CommonFixture.BEARER_TOKEN_FORMAT; +import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.*; +import static co.kirikiri.integration.fixture.MemberAPIFixture.*; +import static co.kirikiri.integration.fixture.RoadmapAPIFixture.*; +import static org.assertj.core.api.Assertions.assertThat; + class RoadmapReviewCreateIntegrationTest extends InitIntegrationTest { @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewReadIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewReadIntegrationTest.java index 05d9d0bff..416c11bff 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewReadIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewReadIntegrationTest.java @@ -1,19 +1,10 @@ package co.kirikiri.integration; -import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.로그인; -import static co.kirikiri.integration.fixture.CommonFixture.BEARER_TOKEN_FORMAT; -import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_EMAIL; -import static co.kirikiri.integration.fixture.MemberAPIFixture.요청을_받는_사용자_자신의_정보_조회_요청; -import static co.kirikiri.integration.fixture.MemberAPIFixture.회원가입; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵_리뷰를_조회한다; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵_생성; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵을_아이디로_조회하고_응답객체를_반환한다; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.리뷰를_생성한다; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertAll; - import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.integration.helper.InitIntegrationTest; +import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; +import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; import co.kirikiri.service.dto.CustomScrollRequest; import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.auth.request.LoginRequest; @@ -21,9 +12,6 @@ import co.kirikiri.service.dto.member.request.MemberJoinRequest; import co.kirikiri.service.dto.member.response.MemberInformationResponse; import co.kirikiri.service.dto.member.response.MemberResponse; -import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; -import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; -import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import io.restassured.common.mapper.TypeRef; @@ -31,10 +19,18 @@ import io.restassured.response.Response; import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; + import java.io.IOException; import java.time.LocalDateTime; import java.util.List; +import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.로그인; +import static co.kirikiri.integration.fixture.CommonFixture.BEARER_TOKEN_FORMAT; +import static co.kirikiri.integration.fixture.MemberAPIFixture.*; +import static co.kirikiri.integration.fixture.RoadmapAPIFixture.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertAll; + class RoadmapReviewReadIntegrationTest extends InitIntegrationTest { @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapSearchIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapSearchIntegrationTest.java index a1a28e634..01631d16a 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapSearchIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapSearchIntegrationTest.java @@ -1,24 +1,22 @@ package co.kirikiri.integration; -import static co.kirikiri.integration.fixture.MemberAPIFixture.요청을_받는_사용자_자신의_정보_조회_요청; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.로드맵_생성; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.제목으로_최신순_정렬된_로드맵을_검색한다; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.크리에이터_닉네임으로_정렬된_로드맵을_생성한다; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.태그_이름으로_최신순_정렬된_로드맵을_검색한다; -import static org.assertj.core.api.Assertions.assertThat; - import co.kirikiri.integration.helper.InitIntegrationTest; -import co.kirikiri.service.dto.member.response.MemberInformationResponse; import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapTagSaveRequest; import co.kirikiri.roadmap.service.dto.response.RoadmapForListResponses; +import co.kirikiri.service.dto.member.response.MemberInformationResponse; import io.restassured.common.mapper.TypeRef; import org.junit.jupiter.api.Test; + import java.io.IOException; import java.util.List; +import static co.kirikiri.integration.fixture.MemberAPIFixture.요청을_받는_사용자_자신의_정보_조회_요청; +import static co.kirikiri.integration.fixture.RoadmapAPIFixture.*; +import static org.assertj.core.api.Assertions.assertThat; + class RoadmapSearchIntegrationTest extends InitIntegrationTest { @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/AuthenticationAPIFixture.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/AuthenticationAPIFixture.java index 09e803db7..450c870a4 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/AuthenticationAPIFixture.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/AuthenticationAPIFixture.java @@ -1,10 +1,5 @@ package co.kirikiri.integration.fixture; -import static co.kirikiri.integration.fixture.CommonFixture.API_PREFIX; -import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_IDENTIFIER; -import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_PASSWORD; -import static io.restassured.RestAssured.given; - import co.kirikiri.service.dto.auth.request.LoginRequest; import co.kirikiri.service.dto.auth.request.ReissueTokenRequest; import co.kirikiri.service.dto.auth.response.AuthenticationResponse; @@ -12,6 +7,11 @@ import io.restassured.response.Response; import org.springframework.http.MediaType; +import static co.kirikiri.integration.fixture.CommonFixture.API_PREFIX; +import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_IDENTIFIER; +import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_PASSWORD; +import static io.restassured.RestAssured.given; + public class AuthenticationAPIFixture { public static ExtractableResponse 응답을_반환하는_로그인(final LoginRequest 로그인_요청) { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/CommonFixture.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/CommonFixture.java index 1442dfba1..fd36ade7f 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/CommonFixture.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/CommonFixture.java @@ -1,12 +1,12 @@ package co.kirikiri.integration.fixture; -import static org.assertj.core.api.Assertions.assertThat; - import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; +import static org.assertj.core.api.Assertions.assertThat; + public class CommonFixture { public static final String BEARER_TOKEN_FORMAT = "Bearer %s"; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/GoalRoomAPIFixture.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/GoalRoomAPIFixture.java index d46cf6cef..8dfe0ed88 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/GoalRoomAPIFixture.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/GoalRoomAPIFixture.java @@ -1,16 +1,11 @@ package co.kirikiri.integration.fixture; -import static co.kirikiri.integration.fixture.CommonFixture.API_PREFIX; -import static co.kirikiri.integration.fixture.CommonFixture.AUTHORIZATION; -import static co.kirikiri.integration.fixture.CommonFixture.LOCATION; -import static io.restassured.RestAssured.given; - +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.service.dto.goalroom.request.CheckFeedRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomCreateRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomRoadmapNodeRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomTodoRequest; import co.kirikiri.service.dto.member.response.MemberGoalRoomResponse; -import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import io.restassured.common.mapper.TypeRef; import io.restassured.http.Header; import io.restassured.response.ExtractableResponse; @@ -18,12 +13,16 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.mock.web.MockMultipartFile; + import java.io.IOException; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.util.List; +import static co.kirikiri.integration.fixture.CommonFixture.*; +import static io.restassured.RestAssured.given; + public class GoalRoomAPIFixture { public static final LocalDate 오늘 = LocalDate.now(); diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/MemberAPIFixture.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/MemberAPIFixture.java index 5cec01f3c..d0746e4c6 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/MemberAPIFixture.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/MemberAPIFixture.java @@ -1,11 +1,5 @@ package co.kirikiri.integration.fixture; -import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.로그인; -import static co.kirikiri.integration.fixture.CommonFixture.API_PREFIX; -import static co.kirikiri.integration.fixture.CommonFixture.AUTHORIZATION; -import static co.kirikiri.integration.fixture.CommonFixture.BEARER_TOKEN_FORMAT; -import static io.restassured.RestAssured.given; - import co.kirikiri.service.dto.auth.request.LoginRequest; import co.kirikiri.service.dto.member.request.GenderType; import co.kirikiri.service.dto.member.request.MemberJoinRequest; @@ -13,6 +7,10 @@ import io.restassured.response.Response; import org.springframework.http.MediaType; +import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.로그인; +import static co.kirikiri.integration.fixture.CommonFixture.*; +import static io.restassured.RestAssured.given; + public class MemberAPIFixture { public static final String DEFAULT_IDENTIFIER = "identifier1"; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java index 94176c97e..319f7057e 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java @@ -1,7 +1,7 @@ package co.kirikiri.integration.fixture; -import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; import co.kirikiri.roadmap.domain.RoadmapCategory; +import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; import co.kirikiri.roadmap.service.dto.request.RoadmapCategorySaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/DatabaseCleaner.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/DatabaseCleaner.java index 4bcfe3b86..debda986f 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/DatabaseCleaner.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/DatabaseCleaner.java @@ -7,6 +7,7 @@ import org.springframework.stereotype.Component; import org.springframework.test.context.ActiveProfiles; import org.springframework.transaction.annotation.Transactional; + import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/InitIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/InitIntegrationTest.java index 243e577e3..bdfc0661f 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/InitIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/InitIntegrationTest.java @@ -1,18 +1,19 @@ package co.kirikiri.integration.helper; -import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.기본_로그인; -import static co.kirikiri.integration.fixture.CommonFixture.BEARER_TOKEN_FORMAT; -import static co.kirikiri.integration.fixture.MemberAPIFixture.기본_회원가입; -import static co.kirikiri.integration.fixture.RoadmapAPIFixture.카테고리_생성; - import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapTagSaveRequest; import org.junit.jupiter.api.BeforeEach; + import java.util.List; +import static co.kirikiri.integration.fixture.AuthenticationAPIFixture.기본_로그인; +import static co.kirikiri.integration.fixture.CommonFixture.BEARER_TOKEN_FORMAT; +import static co.kirikiri.integration.fixture.MemberAPIFixture.기본_회원가입; +import static co.kirikiri.integration.fixture.RoadmapAPIFixture.카테고리_생성; + public class InitIntegrationTest extends IntegrationTest { protected static Long 기본_회원_아이디; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestFileService.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestFileService.java index 5803f3af2..7ed04c3b3 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestFileService.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestFileService.java @@ -3,6 +3,7 @@ import co.kirikiri.service.FileService; import co.kirikiri.service.dto.FileInformation; import org.springframework.http.HttpMethod; + import java.net.MalformedURLException; import java.net.URL; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestRefreshTokenRepository.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestRefreshTokenRepository.java index 94f9344a0..9ae54f7b7 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestRefreshTokenRepository.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestRefreshTokenRepository.java @@ -1,10 +1,11 @@ package co.kirikiri.integration.helper; -import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_IDENTIFIER; - import co.kirikiri.persistence.auth.RefreshTokenRepository; + import java.util.Optional; +import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_IDENTIFIER; + public class TestRefreshTokenRepository implements RefreshTokenRepository { @Override diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestTransactionService.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestTransactionService.java index 931f68b14..81c0ff97f 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestTransactionService.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestTransactionService.java @@ -1,14 +1,5 @@ package co.kirikiri.integration.helper; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.골룸을_생성하고_아이디를_반환한다; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.십일_후; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.오늘; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_노드_인증_횟수; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_이름; -import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.정상적인_골룸_제한_인원; -import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_PASSWORD; -import static co.kirikiri.integration.helper.InitIntegrationTest.기본_로그인_토큰; - import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomMember; import co.kirikiri.domain.goalroom.GoalRoomRole; @@ -22,17 +13,22 @@ import co.kirikiri.domain.member.vo.Password; import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; import co.kirikiri.persistence.goalroom.GoalRoomRepository; +import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.service.dto.goalroom.request.GoalRoomCreateRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomRoadmapNodeRequest; import co.kirikiri.service.dto.member.response.MemberInformationResponse; -import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; +import org.springframework.transaction.annotation.Transactional; + import java.time.LocalDate; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; -import org.springframework.transaction.annotation.Transactional; + +import static co.kirikiri.integration.fixture.GoalRoomAPIFixture.*; +import static co.kirikiri.integration.fixture.MemberAPIFixture.DEFAULT_PASSWORD; +import static co.kirikiri.integration.helper.InitIntegrationTest.기본_로그인_토큰; @Transactional public class TestTransactionService { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/auth/RefreshTokenRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/auth/RefreshTokenRepositoryTest.java index d31e6d075..4f33e648e 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/auth/RefreshTokenRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/auth/RefreshTokenRepositoryTest.java @@ -1,9 +1,5 @@ package co.kirikiri.persistence.auth; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.mockito.Mockito.when; - import co.kirikiri.domain.member.EncryptedPassword; import co.kirikiri.domain.member.Gender; import co.kirikiri.domain.member.Member; @@ -11,7 +7,6 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import java.util.Optional; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -21,6 +16,12 @@ import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.ValueOperations; +import java.util.Optional; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.mockito.Mockito.when; + @ExtendWith(MockitoExtension.class) class RefreshTokenRepositoryTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/CheckFeedRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/CheckFeedRepositoryTest.java index b636f659b..72034f246 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/CheckFeedRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/CheckFeedRepositoryTest.java @@ -1,8 +1,5 @@ package co.kirikiri.persistence.goalroom; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertAll; - import co.kirikiri.domain.ImageContentType; import co.kirikiri.domain.goalroom.CheckFeed; import co.kirikiri.domain.goalroom.GoalRoom; @@ -21,6 +18,8 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; +import co.kirikiri.persistence.helper.RepositoryTest; +import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; @@ -30,14 +29,16 @@ import co.kirikiri.roadmap.domain.RoadmapNodeImage; import co.kirikiri.roadmap.domain.RoadmapNodeImages; import co.kirikiri.roadmap.domain.RoadmapNodes; -import co.kirikiri.persistence.helper.RepositoryTest; -import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; +import org.junit.jupiter.api.Test; + import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; -import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertAll; @RepositoryTest class CheckFeedRepositoryTest { @@ -450,7 +451,7 @@ public CheckFeedRepositoryTest(final MemberRepository memberRepository, private Roadmap 로드맵을_저장한다(final Member creator, final RoadmapCategory category) { final List roadmapNodes = 로드맵_노드들을_생성한다(); final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmapNodes); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator, category); + final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); roadmap.addContent(roadmapContent); return roadmapRepository.save(roadmap); } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepositoryTest.java index 50c6effcd..135051064 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepositoryTest.java @@ -1,7 +1,5 @@ package co.kirikiri.persistence.goalroom; -import static org.assertj.core.api.Assertions.assertThat; - import co.kirikiri.domain.ImageContentType; import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomMember; @@ -19,6 +17,9 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; +import co.kirikiri.persistence.goalroom.dto.GoalRoomMemberSortType; +import co.kirikiri.persistence.helper.RepositoryTest; +import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; @@ -28,17 +29,17 @@ import co.kirikiri.roadmap.domain.RoadmapNodeImage; import co.kirikiri.roadmap.domain.RoadmapNodeImages; import co.kirikiri.roadmap.domain.RoadmapNodes; -import co.kirikiri.persistence.goalroom.dto.GoalRoomMemberSortType; -import co.kirikiri.persistence.helper.RepositoryTest; -import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; import java.util.Optional; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; @RepositoryTest class GoalRoomMemberRepositoryTest { @@ -338,7 +339,7 @@ public GoalRoomMemberRepositoryTest(final MemberRepository memberRepository, private Roadmap 로드맵을_저장한다(final Member creator, final RoadmapCategory category) { final List roadmapNodes = 로드맵_노드들을_생성한다(); final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmapNodes); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator, category); + final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); roadmap.addContent(roadmapContent); return roadmapRepository.save(roadmap); } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepositoryTest.java index a6e3421cb..58d070140 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepositoryTest.java @@ -1,7 +1,5 @@ package co.kirikiri.persistence.goalroom; -import static org.assertj.core.api.Assertions.assertThat; - import co.kirikiri.domain.ImageContentType; import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomPendingMember; @@ -19,6 +17,9 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; +import co.kirikiri.persistence.goalroom.dto.GoalRoomMemberSortType; +import co.kirikiri.persistence.helper.RepositoryTest; +import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; @@ -28,18 +29,18 @@ import co.kirikiri.roadmap.domain.RoadmapNodeImage; import co.kirikiri.roadmap.domain.RoadmapNodeImages; import co.kirikiri.roadmap.domain.RoadmapNodes; -import co.kirikiri.persistence.goalroom.dto.GoalRoomMemberSortType; -import co.kirikiri.persistence.helper.RepositoryTest; -import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; + import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; import java.util.Optional; +import static org.assertj.core.api.Assertions.assertThat; + @RepositoryTest class GoalRoomPendingMemberRepositoryTest { @@ -334,7 +335,7 @@ public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberReposito private Roadmap 로드맵을_저장한다(final Member creator, final RoadmapCategory category) { final List roadmapNodes = 로드맵_노드들을_생성한다(); final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmapNodes); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator, category); + final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); roadmap.addContent(roadmapContent); return roadmapRepository.save(roadmap); } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomRepositoryTest.java index 6905b9e53..efd69497a 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomRepositoryTest.java @@ -1,8 +1,5 @@ package co.kirikiri.persistence.goalroom; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertAll; - import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomRoadmapNode; import co.kirikiri.domain.goalroom.GoalRoomRoadmapNodes; @@ -19,21 +16,25 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; +import co.kirikiri.persistence.goalroom.dto.RoadmapGoalRoomsOrderType; +import co.kirikiri.persistence.helper.RepositoryTest; +import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; import co.kirikiri.roadmap.domain.RoadmapDifficulty; import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodes; -import co.kirikiri.persistence.goalroom.dto.RoadmapGoalRoomsOrderType; -import co.kirikiri.persistence.helper.RepositoryTest; -import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import org.junit.jupiter.api.Test; + import java.time.LocalDate; import java.util.List; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertAll; + @RepositoryTest class GoalRoomRepositoryTest { @@ -565,7 +566,7 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, private Roadmap 로드맵을_생성한다(final Member creator, final RoadmapCategory category, final RoadmapContent roadmapContent) { final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 30, RoadmapDifficulty.DIFFICULT, - creator, category); + creator.getId(), category); roadmap.addContent(roadmapContent); return roadmapRepository.save(roadmap); } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepositoryTest.java index 7075330f2..fd47c1049 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepositoryTest.java @@ -1,7 +1,5 @@ package co.kirikiri.persistence.goalroom; -import static org.assertj.core.api.Assertions.assertThat; - import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomMember; import co.kirikiri.domain.goalroom.GoalRoomRoadmapNode; @@ -20,20 +18,23 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; +import co.kirikiri.persistence.helper.RepositoryTest; +import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; import co.kirikiri.roadmap.domain.RoadmapDifficulty; import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodes; -import co.kirikiri.persistence.helper.RepositoryTest; -import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; +import org.junit.jupiter.api.Test; + import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; -import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; @RepositoryTest class GoalRoomToDoCheckRepositoryTest { @@ -179,7 +180,7 @@ public GoalRoomToDoCheckRepositoryTest(final MemberRepository memberRepository, private Roadmap 로드맵을_생성한다(final Member creator, final RoadmapCategory category, final RoadmapContent roadmapContent) { final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 30, RoadmapDifficulty.DIFFICULT, - creator, category); + creator.getId(), category); roadmap.addContent(roadmapContent); return roadmapRepository.save(roadmap); } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/helper/RepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/helper/RepositoryTest.java index 5bfa474ac..0c86af0c1 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/helper/RepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/helper/RepositoryTest.java @@ -1,14 +1,15 @@ package co.kirikiri.persistence.helper; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestConstructor; import org.springframework.test.context.TestConstructor.AutowireMode; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + @DataJpaTest @ActiveProfiles("test") @Target(ElementType.TYPE) diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/member/MemberRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/member/MemberRepositoryTest.java index 99052941c..9effd8ef1 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/member/MemberRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/member/MemberRepositoryTest.java @@ -1,8 +1,5 @@ package co.kirikiri.persistence.member; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertAll; - import co.kirikiri.domain.ImageContentType; import co.kirikiri.domain.member.EncryptedPassword; import co.kirikiri.domain.member.Gender; @@ -15,8 +12,12 @@ import co.kirikiri.persistence.helper.RepositoryTest; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; + import java.util.Optional; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertAll; + @RepositoryTest class MemberRepositoryTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapCategoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapCategoryTest.java index 3b81e13b5..93e5280ff 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapCategoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapCategoryTest.java @@ -1,14 +1,13 @@ package co.kirikiri.roadmap.domain; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - -import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.exception.RoadmapException; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + class RoadmapCategoryTest { @ParameterizedTest diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentTest.java index 33e0bf18c..b4a08e0e6 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentTest.java @@ -1,27 +1,16 @@ package co.kirikiri.roadmap.domain; +import co.kirikiri.roadmap.domain.exception.RoadmapException; +import org.junit.jupiter.api.Test; + +import java.util.List; + import static co.kirikiri.roadmap.domain.RoadmapDifficulty.DIFFICULT; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import co.kirikiri.domain.member.EncryptedPassword; -import co.kirikiri.domain.member.Gender; -import co.kirikiri.domain.member.Member; -import co.kirikiri.domain.member.MemberProfile; -import co.kirikiri.domain.member.vo.Identifier; -import co.kirikiri.domain.member.vo.Nickname; -import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.roadmap.domain.Roadmap; -import co.kirikiri.roadmap.domain.RoadmapCategory; -import co.kirikiri.roadmap.domain.RoadmapContent; -import co.kirikiri.roadmap.domain.RoadmapNode; -import co.kirikiri.roadmap.domain.RoadmapNodes; -import co.kirikiri.roadmap.domain.exception.RoadmapException; -import java.util.List; -import org.junit.jupiter.api.Test; - class RoadmapContentTest { @Test @@ -79,11 +68,9 @@ class RoadmapContentTest { void 로드맵_본문의_로드맵인_경우_false를_반환한다() { // given final RoadmapContent content = new RoadmapContent("content"); - final MemberProfile profile = new MemberProfile(Gender.FEMALE, "kirikiri1@email.com"); - final Member creator = new Member(new Identifier("creator"), - new EncryptedPassword(new Password("password1")), new Nickname("nickname"), null, profile); + final Long creatorId = 1L; final RoadmapCategory category = new RoadmapCategory(1L, "여가"); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 30, DIFFICULT, creator, category); + final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 30, DIFFICULT, creatorId, category); // when roadmap.addContent(content); diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentsTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentsTest.java index 8aee48bb8..e859f31d1 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentsTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentsTest.java @@ -1,14 +1,11 @@ package co.kirikiri.roadmap.domain; -import static org.assertj.core.api.Assertions.assertThat; - -import co.kirikiri.roadmap.domain.RoadmapContent; -import co.kirikiri.roadmap.domain.RoadmapContents; -import co.kirikiri.roadmap.domain.RoadmapNode; -import co.kirikiri.roadmap.domain.RoadmapNodes; import org.junit.jupiter.api.Test; + import java.util.List; +import static org.assertj.core.api.Assertions.assertThat; + class RoadmapContentsTest { @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodeImagesTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodeImagesTest.java index f79497108..6f3b498ba 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodeImagesTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodeImagesTest.java @@ -1,15 +1,14 @@ package co.kirikiri.roadmap.domain; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - import co.kirikiri.domain.ImageContentType; -import co.kirikiri.roadmap.domain.RoadmapNodeImage; -import co.kirikiri.roadmap.domain.RoadmapNodeImages; import co.kirikiri.roadmap.domain.exception.RoadmapException; -import java.util.List; import org.junit.jupiter.api.Test; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + class RoadmapNodeImagesTest { @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodeTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodeTest.java index 4ac41db42..501c37b51 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodeTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodeTest.java @@ -1,12 +1,11 @@ package co.kirikiri.roadmap.domain; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.exception.RoadmapException; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + class RoadmapNodeTest { @ParameterizedTest diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodesTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodesTest.java index 0f897fa1a..51ba2a17d 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodesTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodesTest.java @@ -1,14 +1,12 @@ package co.kirikiri.roadmap.domain; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertAll; - -import co.kirikiri.roadmap.domain.RoadmapContent; -import co.kirikiri.roadmap.domain.RoadmapNode; -import co.kirikiri.roadmap.domain.RoadmapNodes; import org.junit.jupiter.api.Test; + import java.util.List; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertAll; + class RoadmapNodesTest { @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapReviewTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapReviewTest.java index 3e794fff3..c839785f3 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapReviewTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapReviewTest.java @@ -1,22 +1,14 @@ package co.kirikiri.roadmap.domain; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - -import co.kirikiri.domain.member.EncryptedPassword; -import co.kirikiri.domain.member.Gender; -import co.kirikiri.domain.member.Member; -import co.kirikiri.domain.member.MemberProfile; -import co.kirikiri.domain.member.vo.Identifier; -import co.kirikiri.domain.member.vo.Nickname; -import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.roadmap.domain.RoadmapReview; import co.kirikiri.roadmap.domain.exception.RoadmapException; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + class RoadmapReviewTest { @ParameterizedTest @@ -24,13 +16,11 @@ class RoadmapReviewTest { void 별점이_0부터_5사이의_소수점이_5로_끝나는_값이면서_내용이_1000자_이내라면_정상적으로_생성된다(final Double rate) { // given final String content = "a".repeat(1000); - final MemberProfile profile = new MemberProfile(Gender.FEMALE, "kirikiri1@email.com"); - final Member member = new Member(new Identifier("creator"), new EncryptedPassword(new Password("password1")), - new Nickname("nickname"), null, profile); + final Long memberId = 1L; // expected final RoadmapReview roadmapReview = - assertDoesNotThrow(() -> new RoadmapReview(content, rate, member)); + assertDoesNotThrow(() -> new RoadmapReview(content, rate, memberId)); assertThat(roadmapReview) .isInstanceOf(RoadmapReview.class); } @@ -39,12 +29,10 @@ class RoadmapReviewTest { void 리뷰_내용이_1000자를_넘으면_예외가_발생한다() { // given final String content = "a".repeat(1001); - final MemberProfile profile = new MemberProfile(Gender.FEMALE, "kirikiri1@email.com"); - final Member member = new Member(new Identifier("creator"), new EncryptedPassword(new Password("password1")), - new Nickname("nickname"), null, profile); + final Long memberId = 1L; // expected - assertThatThrownBy(() -> new RoadmapReview(content, null, member)) + assertThatThrownBy(() -> new RoadmapReview(content, null, memberId)) .isInstanceOf(RoadmapException.class); } @@ -52,12 +40,10 @@ class RoadmapReviewTest { @ValueSource(doubles = {-1, -1.5, 5.5, 1.2, 3.7, 4.55}) void 리뷰_별점이_0과_5사이의_소수점_5_단위의_값이_아니면_예외가_발생한다(final double rate) { // given - final MemberProfile profile = new MemberProfile(Gender.FEMALE, "kirikiri1@email.com"); - final Member member = new Member(new Identifier("creator"), new EncryptedPassword(new Password("password1")), - new Nickname("nickname"), null, profile); + final Long memberId = 1L; // expected - assertThatThrownBy(() -> new RoadmapReview("리뷰", rate, member)) + assertThatThrownBy(() -> new RoadmapReview("리뷰", rate, memberId)) .isInstanceOf(RoadmapException.class); } } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTagsTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTagsTest.java index 2d578fbe7..d0d49348c 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTagsTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTagsTest.java @@ -1,16 +1,15 @@ package co.kirikiri.roadmap.domain; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - -import co.kirikiri.roadmap.domain.RoadmapTag; -import co.kirikiri.roadmap.domain.RoadmapTags; import co.kirikiri.roadmap.domain.exception.RoadmapException; import co.kirikiri.roadmap.domain.vo.RoadmapTagName; -import java.util.List; import org.junit.jupiter.api.Test; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + class RoadmapTagsTest { @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTest.java index 92006cdaa..83a58ceb4 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTest.java @@ -1,10 +1,5 @@ package co.kirikiri.roadmap.domain; -import static co.kirikiri.roadmap.domain.RoadmapDifficulty.DIFFICULT; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - import co.kirikiri.domain.member.EncryptedPassword; import co.kirikiri.domain.member.Gender; import co.kirikiri.domain.member.Member; @@ -12,21 +7,21 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.roadmap.domain.Roadmap; -import co.kirikiri.roadmap.domain.RoadmapCategory; -import co.kirikiri.roadmap.domain.RoadmapContent; -import co.kirikiri.roadmap.domain.RoadmapContents; -import co.kirikiri.roadmap.domain.RoadmapNode; -import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.roadmap.domain.exception.RoadmapException; -import java.util.List; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import java.util.List; + +import static co.kirikiri.roadmap.domain.RoadmapDifficulty.DIFFICULT; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + class RoadmapTest { - private final Member creator = 크리에이터를_생성한다(); + private final Long creatorId = 1L; private final RoadmapCategory category = 카테고리를_생성한다(); private final List roadmapNodes = 로드맵_노드들을_생성한다(); private final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmapNodes); @@ -35,13 +30,13 @@ class RoadmapTest { void 로드맵이_성공적으로_생성된다() { // expect assertDoesNotThrow(() -> new Roadmap("로드맵 제목", "로드맵 소개글", 30, DIFFICULT, - creator, category)); + creatorId, category)); } @Test void 로드맵에_본문을_추가한다() { // given - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 30, DIFFICULT, creator, category); + final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 30, DIFFICULT, creatorId, category); // when roadmap.addContent(roadmapContent); @@ -58,7 +53,7 @@ class RoadmapTest { final String title = "a".repeat(titleLength); // expect - assertThatThrownBy(() -> new Roadmap(title, "로드맵 소개글", 30, DIFFICULT, creator, category)) + assertThatThrownBy(() -> new Roadmap(title, "로드맵 소개글", 30, DIFFICULT, creatorId, category)) .isInstanceOf(RoadmapException.class); } @@ -69,7 +64,7 @@ class RoadmapTest { final String introduction = "a".repeat(introductionLength); // expect - assertThatThrownBy(() -> new Roadmap("로드맵 제목", introduction, 30, DIFFICULT, creator, category)) + assertThatThrownBy(() -> new Roadmap("로드맵 제목", introduction, 30, DIFFICULT, creatorId, category)) .isInstanceOf(RoadmapException.class); } @@ -77,7 +72,7 @@ class RoadmapTest { @ValueSource(ints = {-1, 1001}) void 로드맵_추천_소요_기간이_0보다_작고_1000보다_크면_예외가_발생한다(final int requiredPeriod) { // expect - assertThatThrownBy(() -> new Roadmap("로드맵 제목", "로드맵 소개글", requiredPeriod, DIFFICULT, creator, category)) + assertThatThrownBy(() -> new Roadmap("로드맵 제목", "로드맵 소개글", requiredPeriod, DIFFICULT, creatorId, category)) .isInstanceOf(RoadmapException.class); } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/vo/RoadmapTagNameTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/vo/RoadmapTagNameTest.java index 84fdd7532..964174089 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/vo/RoadmapTagNameTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/vo/RoadmapTagNameTest.java @@ -1,14 +1,14 @@ package co.kirikiri.roadmap.domain.vo; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - import co.kirikiri.roadmap.domain.exception.RoadmapException; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.ValueSource; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + class RoadmapTagNameTest { @ParameterizedTest diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapContentRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapContentRepositoryTest.java index a7951c67d..caace7105 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapContentRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapContentRepositoryTest.java @@ -79,7 +79,7 @@ public RoadmapContentRepositoryTest(final MemberRepository memberRepository, final RoadmapCategory category = 로드맵_카테고리를_생성한다(); final RoadmapContent content = new RoadmapContent("로드맵 제목"); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.NORMAL, creator, category); + final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.NORMAL, creator.getId(), category); roadmap.addContent(content); return roadmap; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapRepositoryTest.java index 3cacee0da..2129accf6 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapRepositoryTest.java @@ -70,7 +70,7 @@ public RoadmapRepositoryTest(final MemberRepository memberRepository, // given final Member creator = 사용자를_생성한다("cokirikiri", "코끼리"); final RoadmapCategory category = 카테고리를_생성한다("여가"); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator, category); + final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); // when final Roadmap savedRoadmap = roadmapRepository.save(roadmap); @@ -295,17 +295,17 @@ public RoadmapRepositoryTest(final MemberRepository memberRepository, 노드_정보를_포함한_삭제된_로드맵을_저장한다("여행 로드맵2", creator, travelCategory); // gameRoadmap1 : 4.5 - final RoadmapReview gameRoadmap1Review = new RoadmapReview("리뷰1", 4.5, follower); + final RoadmapReview gameRoadmap1Review = new RoadmapReview("리뷰1", 4.5, follower.getId()); gameRoadmap1.addReview(gameRoadmap1Review); roadmapRepository.save(gameRoadmap1); // gameRoadmap2 : 5.0 - final RoadmapReview gameRoadmap2Review = new RoadmapReview("리뷰2", 5.0, follower); + final RoadmapReview gameRoadmap2Review = new RoadmapReview("리뷰2", 5.0, follower.getId()); gameRoadmap2.addReview(gameRoadmap2Review); roadmapRepository.save(gameRoadmap2); // travelRoadmap : 4.0 - final RoadmapReview travelRoadmapReview = new RoadmapReview("리뷰3", 4.0, follower); + final RoadmapReview travelRoadmapReview = new RoadmapReview("리뷰3", 4.0, follower.getId()); travelRoadmap.addReview(travelRoadmapReview); roadmapRepository.save(travelRoadmap); @@ -463,9 +463,9 @@ public RoadmapRepositoryTest(final MemberRepository memberRepository, roadmapRepository.saveAll(List.of(gameRoadmap, travelRoadmap, deletedGameRoadmap)); // when - final List roadmapsFirstPage = roadmapRepository.findRoadmapsWithCategoryByMemberOrderByLatest(creator, + final List roadmapsFirstPage = roadmapRepository.findRoadmapsWithCategoryByMemberIdOrderByLatest(creator, null, 2); - final List roadmapsSecondPage = roadmapRepository.findRoadmapsWithCategoryByMemberOrderByLatest( + final List roadmapsSecondPage = roadmapRepository.findRoadmapsWithCategoryByMemberIdOrderByLatest( creator, roadmapsFirstPage.get(1).getId(), 2); // then @@ -560,13 +560,13 @@ public RoadmapRepositoryTest(final MemberRepository memberRepository, } private Roadmap 로드맵을_저장한다(final String title, final Member creator, final RoadmapCategory category) { - final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator, category); + final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); roadmap.addContent(new RoadmapContent("로드맵 본문")); return roadmapRepository.save(roadmap); } private Roadmap 삭제된_로드맵을_저장한다(final String title, final Member creator, final RoadmapCategory category) { - final Roadmap roadmap = new Roadmap(title, "로드맵 소개글2", 7, RoadmapDifficulty.DIFFICULT, creator, category); + final Roadmap roadmap = new Roadmap(title, "로드맵 소개글2", 7, RoadmapDifficulty.DIFFICULT, creator.getId(), category); roadmap.addContent(new RoadmapContent("로드맵 본문2")); roadmap.delete(); return roadmapRepository.save(roadmap); @@ -574,13 +574,13 @@ public RoadmapRepositoryTest(final MemberRepository memberRepository, private Roadmap 로드맵을_태그와_저장한다(final String title, final Member creator, final RoadmapCategory category, final RoadmapTags roadmapTags) { - final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator, category); + final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); roadmap.addTags(roadmapTags); return roadmapRepository.save(roadmap); } private Roadmap 노드_정보를_포함한_로드맵을_생성한다(final String title, final Member creator, final RoadmapCategory category) { - final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator, category); + final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); final RoadmapNode roadmapNode1 = 로드맵_노드를_생성한다("로드맵 1주차", "로드맵 1주차 내용"); final RoadmapNode roadmapNode2 = 로드맵_노드를_생성한다("로드맵 2주차", "로드맵 2주차 내용"); final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(List.of(roadmapNode1, roadmapNode2)); @@ -589,7 +589,7 @@ public RoadmapRepositoryTest(final MemberRepository memberRepository, } private Roadmap 노드_정보를_포함한_삭제된_로드맵을_저장한다(final String title, final Member creator, final RoadmapCategory category) { - final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator, category); + final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); final RoadmapNode roadmapNode1 = 로드맵_노드를_생성한다("로드맵 1주차", "로드맵 1주차 내용"); final RoadmapNode roadmapNode2 = 로드맵_노드를_생성한다("로드맵 2주차", "로드맵 2주차 내용"); final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(List.of(roadmapNode1, roadmapNode2)); diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepositoryTest.java index 648142179..6bee8d130 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepositoryTest.java @@ -51,16 +51,16 @@ public RoadmapReviewRepositoryTest(final MemberRepository memberRepository, final RoadmapCategory category = 카테고리를_저장한다("게임"); final Roadmap roadmap = 로드맵을_저장한다(member, category); - final RoadmapReview roadmapReview = new RoadmapReview("리뷰", 1.5, member); + final RoadmapReview roadmapReview = new RoadmapReview("리뷰", 1.5, member.getId()); roadmapReview.updateRoadmap(roadmap); roadmapReviewRepository.save(roadmapReview); // when - final RoadmapReview findRoadmapReview = roadmapReviewRepository.findByRoadmapAndMember(roadmap, member).get(); + final RoadmapReview findRoadmapReview = roadmapReviewRepository.findByRoadmapAndMemberId(roadmap, member.getId()) + .get(); // then - assertThat(findRoadmapReview) - .isEqualTo(roadmapReview); + assertThat(findRoadmapReview).isEqualTo(roadmapReview); } @Test @@ -71,17 +71,16 @@ public RoadmapReviewRepositoryTest(final MemberRepository memberRepository, final RoadmapCategory category = 카테고리를_저장한다("게임"); final Roadmap roadmap = 로드맵을_저장한다(member, category); - final RoadmapReview roadmapReview = new RoadmapReview("리뷰", 2.5, member); + final RoadmapReview roadmapReview = new RoadmapReview("리뷰", 2.5, member.getId()); roadmapReview.updateRoadmap(roadmap); roadmapReviewRepository.save(roadmapReview); // when - final Optional findRoadmapReview = roadmapReviewRepository.findByRoadmapAndMember(roadmap, - member2); + final Optional findRoadmapReview = roadmapReviewRepository.findByRoadmapAndMemberId(roadmap, + member2.getId()); // then - assertThat(findRoadmapReview) - .isEmpty(); + assertThat(findRoadmapReview).isEmpty(); } @Test @@ -93,9 +92,9 @@ public RoadmapReviewRepositoryTest(final MemberRepository memberRepository, final RoadmapCategory category = 카테고리를_저장한다("게임"); final Roadmap roadmap = 로드맵을_저장한다(member, category); - final RoadmapReview roadmapReview1 = new RoadmapReview("리뷰1", 2.5, member); - final RoadmapReview roadmapReview2 = new RoadmapReview("리뷰2", 4.0, member2); - final RoadmapReview roadmapReview3 = new RoadmapReview("리뷰3", 5.0, member3); + final RoadmapReview roadmapReview1 = new RoadmapReview("리뷰1", 2.5, member.getId()); + final RoadmapReview roadmapReview2 = new RoadmapReview("리뷰2", 4.0, member2.getId()); + final RoadmapReview roadmapReview3 = new RoadmapReview("리뷰3", 5.0, member3.getId()); roadmapReview1.updateRoadmap(roadmap); roadmapReview2.updateRoadmap(roadmap); roadmapReview3.updateRoadmap(roadmap); @@ -104,10 +103,10 @@ public RoadmapReviewRepositoryTest(final MemberRepository memberRepository, roadmapReviewRepository.save(roadmapReview3); // when - final List roadmapReviewsFirstPage = roadmapReviewRepository.findRoadmapReviewWithMemberByRoadmapOrderByLatest( + final List roadmapReviewsFirstPage = roadmapReviewRepository.findRoadmapReviewByRoadmapOrderByLatest( roadmap, null, 2); - final List roadmapReviewsSecondPage = roadmapReviewRepository.findRoadmapReviewWithMemberByRoadmapOrderByLatest( + final List roadmapReviewsSecondPage = roadmapReviewRepository.findRoadmapReviewByRoadmapOrderByLatest( roadmap, roadmapReviewsFirstPage.get(1).getId(), 2); // then @@ -128,12 +127,12 @@ public RoadmapReviewRepositoryTest(final MemberRepository memberRepository, final Roadmap roadmap1 = 로드맵을_저장한다(member, category); final Roadmap roadmap2 = 로드맵을_저장한다(member2, category); - final RoadmapReview roadmapReview = new RoadmapReview("리뷰", 2.5, member); + final RoadmapReview roadmapReview = new RoadmapReview("리뷰", 2.5, member.getId()); roadmapReview.updateRoadmap(roadmap1); roadmapReviewRepository.save(roadmapReview); // when - final List roadmapReviewsFirstPage = roadmapReviewRepository.findRoadmapReviewWithMemberByRoadmapOrderByLatest( + final List roadmapReviewsFirstPage = roadmapReviewRepository.findRoadmapReviewByRoadmapOrderByLatest( roadmap2, null, 1); // then @@ -156,7 +155,7 @@ public RoadmapReviewRepositoryTest(final MemberRepository memberRepository, private Roadmap 로드맵을_저장한다(final Member creator, final RoadmapCategory category) { final List roadmapNodes = 로드맵_노드들을_생성한다(); final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmapNodes); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator, category); + final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); roadmap.addContent(roadmapContent); return roadmapRepository.save(roadmap); } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/resolver/RoadmapSaveArgumentResolverImplTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/resolver/RoadmapSaveArgumentResolverImplTest.java index 5a7e9d2b1..bf837f8f2 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/resolver/RoadmapSaveArgumentResolverImplTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/resolver/RoadmapSaveArgumentResolverImplTest.java @@ -18,8 +18,6 @@ import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.method.support.ModelAndViewContainer; -import javax.xml.validation.Validator; - import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.when; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java index 31b639392..156b8e384 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java @@ -1,12 +1,5 @@ package co.kirikiri.roadmap.service; -import co.kirikiri.domain.member.EncryptedPassword; -import co.kirikiri.domain.member.Gender; -import co.kirikiri.domain.member.Member; -import co.kirikiri.domain.member.MemberProfile; -import co.kirikiri.domain.member.vo.Identifier; -import co.kirikiri.domain.member.vo.Nickname; -import co.kirikiri.domain.member.vo.Password; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; @@ -42,9 +35,7 @@ @ExtendWith(MockitoExtension.class) class RoadmapCreateEventListenerTest { - private static final Member member = new Member(1L, new Identifier("identifier1"), - null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임"), null, - new MemberProfile(Gender.FEMALE, "kirikiri@email.com")); + private final Long memberId = 1L; @Mock private RoadmapContentRepository roadmapContentRepository; @@ -65,7 +56,7 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 roadmapContent.addNodes(new RoadmapNodes(List.of(roadmapNode))); final Roadmap roadmap = new Roadmap("roadmapTitle", "inroduction", 10, - RoadmapDifficulty.DIFFICULT, member, new RoadmapCategory("category")); + RoadmapDifficulty.DIFFICULT, memberId, new RoadmapCategory("category")); final MultipartFile imageFile = new MockMultipartFile(roadmapNode.getTitle(), "originalFileName.jpeg", "image/jpeg", "tempImage".getBytes()); @@ -92,7 +83,7 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 void 로드맵에_컨텐츠가_존재하지_않을_경우_예외를_던진다() throws IOException { //given final Roadmap roadmap = new Roadmap("roadmapTitle", "inroduction", 10, - RoadmapDifficulty.DIFFICULT, member, new RoadmapCategory("category")); + RoadmapDifficulty.DIFFICULT, memberId, new RoadmapCategory("category")); final MultipartFile imageFile = new MockMultipartFile("roadmapNodeTitle", "originalFileName.jpeg", "image/jpeg", "tempImage".getBytes()); @@ -120,7 +111,7 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 roadmapContent.addNodes(new RoadmapNodes(List.of(roadmapNode))); final Roadmap roadmap = new Roadmap("roadmapTitle", "inroduction", 10, - RoadmapDifficulty.DIFFICULT, member, new RoadmapCategory("category")); + RoadmapDifficulty.DIFFICULT, memberId, new RoadmapCategory("category")); final MultipartFile imageFile = new MockMultipartFile(roadmapNode.getTitle(), "originalFileName.jpeg", "image/jpeg", "tempImage".getBytes()); @@ -150,7 +141,7 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 roadmapContent.addNodes(new RoadmapNodes(List.of(roadmapNode))); final Roadmap roadmap = new Roadmap("roadmapTitle", "inroduction", 10, - RoadmapDifficulty.DIFFICULT, member, new RoadmapCategory("category")); + RoadmapDifficulty.DIFFICULT, memberId, new RoadmapCategory("category")); final MultipartFile imageFile = new MockMultipartFile(roadmapNode.getTitle(), null, "image/jpeg", "tempImage".getBytes()); diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateServiceTest.java index 745f3dd17..75541762d 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateServiceTest.java @@ -95,7 +95,7 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 .willReturn(Optional.of(category)); given(roadmapRepository.save(any())) .willReturn(new Roadmap(1L, roadmapTitle, roadmapIntroduction, requiredPeriod, - RoadmapDifficulty.valueOf(difficulty.name()), MEMBER, category)); + RoadmapDifficulty.valueOf(difficulty.name()), MEMBER.getId(), category)); when(memberRepository.findByIdentifier(MEMBER.getIdentifier())) .thenReturn(Optional.of(MEMBER)); @@ -155,7 +155,7 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 .thenReturn(Optional.of(roadmap)); when(roadmapGoalRoomService.findCompletedGoalRoomMember(anyLong(), any())) .thenReturn(follower); - when(roadmapReviewRepository.findByRoadmapAndMember(any(), any())) + when(roadmapReviewRepository.findByRoadmapAndMemberId(any(), anyLong())) .thenReturn(Optional.empty()); final RoadmapReviewSaveRequest roadmapReviewSaveRequest = new RoadmapReviewSaveRequest("최고의 로드맵이네요", 5.0); @@ -216,8 +216,8 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 .thenReturn(Optional.of(roadmap)); when(roadmapGoalRoomService.findCompletedGoalRoomMember(anyLong(), any())) .thenReturn(follower); - when(roadmapReviewRepository.findByRoadmapAndMember(any(), any())) - .thenReturn(Optional.of(new RoadmapReview("로드맵 짱!", 5.0, MEMBER))); + when(roadmapReviewRepository.findByRoadmapAndMemberId(any(), anyLong())) + .thenReturn(Optional.of(new RoadmapReview("로드맵 짱!", 5.0, MEMBER.getId()))); final RoadmapReviewSaveRequest roadmapReviewSaveRequest = new RoadmapReviewSaveRequest("최고의 로드맵이네요", 5.0); @@ -335,7 +335,7 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 private Roadmap 로드맵을_생성한다(final Member creator, final RoadmapCategory category) { final RoadmapContent content = new RoadmapContent("콘텐츠 제목"); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.NORMAL, creator, category); + final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.NORMAL, creator.getId(), category); roadmap.addContent(content); return roadmap; } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java index 2bd8e6401..bfa129c64 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java @@ -115,6 +115,8 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 .thenReturn(Optional.of(roadmap.getContents().getValues().get(0))); when(roadmapGoalRoomService.findRoadmapGoalRoomsByRoadmap(any())) .thenReturn(new RoadmapGoalRoomNumberDto(2, 2, 2)); + when(memberRepository.findWithMemberProfileAndImageById(anyLong())) + .thenReturn(Optional.of(member)); when(fileService.generateUrl(anyString(), any())) .thenReturn(new URL("http://example.com/serverFilePath")); @@ -177,6 +179,8 @@ roadmapId, new RoadmapCategoryResponse(1L, "운동"), "로드맵 제목", "로 .thenReturn(Optional.of(category)); when(roadmapRepository.findRoadmapsByCategory(any(), any(), any(), anyInt())) .thenReturn(roadmaps); + when(memberRepository.findWithMemberProfileAndImageById(anyLong())) + .thenReturn(Optional.of(member)); given(fileService.generateUrl(anyString(), any())) .willReturn(new URL("http://example.com/serverFilePath")); @@ -226,6 +230,8 @@ roadmapId, new RoadmapCategoryResponse(1L, "운동"), "로드맵 제목", "로 .thenReturn(Optional.of(category)); when(roadmapRepository.findRoadmapsByCategory(any(), any(), any(), anyInt())) .thenReturn(roadmaps); + when(memberRepository.findWithMemberProfileAndImageById(anyLong())) + .thenReturn(Optional.of(member)); given(fileService.generateUrl(anyString(), any())) .willReturn(new URL("http://example.com/serverFilePath")); @@ -263,6 +269,8 @@ roadmapId, new RoadmapCategoryResponse(1L, "운동"), "로드맵 제목", "로 when(roadmapRepository.findRoadmapsByCategory(any(), any(), any(), anyInt())) .thenReturn(roadmaps); + when(memberRepository.findWithMemberProfileAndImageById(anyLong())) + .thenReturn(Optional.of(member)); given(fileService.generateUrl(anyString(), any())) .willReturn(new URL("http://example.com/serverFilePath")); @@ -310,6 +318,8 @@ roadmapId, new RoadmapCategoryResponse(1L, "운동"), "로드맵 제목", "로 .thenReturn(Optional.of(new RoadmapCategory("여행"))); when(roadmapRepository.findRoadmapsByCategory(any(), any(), any(), anyInt())) .thenReturn(roadmaps); + when(memberRepository.findWithMemberProfileAndImageById(anyLong())) + .thenReturn(Optional.of(member)); given(fileService.generateUrl(anyString(), any())) .willReturn(new URL("http://example.com/serverFilePath")); @@ -364,6 +374,8 @@ roadmapId, new RoadmapCategoryResponse(1L, "운동"), "로드맵 제목", "로 when(roadmapRepository.findRoadmapsByCond(any(), any(), any(), anyInt())) .thenReturn(roadmaps); + when(memberRepository.findWithMemberProfileAndImageById(anyLong())) + .thenReturn(Optional.of(member)); given(fileService.generateUrl(anyString(), any())) .willReturn(new URL("http://example.com/serverFilePath")); @@ -412,7 +424,7 @@ roadmapId, new RoadmapCategoryResponse(1L, "운동"), "로드맵 제목", "로 when(memberRepository.findByIdentifier(any())) .thenReturn(Optional.of(member)); - when(roadmapRepository.findRoadmapsWithCategoryByMemberOrderByLatest(any(), any(), anyInt())) + when(roadmapRepository.findRoadmapsWithCategoryByMemberIdOrderByLatest(any(), any(), anyInt())) .thenReturn(List.of(roadmap2, roadmap1)); // when @@ -454,7 +466,7 @@ roadmapId, new RoadmapCategoryResponse(1L, "운동"), "로드맵 제목", "로 final RoadmapNodes roadmapNodes = new RoadmapNodes(List.of(roadmapNode1, roadmapNode2)); final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); roadmapContent.addNodes(roadmapNodes); - final Roadmap roadmap = new Roadmap(1L, "로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.DIFFICULT, member1, + final Roadmap roadmap = new Roadmap(1L, "로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.DIFFICULT, member1.getId(), new RoadmapCategory("it")); final Member member2 = 사용자를_생성한다(2L, "identifier2", "name2"); @@ -512,17 +524,19 @@ RoadmapGoalRoomsOrderTypeDto.LATEST, new CustomScrollRequest(null, 10))) final RoadmapNodes roadmapNodes = new RoadmapNodes(List.of(roadmapNode1, roadmapNode2)); final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); roadmapContent.addNodes(roadmapNodes); - final Roadmap roadmap = new Roadmap(1L, "로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.DIFFICULT, member1, + final Roadmap roadmap = new Roadmap(1L, "로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.DIFFICULT, member1.getId(), new RoadmapCategory("it")); - final RoadmapReview roadmapReview1 = new RoadmapReview("리뷰 내용", 5.0, member1); - final RoadmapReview roadmapReview2 = new RoadmapReview("리뷰 내용", 4.5, member2); + final RoadmapReview roadmapReview1 = new RoadmapReview("리뷰 내용", 5.0, member1.getId()); + final RoadmapReview roadmapReview2 = new RoadmapReview("리뷰 내용", 4.5, member2.getId()); roadmapReview1.updateRoadmap(roadmap); roadmapReview2.updateRoadmap(roadmap); when(roadmapRepository.findRoadmapById(anyLong())).thenReturn(Optional.of(roadmap)); - when(roadmapReviewRepository.findRoadmapReviewWithMemberByRoadmapOrderByLatest(any(), any(), anyInt())) + when(roadmapReviewRepository.findRoadmapReviewByRoadmapOrderByLatest(any(), any(), anyInt())) .thenReturn(List.of(roadmapReview2, roadmapReview1)); + when(memberRepository.findWithMemberProfileAndImageById(anyLong())) + .thenReturn(Optional.of(member2), Optional.of(member1)); given(fileService.generateUrl(anyString(), any())) .willReturn(new URL("http://example.com/serverFilePath")); @@ -565,7 +579,7 @@ null, new EncryptedPassword(new Password("password1!")), private Roadmap 로드맵을_생성한다(final String roadmapTitle, final RoadmapCategory category) { final Roadmap roadmap = new Roadmap(1L, roadmapTitle, "로드맵 소개글", 30, - RoadmapDifficulty.valueOf("DIFFICULT"), member, category); + RoadmapDifficulty.valueOf("DIFFICULT"), member.getId(), category); final RoadmapTags roadmapTags = new RoadmapTags( List.of(new RoadmapTag(1L, new RoadmapTagName("태그1")), diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapSchedulerTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapSchedulerTest.java index 0aa56e8dd..b5506f538 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapSchedulerTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapSchedulerTest.java @@ -60,7 +60,7 @@ class RoadmapSchedulerTest { roadmapContent1_1.addNodes(new RoadmapNodes(List.of(roadmapNode1))); roadmapContent1_2.addNodes(new RoadmapNodes(List.of(roadmapNode1))); - final Roadmap roadmap1 = new Roadmap("로드맵2", "로드맵 설명2", 30, RoadmapDifficulty.DIFFICULT, member1, category); + final Roadmap roadmap1 = new Roadmap("로드맵2", "로드맵 설명2", 30, RoadmapDifficulty.DIFFICULT, member1.getId(), category); roadmap1.addContent(roadmapContent1_1); roadmap1.addContent(roadmapContent1_2); @@ -89,7 +89,7 @@ class RoadmapSchedulerTest { final RoadmapNode roadmapNode1 = new RoadmapNode("로드맵1 노드", "로드맵 노드 내용"); roadmapContent1.addNodes(new RoadmapNodes(List.of(roadmapNode1))); - final Roadmap roadmap1 = new Roadmap("로드맵1", "로드맵 설명1", 30, RoadmapDifficulty.DIFFICULT, member1, category); + final Roadmap roadmap1 = new Roadmap("로드맵1", "로드맵 설명1", 30, RoadmapDifficulty.DIFFICULT, member1.getId(), category); roadmap1.addContent(roadmapContent1); given(roadmapRepository.findWithRoadmapContentByStatus(any())) @@ -117,7 +117,7 @@ class RoadmapSchedulerTest { final RoadmapNode roadmapNode = new RoadmapNode("로드맵 노드", "로드맵 노드 내용"); roadmapContent1.addNodes(new RoadmapNodes(List.of(roadmapNode))); - final Roadmap roadmap1 = new Roadmap("로드맵1", "로드맵 설명1", 30, RoadmapDifficulty.DIFFICULT, member1, category); + final Roadmap roadmap1 = new Roadmap("로드맵1", "로드맵 설명1", 30, RoadmapDifficulty.DIFFICULT, member1.getId(), category); roadmap1.addContent(roadmapContent1); given(roadmapRepository.findWithRoadmapContentByStatus(any())) diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/AuthServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/AuthServiceTest.java index ddf3ec88a..0ee29d717 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/AuthServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/AuthServiceTest.java @@ -1,10 +1,5 @@ package co.kirikiri.service; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.given; - import co.kirikiri.domain.member.EncryptedPassword; import co.kirikiri.domain.member.Gender; import co.kirikiri.domain.member.Member; @@ -20,7 +15,6 @@ import co.kirikiri.service.dto.auth.request.ReissueTokenRequest; import co.kirikiri.service.dto.auth.response.AuthenticationResponse; import co.kirikiri.service.exception.AuthenticationException; -import java.util.Optional; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -28,6 +22,13 @@ import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; +import java.util.Optional; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.given; + @ExtendWith(MockitoExtension.class) class AuthServiceTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/CacheKeyGeneratorTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/CacheKeyGeneratorTest.java index 08fea3baf..a1dae0e47 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/CacheKeyGeneratorTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/CacheKeyGeneratorTest.java @@ -1,9 +1,10 @@ package co.kirikiri.service; -import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.Test; import java.lang.reflect.Method; -import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; class CacheKeyGeneratorTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomCreateServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomCreateServiceTest.java index 33025688f..0a45fa803 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomCreateServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomCreateServiceTest.java @@ -1,18 +1,5 @@ package co.kirikiri.service; -import static co.kirikiri.domain.goalroom.GoalRoomStatus.RUNNING; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertAll; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - import co.kirikiri.domain.ImageContentType; import co.kirikiri.domain.exception.ImageExtensionException; import co.kirikiri.domain.goalroom.CheckFeed; @@ -35,6 +22,11 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; +import co.kirikiri.persistence.goalroom.CheckFeedRepository; +import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; +import co.kirikiri.persistence.goalroom.GoalRoomRepository; +import co.kirikiri.persistence.goalroom.GoalRoomToDoCheckRepository; +import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; @@ -45,11 +37,6 @@ import co.kirikiri.roadmap.domain.RoadmapNodeImages; import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.roadmap.domain.RoadmapStatus; -import co.kirikiri.persistence.goalroom.CheckFeedRepository; -import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; -import co.kirikiri.persistence.goalroom.GoalRoomRepository; -import co.kirikiri.persistence.goalroom.GoalRoomToDoCheckRepository; -import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.service.dto.goalroom.request.CheckFeedRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomCreateRequest; @@ -59,13 +46,6 @@ import co.kirikiri.service.exception.BadRequestException; import co.kirikiri.service.exception.NotFoundException; import co.kirikiri.service.goalroom.GoalRoomCreateService; -import java.net.MalformedURLException; -import java.net.URL; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -74,6 +54,23 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.mock.web.MockMultipartFile; +import java.net.MalformedURLException; +import java.net.URL; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import static co.kirikiri.domain.goalroom.GoalRoomStatus.RUNNING; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.*; + @ExtendWith(MockitoExtension.class) class GoalRoomCreateServiceTest { @@ -92,10 +89,10 @@ class GoalRoomCreateServiceTest { new MemberProfile(Gender.FEMALE, "kirikiri@email.com")); private static final Roadmap ROADMAP = new Roadmap("roadmap", "introduction", 30, RoadmapDifficulty.DIFFICULT, - MEMBER, new RoadmapCategory("IT")); + MEMBER.getId(), new RoadmapCategory("IT")); private static final Roadmap DELETED_ROADMAP = new Roadmap("roadmap", "introduction", 30, - RoadmapDifficulty.DIFFICULT, RoadmapStatus.DELETED, MEMBER, new RoadmapCategory("IT")); + RoadmapDifficulty.DIFFICULT, RoadmapStatus.DELETED, MEMBER.getId(), new RoadmapCategory("IT")); private static Member member; @@ -999,7 +996,7 @@ static void setUp() { final RoadmapCategory category = new RoadmapCategory("게임"); final List roadmapNodes = 로드맵_노드들을_생성한다(); final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmapNodes); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator, category); + final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); roadmap.addContent(roadmapContent); return roadmap; } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomReadServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomReadServiceTest.java index 623fa5d51..12d69ca0a 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomReadServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomReadServiceTest.java @@ -1,15 +1,5 @@ package co.kirikiri.service; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - import co.kirikiri.domain.ImageContentType; import co.kirikiri.domain.goalroom.CheckFeed; import co.kirikiri.domain.goalroom.GoalRoom; @@ -32,6 +22,12 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; +import co.kirikiri.persistence.goalroom.CheckFeedRepository; +import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; +import co.kirikiri.persistence.goalroom.GoalRoomPendingMemberRepository; +import co.kirikiri.persistence.goalroom.GoalRoomRepository; +import co.kirikiri.persistence.goalroom.GoalRoomToDoCheckRepository; +import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; @@ -41,12 +37,6 @@ import co.kirikiri.roadmap.domain.RoadmapNodeImage; import co.kirikiri.roadmap.domain.RoadmapNodeImages; import co.kirikiri.roadmap.domain.RoadmapNodes; -import co.kirikiri.persistence.goalroom.CheckFeedRepository; -import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; -import co.kirikiri.persistence.goalroom.GoalRoomPendingMemberRepository; -import co.kirikiri.persistence.goalroom.GoalRoomRepository; -import co.kirikiri.persistence.goalroom.GoalRoomToDoCheckRepository; -import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.service.dto.goalroom.GoalRoomMemberSortTypeDto; import co.kirikiri.service.dto.goalroom.request.GoalRoomStatusTypeRequest; import co.kirikiri.service.dto.goalroom.response.CheckFeedResponse; @@ -65,6 +55,12 @@ import co.kirikiri.service.exception.ForbiddenException; import co.kirikiri.service.exception.NotFoundException; import co.kirikiri.service.goalroom.GoalRoomReadService; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; + import java.net.MalformedURLException; import java.net.URL; import java.time.LocalDate; @@ -72,11 +68,12 @@ import java.util.Collections; import java.util.List; import java.util.Optional; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) class GoalRoomReadServiceTest { @@ -1201,7 +1198,7 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("name1"), final RoadmapCategory category = new RoadmapCategory("게임"); final List roadmapNodes = 로드맵_노드들을_생성한다(); final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmapNodes); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator, category); + final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); roadmap.addContent(roadmapContent); return roadmap; } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomSchedulerTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomSchedulerTest.java index cf4caa200..7b1febac4 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomSchedulerTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomSchedulerTest.java @@ -1,14 +1,5 @@ package co.kirikiri.service; -import static co.kirikiri.domain.goalroom.GoalRoomStatus.RECRUITING; -import static co.kirikiri.domain.goalroom.GoalRoomStatus.RUNNING; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertAll; -import static org.mockito.ArgumentMatchers.anyList; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - import co.kirikiri.domain.ImageContentType; import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomPendingMember; @@ -25,6 +16,9 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; +import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; +import co.kirikiri.persistence.goalroom.GoalRoomPendingMemberRepository; +import co.kirikiri.persistence.goalroom.GoalRoomRepository; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; @@ -34,20 +28,25 @@ import co.kirikiri.roadmap.domain.RoadmapNodeImage; import co.kirikiri.roadmap.domain.RoadmapNodeImages; import co.kirikiri.roadmap.domain.RoadmapNodes; -import co.kirikiri.persistence.goalroom.GoalRoomMemberRepository; -import co.kirikiri.persistence.goalroom.GoalRoomPendingMemberRepository; -import co.kirikiri.persistence.goalroom.GoalRoomRepository; import co.kirikiri.service.scheduler.GoalRoomScheduler; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.Collections; -import java.util.List; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.List; + +import static co.kirikiri.domain.goalroom.GoalRoomStatus.RECRUITING; +import static co.kirikiri.domain.goalroom.GoalRoomStatus.RUNNING; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.mockito.ArgumentMatchers.anyList; +import static org.mockito.Mockito.*; + @ExtendWith(MockitoExtension.class) class GoalRoomSchedulerTest { @@ -60,7 +59,7 @@ class GoalRoomSchedulerTest { @Mock private GoalRoomPendingMemberRepository goalRoomPendingMemberRepository; - + @Mock private GoalRoomMemberRepository goalRoomMemberRepository; @@ -149,7 +148,7 @@ class GoalRoomSchedulerTest { final RoadmapCategory category = new RoadmapCategory("게임"); final List roadmapNodes = 로드맵_노드들을_생성한다(); final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmapNodes); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator, category); + final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); roadmap.addContent(roadmapContent); return roadmap; } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/JwtTokenProviderTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/JwtTokenProviderTest.java index ec35509ae..ea3b3a237 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/JwtTokenProviderTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/JwtTokenProviderTest.java @@ -1,19 +1,20 @@ package co.kirikiri.service; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - import co.kirikiri.service.auth.JwtTokenProvider; import co.kirikiri.service.auth.TokenProvider; import co.kirikiri.service.exception.AuthenticationException; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.security.Keys; +import org.junit.jupiter.api.Test; + import java.time.LocalDateTime; import java.util.HashMap; import java.util.Map; -import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; class JwtTokenProviderTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/MemberServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/MemberServiceTest.java index 30d66dc46..64607ee4c 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/MemberServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/MemberServiceTest.java @@ -1,11 +1,5 @@ package co.kirikiri.service; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.BDDMockito.given; - import co.kirikiri.domain.ImageContentType; import co.kirikiri.domain.member.EncryptedPassword; import co.kirikiri.domain.member.Gender; @@ -27,9 +21,6 @@ import co.kirikiri.service.exception.ConflictException; import co.kirikiri.service.exception.NotFoundException; import co.kirikiri.service.member.MemberService; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Optional; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; @@ -39,6 +30,16 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.core.env.Environment; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Optional; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.BDDMockito.given; + @ExtendWith(MockitoExtension.class) class MemberServiceTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/NaverOauthServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/NaverOauthServiceTest.java index 2b0a06491..92aca781e 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/NaverOauthServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/NaverOauthServiceTest.java @@ -1,10 +1,5 @@ package co.kirikiri.service; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.when; - import co.kirikiri.domain.member.Member; import co.kirikiri.persistence.member.MemberRepository; import co.kirikiri.service.auth.AuthService; @@ -23,9 +18,15 @@ import org.springframework.core.env.Environment; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; + import java.util.Map; import java.util.Optional; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.when; + @ExtendWith(MockitoExtension.class) class NaverOauthServiceTest { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/UUIDFilePathGeneratorTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/UUIDFilePathGeneratorTest.java index 7e9dc620d..c759a2218 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/UUIDFilePathGeneratorTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/UUIDFilePathGeneratorTest.java @@ -1,13 +1,13 @@ package co.kirikiri.service; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertTrue; - import co.kirikiri.service.exception.BadRequestException; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertTrue; + class UUIDFilePathGeneratorTest { private final FilePathGenerator filePathGenerator = new UUIDFilePathGenerator(); diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/dto/member/request/GenderTypeTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/dto/member/request/GenderTypeTest.java index 0c043f4e4..03208f363 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/dto/member/request/GenderTypeTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/dto/member/request/GenderTypeTest.java @@ -1,9 +1,9 @@ package co.kirikiri.service.dto.member.request; -import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; + class GenderTypeTest { @Test From b63f1b72ecbc6724ed5b8dcf0d4ad55875582df5 Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Sat, 13 Jan 2024 13:19:51 +0900 Subject: [PATCH 10/22] =?UTF-8?q?chore:=20ScrollResponseMapper=20common?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=9D=B4=EA=B4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{service => common}/mapper/ScrollResponseMapper.java | 2 +- .../java/co/kirikiri/roadmap/service/RoadmapReadService.java | 2 +- .../java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java | 2 +- .../kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename backend/kirikiri/src/main/java/co/kirikiri/{service => common}/mapper/ScrollResponseMapper.java (93%) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/ScrollResponseMapper.java b/backend/kirikiri/src/main/java/co/kirikiri/common/mapper/ScrollResponseMapper.java similarity index 93% rename from backend/kirikiri/src/main/java/co/kirikiri/service/mapper/ScrollResponseMapper.java rename to backend/kirikiri/src/main/java/co/kirikiri/common/mapper/ScrollResponseMapper.java index c9111e99e..732a20010 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/ScrollResponseMapper.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/common/mapper/ScrollResponseMapper.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.mapper; +package co.kirikiri.common.mapper; import lombok.AccessLevel; import lombok.NoArgsConstructor; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java index e80458caa..183940d32 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java @@ -1,5 +1,6 @@ package co.kirikiri.roadmap.service; +import co.kirikiri.common.mapper.ScrollResponseMapper; import co.kirikiri.domain.member.Member; import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.persistence.member.MemberRepository; @@ -40,7 +41,6 @@ import co.kirikiri.service.dto.CustomScrollRequest; import co.kirikiri.service.dto.member.MemberDto; import co.kirikiri.service.exception.NotFoundException; -import co.kirikiri.service.mapper.ScrollResponseMapper; import lombok.RequiredArgsConstructor; import org.springframework.cache.annotation.Cacheable; import org.springframework.http.HttpMethod; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java index 2430eb9dc..4eabf240b 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java @@ -1,5 +1,6 @@ package co.kirikiri.roadmap.service.mapper; +import co.kirikiri.common.mapper.ScrollResponseMapper; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; @@ -36,7 +37,6 @@ import co.kirikiri.service.dto.member.MemberDto; import co.kirikiri.service.dto.member.response.MemberResponse; import co.kirikiri.service.exception.ServerException; -import co.kirikiri.service.mapper.ScrollResponseMapper; import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.springframework.web.multipart.MultipartFile; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java index d563a7b1f..7ca6611ce 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java @@ -1,5 +1,6 @@ package co.kirikiri.service.goalroom; +import co.kirikiri.common.mapper.ScrollResponseMapper; import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomStatus; import co.kirikiri.domain.member.Member; @@ -20,7 +21,6 @@ import co.kirikiri.service.dto.member.MemberDto; import co.kirikiri.service.exception.BadRequestException; import co.kirikiri.service.mapper.GoalRoomMapper; -import co.kirikiri.service.mapper.ScrollResponseMapper; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpMethod; import org.springframework.stereotype.Service; From a0f588b85bd4e4938f1de505f2166f059fc23428 Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Sat, 13 Jan 2024 19:04:12 +0900 Subject: [PATCH 11/22] =?UTF-8?q?refactor:=20=EB=A1=9C=EB=93=9C=EB=A7=B5?= =?UTF-8?q?=20=EC=82=AD=EC=A0=9C=20=EC=8B=9C=20=ED=95=98=EC=9C=84=20?= =?UTF-8?q?=EA=B3=A8=EB=A3=B8=20=EC=82=AD=EC=A0=9C=20=EB=B0=A9=EC=8B=9D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20(OnDelete=20=EC=98=B5=EC=85=98=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../co/kirikiri/domain/goalroom/BaseGoalRoomMember.java | 3 +++ .../main/java/co/kirikiri/domain/goalroom/GoalRoom.java | 3 +++ .../co/kirikiri/domain/goalroom/GoalRoomRoadmapNode.java | 3 +++ .../roadmap/service/scheduler/RoadmapScheduler.java | 7 ++----- .../service/goalroom/RoadmapGoalRoomServiceImpl.java | 9 +++------ 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/BaseGoalRoomMember.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/BaseGoalRoomMember.java index bb87a1069..075c17887 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/BaseGoalRoomMember.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/BaseGoalRoomMember.java @@ -12,6 +12,8 @@ import jakarta.persistence.PrePersist; import lombok.AccessLevel; import lombok.NoArgsConstructor; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; import org.springframework.data.annotation.CreatedDate; import java.time.LocalDateTime; @@ -32,6 +34,7 @@ public abstract class BaseGoalRoomMember extends BaseEntity { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "goal_room_id", nullable = false) + @OnDelete(action = OnDeleteAction.CASCADE) @QueryInit(value = {"roadmapContent.roadmap"}) protected GoalRoom goalRoom; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoom.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoom.java index be56b50fa..c12bd8837 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoom.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoom.java @@ -16,6 +16,8 @@ import jakarta.persistence.ManyToOne; import lombok.AccessLevel; import lombok.NoArgsConstructor; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; import java.time.LocalDate; import java.time.temporal.ChronoUnit; @@ -40,6 +42,7 @@ public class GoalRoom extends BaseUpdatedTimeEntity { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "roadmap_content_id", nullable = false) + @OnDelete(action = OnDeleteAction.CASCADE) private RoadmapContent roadmapContent; @Column(nullable = false) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNode.java b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNode.java index 16d6e4ed7..91f101da5 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNode.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/domain/goalroom/GoalRoomRoadmapNode.java @@ -11,6 +11,8 @@ import jakarta.persistence.ManyToOne; import lombok.AccessLevel; import lombok.NoArgsConstructor; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; import java.time.LocalDate; @@ -27,6 +29,7 @@ public class GoalRoomRoadmapNode extends BaseEntity { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "roadmap_node_id", nullable = false) + @OnDelete(action = OnDeleteAction.CASCADE) private RoadmapNode roadmapNode; public GoalRoomRoadmapNode(final Period period, final Integer checkCount, final RoadmapNode roadmapNode) { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java index 75f2db430..aadeb4e59 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java @@ -32,12 +32,9 @@ public void deleteRoadmaps() { private void delete(final Roadmap roadmap) { final boolean canDelete = roadmapGoalRoomService.canDeleteGoalRoomsInRoadmap(roadmap); + // TODO : GoalRoom 내부의 Roadmap 직접 의존 제거 시 로드맵에 포함된 GoalRoom 따로 제거해주기 (이벤트 활용) if (canDelete) { - deleteRoadmap(roadmap); + roadmapRepository.delete(roadmap); } } - - private void deleteRoadmap(final Roadmap roadmap) { - roadmapRepository.delete(roadmap); - } } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java index 7ca6611ce..6b0fb15b9 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java @@ -30,7 +30,7 @@ import java.util.List; @Service -@Transactional +@Transactional(readOnly = true) @RequiredArgsConstructor @ExceptionConvert public class RoadmapGoalRoomServiceImpl implements RoadmapGoalRoomService { @@ -91,13 +91,10 @@ private MemberDto makeMemberDto(final Member creator) { } @Override + @Transactional public boolean canDeleteGoalRoomsInRoadmap(final Roadmap roadmap) { final List goalRooms = goalRoomRepository.findByRoadmap(roadmap); - final boolean canDelete = canDeleteRoadmapBasedOnGoalRooms(goalRooms); - if (canDelete) { - goalRoomRepository.deleteAll(goalRooms); - } - return canDelete; + return canDeleteRoadmapBasedOnGoalRooms(goalRooms); } private boolean canDeleteRoadmapBasedOnGoalRooms(final List goalRooms) { From 3d6cd17aa93546329c21893157e24c4012215224 Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Sat, 13 Jan 2024 19:31:23 +0900 Subject: [PATCH 12/22] =?UTF-8?q?chore:=20=ED=8C=A8=ED=82=A4=EC=A7=80=20?= =?UTF-8?q?=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/co/kirikiri/common/config/WebConfig.java | 2 +- .../kirikiri/{service => common}/dto/CustomScrollRequest.java | 2 +- .../co/kirikiri/{service => common}/dto/ErrorResponse.java | 2 +- .../co/kirikiri/{service => common}/dto/FileInformation.java | 2 +- .../java/co/kirikiri/controller/GlobalExceptionHandler.java | 2 +- .../src/main/java/co/kirikiri/infra/AmazonS3FileService.java | 2 +- .../co/kirikiri/roadmap/controller/RoadmapController.java | 2 +- .../resolver/RoadmapSaveArgumentResolver.java | 2 +- .../roadmap/resolver/RoadmapSaveArgumentResolverImpl.java | 1 - .../kirikiri/roadmap/service/RoadmapCreateEventListener.java | 2 +- .../co/kirikiri/roadmap/service/RoadmapGoalRoomService.java | 2 +- .../java/co/kirikiri/roadmap/service/RoadmapReadService.java | 2 +- .../co/kirikiri/roadmap/service/dto/RoadmapNodeSaveDto.java | 2 +- .../co/kirikiri/roadmap/service/mapper/RoadmapMapper.java | 2 +- .../src/main/java/co/kirikiri/service/FileService.java | 2 +- .../co/kirikiri/service/goalroom/GoalRoomCreateService.java | 2 +- .../kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java | 2 +- .../main/java/co/kirikiri/service/mapper/GoalRoomMapper.java | 2 +- .../test/java/co/kirikiri/controller/AuthCreateApiTest.java | 2 +- .../java/co/kirikiri/controller/GoalRoomCreateApiTest.java | 2 +- .../test/java/co/kirikiri/controller/GoalRoomReadApiTest.java | 2 +- .../test/java/co/kirikiri/controller/MemberCreateApiTest.java | 2 +- .../test/java/co/kirikiri/controller/MemberReadApiTest.java | 2 +- .../test/java/co/kirikiri/infra/AmazonS3FileServiceTest.java | 2 +- .../kirikiri/integration/AuthenticationIntegrationTest.java | 2 +- .../kirikiri/integration/GoalRoomCreateIntegrationTest.java | 2 +- .../co/kirikiri/integration/GoalRoomReadIntegrationTest.java | 2 +- .../co/kirikiri/integration/MemberCreateIntegrationTest.java | 2 +- .../co/kirikiri/integration/MemberReadIntegrationTest.java | 2 +- .../co/kirikiri/integration/RoadmapCreateIntegrationTest.java | 2 +- .../co/kirikiri/integration/RoadmapReadIntegrationTest.java | 2 +- .../integration/RoadmapReviewCreateIntegrationTest.java | 2 +- .../integration/RoadmapReviewReadIntegrationTest.java | 4 ++-- .../co/kirikiri/integration/fixture/RoadmapAPIFixture.java | 2 +- .../java/co/kirikiri/integration/helper/TestFileService.java | 2 +- .../co/kirikiri/roadmap/controller/RoadmapCreateApiTest.java | 2 +- .../co/kirikiri/roadmap/controller/RoadmapReadApiTest.java | 4 ++-- .../persistence/dto/RoadmapSearchTagNameTest.java | 3 +-- .../{ => roadmap}/persistence/dto/RoadmapSearchTitleTest.java | 3 +-- .../roadmap/service/RoadmapCreateEventListenerTest.java | 2 +- .../co/kirikiri/roadmap/service/RoadmapReadServiceTest.java | 2 +- 41 files changed, 42 insertions(+), 45 deletions(-) rename backend/kirikiri/src/main/java/co/kirikiri/{service => common}/dto/CustomScrollRequest.java (85%) rename backend/kirikiri/src/main/java/co/kirikiri/{service => common}/dto/ErrorResponse.java (93%) rename backend/kirikiri/src/main/java/co/kirikiri/{service => common}/dto/FileInformation.java (84%) rename backend/kirikiri/src/main/java/co/kirikiri/{common => roadmap}/resolver/RoadmapSaveArgumentResolver.java (81%) rename backend/kirikiri/src/test/java/co/kirikiri/{ => roadmap}/persistence/dto/RoadmapSearchTagNameTest.java (93%) rename backend/kirikiri/src/test/java/co/kirikiri/{ => roadmap}/persistence/dto/RoadmapSearchTitleTest.java (93%) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/common/config/WebConfig.java b/backend/kirikiri/src/main/java/co/kirikiri/common/config/WebConfig.java index 2e4d0d052..912857a34 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/common/config/WebConfig.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/common/config/WebConfig.java @@ -2,7 +2,7 @@ import co.kirikiri.common.interceptor.AuthInterceptor; import co.kirikiri.common.resolver.MemberIdentifierArgumentResolver; -import co.kirikiri.common.resolver.RoadmapSaveArgumentResolver; +import co.kirikiri.roadmap.resolver.RoadmapSaveArgumentResolver; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Configuration; import org.springframework.web.method.support.HandlerMethodArgumentResolver; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/CustomScrollRequest.java b/backend/kirikiri/src/main/java/co/kirikiri/common/dto/CustomScrollRequest.java similarity index 85% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/CustomScrollRequest.java rename to backend/kirikiri/src/main/java/co/kirikiri/common/dto/CustomScrollRequest.java index f76ab1dd8..be3a0c7dd 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/CustomScrollRequest.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/common/dto/CustomScrollRequest.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto; +package co.kirikiri.common.dto; import jakarta.validation.constraints.NotNull; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/ErrorResponse.java b/backend/kirikiri/src/main/java/co/kirikiri/common/dto/ErrorResponse.java similarity index 93% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/ErrorResponse.java rename to backend/kirikiri/src/main/java/co/kirikiri/common/dto/ErrorResponse.java index 789d0f211..51558411f 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/ErrorResponse.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/common/dto/ErrorResponse.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto; +package co.kirikiri.common.dto; import java.util.Objects; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/FileInformation.java b/backend/kirikiri/src/main/java/co/kirikiri/common/dto/FileInformation.java similarity index 84% rename from backend/kirikiri/src/main/java/co/kirikiri/service/dto/FileInformation.java rename to backend/kirikiri/src/main/java/co/kirikiri/common/dto/FileInformation.java index 0c1fc17b7..541f887b6 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/dto/FileInformation.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/common/dto/FileInformation.java @@ -1,4 +1,4 @@ -package co.kirikiri.service.dto; +package co.kirikiri.common.dto; import java.io.InputStream; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/controller/GlobalExceptionHandler.java b/backend/kirikiri/src/main/java/co/kirikiri/controller/GlobalExceptionHandler.java index 77834c63a..9377bc24b 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/controller/GlobalExceptionHandler.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/controller/GlobalExceptionHandler.java @@ -1,6 +1,6 @@ package co.kirikiri.controller; -import co.kirikiri.service.dto.ErrorResponse; +import co.kirikiri.common.dto.ErrorResponse; import co.kirikiri.service.exception.AuthenticationException; import co.kirikiri.service.exception.BadRequestException; import co.kirikiri.service.exception.ConflictException; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/infra/AmazonS3FileService.java b/backend/kirikiri/src/main/java/co/kirikiri/infra/AmazonS3FileService.java index a412f13d9..1b48161ae 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/infra/AmazonS3FileService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/infra/AmazonS3FileService.java @@ -1,7 +1,7 @@ package co.kirikiri.infra; +import co.kirikiri.common.dto.FileInformation; import co.kirikiri.service.FileService; -import co.kirikiri.service.dto.FileInformation; import co.kirikiri.service.exception.ServerException; import com.amazonaws.SdkClientException; import com.amazonaws.services.s3.AmazonS3; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/controller/RoadmapController.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/controller/RoadmapController.java index 72d9ae852..99820964a 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/controller/RoadmapController.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/controller/RoadmapController.java @@ -1,5 +1,6 @@ package co.kirikiri.roadmap.controller; +import co.kirikiri.common.dto.CustomScrollRequest; import co.kirikiri.common.interceptor.Authenticated; import co.kirikiri.common.resolver.MemberIdentifier; import co.kirikiri.roadmap.service.RoadmapCreateService; @@ -16,7 +17,6 @@ import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; -import co.kirikiri.service.dto.CustomScrollRequest; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/common/resolver/RoadmapSaveArgumentResolver.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/resolver/RoadmapSaveArgumentResolver.java similarity index 81% rename from backend/kirikiri/src/main/java/co/kirikiri/common/resolver/RoadmapSaveArgumentResolver.java rename to backend/kirikiri/src/main/java/co/kirikiri/roadmap/resolver/RoadmapSaveArgumentResolver.java index f23d7f97e..670ad0e4f 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/common/resolver/RoadmapSaveArgumentResolver.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/resolver/RoadmapSaveArgumentResolver.java @@ -1,4 +1,4 @@ -package co.kirikiri.common.resolver; +package co.kirikiri.roadmap.resolver; import org.springframework.web.method.support.HandlerMethodArgumentResolver; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/resolver/RoadmapSaveArgumentResolverImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/resolver/RoadmapSaveArgumentResolverImpl.java index 4dbf0035a..20a9e9b47 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/resolver/RoadmapSaveArgumentResolverImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/resolver/RoadmapSaveArgumentResolverImpl.java @@ -1,6 +1,5 @@ package co.kirikiri.roadmap.resolver; -import co.kirikiri.common.resolver.RoadmapSaveArgumentResolver; import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; import co.kirikiri.service.exception.BadRequestException; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateEventListener.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateEventListener.java index f80b0ecfd..34fb91528 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateEventListener.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateEventListener.java @@ -1,5 +1,6 @@ package co.kirikiri.roadmap.service; +import co.kirikiri.common.dto.FileInformation; import co.kirikiri.domain.ImageContentType; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapContent; @@ -13,7 +14,6 @@ import co.kirikiri.service.FileService; import co.kirikiri.service.ImageDirType; import co.kirikiri.service.aop.ExceptionConvert; -import co.kirikiri.service.dto.FileInformation; import co.kirikiri.service.exception.BadRequestException; import co.kirikiri.service.exception.ServerException; import lombok.RequiredArgsConstructor; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java index 4c52b2a82..190845356 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java @@ -1,11 +1,11 @@ package co.kirikiri.roadmap.service; +import co.kirikiri.common.dto.CustomScrollRequest; import co.kirikiri.domain.member.Member; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomNumberDto; import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomsOrderTypeDto; import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; -import co.kirikiri.service.dto.CustomScrollRequest; public interface RoadmapGoalRoomService { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java index 183940d32..bedaa2d36 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java @@ -1,5 +1,6 @@ package co.kirikiri.roadmap.service; +import co.kirikiri.common.dto.CustomScrollRequest; import co.kirikiri.common.mapper.ScrollResponseMapper; import co.kirikiri.domain.member.Member; import co.kirikiri.domain.member.vo.Identifier; @@ -38,7 +39,6 @@ import co.kirikiri.roadmap.service.mapper.RoadmapMapper; import co.kirikiri.service.FileService; import co.kirikiri.service.aop.ExceptionConvert; -import co.kirikiri.service.dto.CustomScrollRequest; import co.kirikiri.service.dto.member.MemberDto; import co.kirikiri.service.exception.NotFoundException; import lombok.RequiredArgsConstructor; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapNodeSaveDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapNodeSaveDto.java index f3bc9e9f9..82bb9fa4d 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapNodeSaveDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapNodeSaveDto.java @@ -1,6 +1,6 @@ package co.kirikiri.roadmap.service.dto; -import co.kirikiri.service.dto.FileInformation; +import co.kirikiri.common.dto.FileInformation; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java index 4eabf240b..fa86a89b2 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java @@ -1,5 +1,6 @@ package co.kirikiri.roadmap.service.mapper; +import co.kirikiri.common.dto.FileInformation; import co.kirikiri.common.mapper.ScrollResponseMapper; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; @@ -33,7 +34,6 @@ import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapTagResponse; -import co.kirikiri.service.dto.FileInformation; import co.kirikiri.service.dto.member.MemberDto; import co.kirikiri.service.dto.member.response.MemberResponse; import co.kirikiri.service.exception.ServerException; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/FileService.java b/backend/kirikiri/src/main/java/co/kirikiri/service/FileService.java index 38be87317..984e39c78 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/FileService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/FileService.java @@ -1,6 +1,6 @@ package co.kirikiri.service; -import co.kirikiri.service.dto.FileInformation; +import co.kirikiri.common.dto.FileInformation; import org.springframework.http.HttpMethod; import java.net.URL; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomCreateService.java b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomCreateService.java index fecdae5f9..ffb2d16a8 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomCreateService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomCreateService.java @@ -1,5 +1,6 @@ package co.kirikiri.service.goalroom; +import co.kirikiri.common.dto.FileInformation; import co.kirikiri.domain.ImageContentType; import co.kirikiri.domain.goalroom.CheckFeed; import co.kirikiri.domain.goalroom.GoalRoom; @@ -25,7 +26,6 @@ import co.kirikiri.service.FileService; import co.kirikiri.service.ImageDirType; import co.kirikiri.service.aop.ExceptionConvert; -import co.kirikiri.service.dto.FileInformation; import co.kirikiri.service.dto.goalroom.GoalRoomCreateDto; import co.kirikiri.service.dto.goalroom.GoalRoomRoadmapNodeDto; import co.kirikiri.service.dto.goalroom.request.CheckFeedRequest; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java index 6b0fb15b9..f05407fce 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java @@ -1,5 +1,6 @@ package co.kirikiri.service.goalroom; +import co.kirikiri.common.dto.CustomScrollRequest; import co.kirikiri.common.mapper.ScrollResponseMapper; import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomStatus; @@ -15,7 +16,6 @@ import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; import co.kirikiri.service.FileService; import co.kirikiri.service.aop.ExceptionConvert; -import co.kirikiri.service.dto.CustomScrollRequest; import co.kirikiri.service.dto.goalroom.RoadmapGoalRoomDto; import co.kirikiri.service.dto.goalroom.RoadmapGoalRoomScrollDto; import co.kirikiri.service.dto.member.MemberDto; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/GoalRoomMapper.java b/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/GoalRoomMapper.java index 6f37b962f..f5fcb9de1 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/GoalRoomMapper.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/GoalRoomMapper.java @@ -1,5 +1,6 @@ package co.kirikiri.service.mapper; +import co.kirikiri.common.dto.FileInformation; import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.domain.goalroom.GoalRoomRoadmapNode; import co.kirikiri.domain.goalroom.GoalRoomRoadmapNodes; @@ -17,7 +18,6 @@ import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomsOrderTypeDto; import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; -import co.kirikiri.service.dto.FileInformation; import co.kirikiri.service.dto.goalroom.CheckFeedDto; import co.kirikiri.service.dto.goalroom.GoalRoomCheckFeedDto; import co.kirikiri.service.dto.goalroom.GoalRoomCreateDto; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/controller/AuthCreateApiTest.java b/backend/kirikiri/src/test/java/co/kirikiri/controller/AuthCreateApiTest.java index 52141a41a..ab7ae5e78 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/controller/AuthCreateApiTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/controller/AuthCreateApiTest.java @@ -1,10 +1,10 @@ package co.kirikiri.controller; +import co.kirikiri.common.dto.ErrorResponse; import co.kirikiri.controller.helper.ControllerTestHelper; import co.kirikiri.controller.helper.FieldDescriptionHelper.FieldDescription; import co.kirikiri.service.auth.AuthService; import co.kirikiri.service.auth.NaverOauthService; -import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.auth.OauthRedirectResponse; import co.kirikiri.service.dto.auth.request.LoginRequest; import co.kirikiri.service.dto.auth.request.ReissueTokenRequest; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/controller/GoalRoomCreateApiTest.java b/backend/kirikiri/src/test/java/co/kirikiri/controller/GoalRoomCreateApiTest.java index 700ef68c6..a42b39e8f 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/controller/GoalRoomCreateApiTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/controller/GoalRoomCreateApiTest.java @@ -1,8 +1,8 @@ package co.kirikiri.controller; +import co.kirikiri.common.dto.ErrorResponse; import co.kirikiri.controller.helper.ControllerTestHelper; import co.kirikiri.controller.helper.FieldDescriptionHelper.FieldDescription; -import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.goalroom.request.GoalRoomCreateRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomRoadmapNodeRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomTodoRequest; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/controller/GoalRoomReadApiTest.java b/backend/kirikiri/src/test/java/co/kirikiri/controller/GoalRoomReadApiTest.java index 842586927..3e826ee97 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/controller/GoalRoomReadApiTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/controller/GoalRoomReadApiTest.java @@ -1,8 +1,8 @@ package co.kirikiri.controller; +import co.kirikiri.common.dto.ErrorResponse; import co.kirikiri.controller.helper.ControllerTestHelper; import co.kirikiri.domain.goalroom.GoalRoomStatus; -import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.goalroom.request.GoalRoomStatusTypeRequest; import co.kirikiri.service.dto.goalroom.response.CheckFeedResponse; import co.kirikiri.service.dto.goalroom.response.GoalRoomCertifiedResponse; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/controller/MemberCreateApiTest.java b/backend/kirikiri/src/test/java/co/kirikiri/controller/MemberCreateApiTest.java index 5c3713fac..ee286c0f2 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/controller/MemberCreateApiTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/controller/MemberCreateApiTest.java @@ -1,8 +1,8 @@ package co.kirikiri.controller; +import co.kirikiri.common.dto.ErrorResponse; import co.kirikiri.controller.helper.ControllerTestHelper; import co.kirikiri.controller.helper.FieldDescriptionHelper.FieldDescription; -import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.member.request.GenderType; import co.kirikiri.service.dto.member.request.MemberJoinRequest; import co.kirikiri.service.exception.BadRequestException; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/controller/MemberReadApiTest.java b/backend/kirikiri/src/test/java/co/kirikiri/controller/MemberReadApiTest.java index 95960acdf..d4cfb82e7 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/controller/MemberReadApiTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/controller/MemberReadApiTest.java @@ -1,8 +1,8 @@ package co.kirikiri.controller; +import co.kirikiri.common.dto.ErrorResponse; import co.kirikiri.controller.helper.ControllerTestHelper; import co.kirikiri.domain.member.Gender; -import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.member.response.MemberInformationForPublicResponse; import co.kirikiri.service.dto.member.response.MemberInformationResponse; import co.kirikiri.service.exception.NotFoundException; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/infra/AmazonS3FileServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/infra/AmazonS3FileServiceTest.java index 4dc9e4afe..6e66df1a5 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/infra/AmazonS3FileServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/infra/AmazonS3FileServiceTest.java @@ -1,6 +1,6 @@ package co.kirikiri.infra; -import co.kirikiri.service.dto.FileInformation; +import co.kirikiri.common.dto.FileInformation; import co.kirikiri.service.exception.ServerException; import com.amazonaws.AmazonServiceException; import com.amazonaws.Protocol; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/AuthenticationIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/AuthenticationIntegrationTest.java index a5fdffdb9..8d6cf681c 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/AuthenticationIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/AuthenticationIntegrationTest.java @@ -1,7 +1,7 @@ package co.kirikiri.integration; +import co.kirikiri.common.dto.ErrorResponse; import co.kirikiri.integration.helper.InitIntegrationTest; -import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.auth.request.LoginRequest; import co.kirikiri.service.dto.auth.request.ReissueTokenRequest; import co.kirikiri.service.dto.auth.response.AuthenticationResponse; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomCreateIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomCreateIntegrationTest.java index 1c07a4cc0..4387f3067 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomCreateIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomCreateIntegrationTest.java @@ -1,9 +1,9 @@ package co.kirikiri.integration; +import co.kirikiri.common.dto.ErrorResponse; import co.kirikiri.integration.helper.InitIntegrationTest; import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; -import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.auth.request.LoginRequest; import co.kirikiri.service.dto.goalroom.GoalRoomFilterTypeDto; import co.kirikiri.service.dto.goalroom.request.CheckFeedRequest; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomReadIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomReadIntegrationTest.java index e3a8b93ef..95d63d8cf 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomReadIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/GoalRoomReadIntegrationTest.java @@ -1,5 +1,6 @@ package co.kirikiri.integration; +import co.kirikiri.common.dto.ErrorResponse; import co.kirikiri.integration.helper.InitIntegrationTest; import co.kirikiri.persistence.goalroom.dto.RoadmapGoalRoomsOrderType; import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; @@ -7,7 +8,6 @@ import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; import co.kirikiri.roadmap.service.dto.response.RoadmapGoalRoomResponses; import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; -import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.auth.request.LoginRequest; import co.kirikiri.service.dto.goalroom.GoalRoomMemberSortTypeDto; import co.kirikiri.service.dto.goalroom.request.CheckFeedRequest; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/MemberCreateIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/MemberCreateIntegrationTest.java index 6af575a26..e4ea38128 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/MemberCreateIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/MemberCreateIntegrationTest.java @@ -1,7 +1,7 @@ package co.kirikiri.integration; +import co.kirikiri.common.dto.ErrorResponse; import co.kirikiri.integration.helper.InitIntegrationTest; -import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.member.request.GenderType; import co.kirikiri.service.dto.member.request.MemberJoinRequest; import io.restassured.common.mapper.TypeRef; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/MemberReadIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/MemberReadIntegrationTest.java index bc277f3c3..1326f3f48 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/MemberReadIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/MemberReadIntegrationTest.java @@ -1,8 +1,8 @@ package co.kirikiri.integration; +import co.kirikiri.common.dto.ErrorResponse; import co.kirikiri.domain.member.Gender; import co.kirikiri.integration.helper.InitIntegrationTest; -import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.member.request.MemberJoinRequest; import co.kirikiri.service.dto.member.response.MemberInformationForPublicResponse; import co.kirikiri.service.dto.member.response.MemberInformationResponse; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapCreateIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapCreateIntegrationTest.java index 8c24b1713..b21da690a 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapCreateIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapCreateIntegrationTest.java @@ -1,12 +1,12 @@ package co.kirikiri.integration; +import co.kirikiri.common.dto.ErrorResponse; import co.kirikiri.integration.helper.InitIntegrationTest; import co.kirikiri.roadmap.service.dto.request.RoadmapCategorySaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapDifficultyType; import co.kirikiri.roadmap.service.dto.request.RoadmapNodeSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapTagSaveRequest; -import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.auth.request.LoginRequest; import co.kirikiri.service.dto.member.request.GenderType; import co.kirikiri.service.dto.member.request.MemberJoinRequest; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadIntegrationTest.java index 134238c3e..304780e49 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReadIntegrationTest.java @@ -1,5 +1,6 @@ package co.kirikiri.integration; +import co.kirikiri.common.dto.ErrorResponse; import co.kirikiri.integration.helper.InitIntegrationTest; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; @@ -12,7 +13,6 @@ import co.kirikiri.roadmap.service.dto.response.RoadmapForListResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapForListResponses; import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; -import co.kirikiri.service.dto.ErrorResponse; import io.restassured.common.mapper.TypeRef; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewCreateIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewCreateIntegrationTest.java index 7c23fdb59..a6717f382 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewCreateIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewCreateIntegrationTest.java @@ -1,10 +1,10 @@ package co.kirikiri.integration; +import co.kirikiri.common.dto.ErrorResponse; import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.integration.helper.InitIntegrationTest; import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; -import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.auth.request.LoginRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomCreateRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomRoadmapNodeRequest; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewReadIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewReadIntegrationTest.java index 416c11bff..fb57bcfca 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewReadIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewReadIntegrationTest.java @@ -1,12 +1,12 @@ package co.kirikiri.integration; +import co.kirikiri.common.dto.CustomScrollRequest; +import co.kirikiri.common.dto.ErrorResponse; import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.integration.helper.InitIntegrationTest; import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; -import co.kirikiri.service.dto.CustomScrollRequest; -import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.auth.request.LoginRequest; import co.kirikiri.service.dto.member.request.GenderType; import co.kirikiri.service.dto.member.request.MemberJoinRequest; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java index 319f7057e..b4e886f30 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/fixture/RoadmapAPIFixture.java @@ -1,5 +1,6 @@ package co.kirikiri.integration.fixture; +import co.kirikiri.common.dto.CustomScrollRequest; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; import co.kirikiri.roadmap.service.dto.request.RoadmapCategorySaveRequest; @@ -7,7 +8,6 @@ import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; -import co.kirikiri.service.dto.CustomScrollRequest; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import io.restassured.response.ExtractableResponse; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestFileService.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestFileService.java index 7ed04c3b3..cbb352601 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestFileService.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/helper/TestFileService.java @@ -1,7 +1,7 @@ package co.kirikiri.integration.helper; +import co.kirikiri.common.dto.FileInformation; import co.kirikiri.service.FileService; -import co.kirikiri.service.dto.FileInformation; import org.springframework.http.HttpMethod; import java.net.MalformedURLException; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/controller/RoadmapCreateApiTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/controller/RoadmapCreateApiTest.java index 8c40d51f4..fd1029a59 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/controller/RoadmapCreateApiTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/controller/RoadmapCreateApiTest.java @@ -1,5 +1,6 @@ package co.kirikiri.roadmap.controller; +import co.kirikiri.common.dto.ErrorResponse; import co.kirikiri.controller.helper.ControllerTestHelper; import co.kirikiri.roadmap.service.RoadmapCreateService; import co.kirikiri.roadmap.service.RoadmapReadService; @@ -9,7 +10,6 @@ import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapTagSaveRequest; -import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.exception.AuthenticationException; import co.kirikiri.service.exception.BadRequestException; import co.kirikiri.service.exception.ConflictException; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/controller/RoadmapReadApiTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/controller/RoadmapReadApiTest.java index 3aa4c2b14..a04ec5949 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/controller/RoadmapReadApiTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/controller/RoadmapReadApiTest.java @@ -1,5 +1,7 @@ package co.kirikiri.roadmap.controller; +import co.kirikiri.common.dto.CustomScrollRequest; +import co.kirikiri.common.dto.ErrorResponse; import co.kirikiri.controller.helper.ControllerTestHelper; import co.kirikiri.domain.goalroom.GoalRoomStatus; import co.kirikiri.roadmap.domain.RoadmapDifficulty; @@ -18,8 +20,6 @@ import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapTagResponse; -import co.kirikiri.service.dto.CustomScrollRequest; -import co.kirikiri.service.dto.ErrorResponse; import co.kirikiri.service.dto.member.response.MemberResponse; import co.kirikiri.service.exception.NotFoundException; import com.fasterxml.jackson.core.type.TypeReference; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTagNameTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTagNameTest.java similarity index 93% rename from backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTagNameTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTagNameTest.java index 8a1df63d2..e968fe658 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTagNameTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTagNameTest.java @@ -1,7 +1,6 @@ -package co.kirikiri.persistence.dto; +package co.kirikiri.roadmap.persistence.dto; import co.kirikiri.roadmap.domain.exception.RoadmapException; -import co.kirikiri.roadmap.persistence.dto.RoadmapSearchTagName; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.ValueSource; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTitleTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTitleTest.java similarity index 93% rename from backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTitleTest.java rename to backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTitleTest.java index c951e1fc0..f36a826b9 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/dto/RoadmapSearchTitleTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/dto/RoadmapSearchTitleTest.java @@ -1,7 +1,6 @@ -package co.kirikiri.persistence.dto; +package co.kirikiri.roadmap.persistence.dto; import co.kirikiri.roadmap.domain.exception.RoadmapException; -import co.kirikiri.roadmap.persistence.dto.RoadmapSearchTitle; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.ValueSource; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java index 156b8e384..30f18f240 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java @@ -1,5 +1,6 @@ package co.kirikiri.roadmap.service; +import co.kirikiri.common.dto.FileInformation; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; @@ -14,7 +15,6 @@ import co.kirikiri.roadmap.service.event.RoadmapCreateEvent; import co.kirikiri.service.FilePathGenerator; import co.kirikiri.service.FileService; -import co.kirikiri.service.dto.FileInformation; import co.kirikiri.service.exception.BadRequestException; import co.kirikiri.service.exception.ServerException; import org.junit.jupiter.api.Test; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java index bfa129c64..fdaa6716d 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java @@ -1,5 +1,6 @@ package co.kirikiri.roadmap.service; +import co.kirikiri.common.dto.CustomScrollRequest; import co.kirikiri.domain.ImageContentType; import co.kirikiri.domain.goalroom.GoalRoomStatus; import co.kirikiri.domain.member.EncryptedPassword; @@ -42,7 +43,6 @@ import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapTagResponse; import co.kirikiri.service.FileService; -import co.kirikiri.service.dto.CustomScrollRequest; import co.kirikiri.service.dto.member.response.MemberResponse; import co.kirikiri.service.exception.NotFoundException; import org.junit.jupiter.api.Test; From df672b04699321522ce53f87d169307b37b50b1a Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Sat, 13 Jan 2024 23:09:49 +0900 Subject: [PATCH 13/22] =?UTF-8?q?refactor:=20dto=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../roadmap/persistence/RoadmapQueryRepository.java | 3 +-- .../roadmap/persistence/RoadmapQueryRepositoryImpl.java | 5 ++--- .../co/kirikiri/roadmap/service/RoadmapReadService.java | 4 ++-- .../java/co/kirikiri/roadmap/service/dto/MemberDto.java | 9 +++++++++ .../java/co/kirikiri/roadmap/service/dto/RoadmapDto.java | 2 -- .../kirikiri/roadmap/service/dto/RoadmapForListDto.java | 2 -- .../roadmap/service/dto/RoadmapReviewReadDto.java | 2 -- .../roadmap/service/dto/response/MemberResponse.java | 8 ++++++++ .../service/dto/response/RoadmapForListResponse.java | 2 -- .../service/dto/response/RoadmapGoalRoomResponse.java | 5 +---- .../roadmap/service/dto/response/RoadmapResponse.java | 2 -- .../service/dto/response/RoadmapReviewResponse.java | 2 -- .../kirikiri/roadmap/service/mapper/RoadmapMapper.java | 4 ++-- .../java/co/kirikiri/service/mapper/GoalRoomMapper.java | 6 +++--- .../integration/RoadmapReviewReadIntegrationTest.java | 2 +- .../kirikiri/roadmap/controller/RoadmapReadApiTest.java | 8 ++++---- .../roadmap/persistence/RoadmapRepositoryTest.java | 4 ++-- .../kirikiri/roadmap/service/RoadmapReadServiceTest.java | 8 ++++---- 18 files changed, 39 insertions(+), 39 deletions(-) create mode 100644 backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/MemberDto.java create mode 100644 backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/MemberResponse.java diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepository.java index b81b33520..0deace654 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepository.java @@ -1,6 +1,5 @@ package co.kirikiri.roadmap.persistence; -import co.kirikiri.domain.member.Member; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapStatus; @@ -24,7 +23,7 @@ List findRoadmapsByCond(final RoadmapSearchDto searchRequest, final Long lastId, final int pageSize); - List findRoadmapsWithCategoryByMemberIdOrderByLatest(final Member member, + List findRoadmapsWithCategoryByMemberIdOrderByLatest(final Long memberId, final Long lastId, final int pageSize); diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepositoryImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepositoryImpl.java index ac3b03b6f..1f0ff75d5 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepositoryImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepositoryImpl.java @@ -1,6 +1,5 @@ package co.kirikiri.roadmap.persistence; -import co.kirikiri.domain.member.Member; import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.persistence.QuerydslRepositorySupporter; import co.kirikiri.roadmap.domain.Roadmap; @@ -83,7 +82,7 @@ public List findRoadmapsByCond(final RoadmapSearchDto searchRequest, fi } @Override - public List findRoadmapsWithCategoryByMemberIdOrderByLatest(final Member member, + public List findRoadmapsWithCategoryByMemberIdOrderByLatest(final Long memberId, final Long lastId, final int pageSize) { final RoadmapOrderType orderType = RoadmapOrderType.LATEST; @@ -91,7 +90,7 @@ public List findRoadmapsWithCategoryByMemberIdOrderByLatest(final Membe .innerJoin(roadmap.category, roadmapCategory) .fetchJoin() .where( - creatorIdCond(member.getId()), + creatorIdCond(memberId), lessThanLastId(lastId, orderType)) .limit(pageSize + LIMIT_OFFSET) .orderBy(sortCond(orderType)) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java index bedaa2d36..63b58c17e 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java @@ -18,6 +18,7 @@ import co.kirikiri.roadmap.persistence.RoadmapReviewRepository; import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; import co.kirikiri.roadmap.persistence.dto.RoadmapSearchDto; +import co.kirikiri.roadmap.service.dto.MemberDto; import co.kirikiri.roadmap.service.dto.RoadmapCategoryDto; import co.kirikiri.roadmap.service.dto.RoadmapContentDto; import co.kirikiri.roadmap.service.dto.RoadmapDto; @@ -39,7 +40,6 @@ import co.kirikiri.roadmap.service.mapper.RoadmapMapper; import co.kirikiri.service.FileService; import co.kirikiri.service.aop.ExceptionConvert; -import co.kirikiri.service.dto.member.MemberDto; import co.kirikiri.service.exception.NotFoundException; import lombok.RequiredArgsConstructor; import org.springframework.cache.annotation.Cacheable; @@ -211,7 +211,7 @@ public List findAllRoadmapCategories() { public MemberRoadmapResponses findAllMemberRoadmaps(final String identifier, final CustomScrollRequest scrollRequest) { final Member member = findMemberByIdentifier(identifier); - final List roadmaps = roadmapRepository.findRoadmapsWithCategoryByMemberIdOrderByLatest(member, + final List roadmaps = roadmapRepository.findRoadmapsWithCategoryByMemberIdOrderByLatest(member.getId(), scrollRequest.lastId(), scrollRequest.size()); return RoadmapMapper.convertMemberRoadmapResponses(roadmaps, scrollRequest.size()); } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/MemberDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/MemberDto.java new file mode 100644 index 000000000..4298c6858 --- /dev/null +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/MemberDto.java @@ -0,0 +1,9 @@ +package co.kirikiri.roadmap.service.dto; + +public record MemberDto( + long id, + String name, + String imageUrl +) { + +} diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapDto.java index c77919dbc..07c698c5c 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapDto.java @@ -1,7 +1,5 @@ package co.kirikiri.roadmap.service.dto; -import co.kirikiri.service.dto.member.MemberDto; - import java.time.LocalDateTime; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapForListDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapForListDto.java index 335379d3a..8a97c7d28 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapForListDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapForListDto.java @@ -1,7 +1,5 @@ package co.kirikiri.roadmap.service.dto; -import co.kirikiri.service.dto.member.MemberDto; - import java.time.LocalDateTime; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapReviewReadDto.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapReviewReadDto.java index 439c48ef0..d56170494 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapReviewReadDto.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/RoadmapReviewReadDto.java @@ -1,7 +1,5 @@ package co.kirikiri.roadmap.service.dto; -import co.kirikiri.service.dto.member.MemberDto; - import java.time.LocalDateTime; public record RoadmapReviewReadDto( diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/MemberResponse.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/MemberResponse.java new file mode 100644 index 000000000..57e58e776 --- /dev/null +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/MemberResponse.java @@ -0,0 +1,8 @@ +package co.kirikiri.roadmap.service.dto.response; + +public record MemberResponse( + long id, + String name, + String imageUrl +) { +} diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapForListResponse.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapForListResponse.java index 2b6749224..4f116a7e4 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapForListResponse.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapForListResponse.java @@ -1,7 +1,5 @@ package co.kirikiri.roadmap.service.dto.response; -import co.kirikiri.service.dto.member.response.MemberResponse; - import java.time.LocalDateTime; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapGoalRoomResponse.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapGoalRoomResponse.java index 1d4dbb3cc..4579ce5f4 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapGoalRoomResponse.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapGoalRoomResponse.java @@ -1,15 +1,12 @@ package co.kirikiri.roadmap.service.dto.response; -import co.kirikiri.domain.goalroom.GoalRoomStatus; -import co.kirikiri.service.dto.member.response.MemberResponse; - import java.time.LocalDate; import java.time.LocalDateTime; public record RoadmapGoalRoomResponse( Long goalRoomId, String name, - GoalRoomStatus status, + String goalRoomStatus, Integer currentMemberCount, Integer limitedMemberCount, LocalDateTime createdAt, diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapResponse.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapResponse.java index 90dd6a001..afeaf5374 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapResponse.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapResponse.java @@ -1,7 +1,5 @@ package co.kirikiri.roadmap.service.dto.response; -import co.kirikiri.service.dto.member.response.MemberResponse; - import java.time.LocalDateTime; import java.util.List; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapReviewResponse.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapReviewResponse.java index 331ef38d8..e1de0e59b 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapReviewResponse.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/dto/response/RoadmapReviewResponse.java @@ -1,7 +1,5 @@ package co.kirikiri.roadmap.service.dto.response; -import co.kirikiri.service.dto.member.response.MemberResponse; - import java.time.LocalDateTime; public record RoadmapReviewResponse( diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java index fa86a89b2..be76f6f4e 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/mapper/RoadmapMapper.java @@ -5,6 +5,7 @@ import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; +import co.kirikiri.roadmap.service.dto.MemberDto; import co.kirikiri.roadmap.service.dto.RoadmapCategoryDto; import co.kirikiri.roadmap.service.dto.RoadmapContentDto; import co.kirikiri.roadmap.service.dto.RoadmapDto; @@ -24,6 +25,7 @@ import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapTagSaveRequest; +import co.kirikiri.roadmap.service.dto.response.MemberResponse; import co.kirikiri.roadmap.service.dto.response.MemberRoadmapResponse; import co.kirikiri.roadmap.service.dto.response.MemberRoadmapResponses; import co.kirikiri.roadmap.service.dto.response.RoadmapCategoryResponse; @@ -34,8 +36,6 @@ import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapTagResponse; -import co.kirikiri.service.dto.member.MemberDto; -import co.kirikiri.service.dto.member.response.MemberResponse; import co.kirikiri.service.exception.ServerException; import lombok.AccessLevel; import lombok.NoArgsConstructor; diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/GoalRoomMapper.java b/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/GoalRoomMapper.java index f5fcb9de1..97bf20e9a 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/GoalRoomMapper.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/mapper/GoalRoomMapper.java @@ -153,14 +153,14 @@ public static RoadmapGoalRoomResponses convertToRoadmapGoalRoomResponses( private static RoadmapGoalRoomResponse convertToRoadmapGoalRoomResponse( final RoadmapGoalRoomDto roadmapGoalRoomDto) { return new RoadmapGoalRoomResponse(roadmapGoalRoomDto.goalRoomId(), roadmapGoalRoomDto.name(), - roadmapGoalRoomDto.status(), roadmapGoalRoomDto.currentMemberCount(), + roadmapGoalRoomDto.status().name(), roadmapGoalRoomDto.currentMemberCount(), roadmapGoalRoomDto.limitedMemberCount(), roadmapGoalRoomDto.createdAt(), roadmapGoalRoomDto.startDate(), roadmapGoalRoomDto.endDate(), convertToMemberResponse(roadmapGoalRoomDto.goalRoomLeader())); } - private static MemberResponse convertToMemberResponse(final MemberDto memberDto) { - return new MemberResponse(memberDto.id(), memberDto.name(), memberDto.imageUrl()); + private static co.kirikiri.roadmap.service.dto.response.MemberResponse convertToMemberResponse(final MemberDto memberDto) { + return new co.kirikiri.roadmap.service.dto.response.MemberResponse(memberDto.id(), memberDto.name(), memberDto.imageUrl()); } public static GoalRoomMemberSortType convertGoalRoomMemberSortType(final GoalRoomMemberSortTypeDto sortType) { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewReadIntegrationTest.java b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewReadIntegrationTest.java index fb57bcfca..f90ebc794 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewReadIntegrationTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/integration/RoadmapReviewReadIntegrationTest.java @@ -5,13 +5,13 @@ import co.kirikiri.domain.goalroom.GoalRoom; import co.kirikiri.integration.helper.InitIntegrationTest; import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; +import co.kirikiri.roadmap.service.dto.response.MemberResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; import co.kirikiri.service.dto.auth.request.LoginRequest; import co.kirikiri.service.dto.member.request.GenderType; import co.kirikiri.service.dto.member.request.MemberJoinRequest; import co.kirikiri.service.dto.member.response.MemberInformationResponse; -import co.kirikiri.service.dto.member.response.MemberResponse; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import io.restassured.common.mapper.TypeRef; diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/controller/RoadmapReadApiTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/controller/RoadmapReadApiTest.java index a04ec5949..088cba8ed 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/controller/RoadmapReadApiTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/controller/RoadmapReadApiTest.java @@ -8,6 +8,7 @@ import co.kirikiri.roadmap.service.RoadmapCreateService; import co.kirikiri.roadmap.service.RoadmapReadService; import co.kirikiri.roadmap.service.dto.request.RoadmapOrderTypeRequest; +import co.kirikiri.roadmap.service.dto.response.MemberResponse; import co.kirikiri.roadmap.service.dto.response.MemberRoadmapResponse; import co.kirikiri.roadmap.service.dto.response.MemberRoadmapResponses; import co.kirikiri.roadmap.service.dto.response.RoadmapCategoryResponse; @@ -20,7 +21,6 @@ import co.kirikiri.roadmap.service.dto.response.RoadmapResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapTagResponse; -import co.kirikiri.service.dto.member.response.MemberResponse; import co.kirikiri.service.exception.NotFoundException; import com.fasterxml.jackson.core.type.TypeReference; import org.junit.jupiter.api.Test; @@ -471,7 +471,7 @@ class RoadmapReadApiTest extends ControllerTestHelper { responseFields( fieldWithPath("responses[0].goalRoomId").description("골룸 아이디"), fieldWithPath("responses[0].name").description("골룸 이름"), - fieldWithPath("responses[0].status").description("골룸 상태"), + fieldWithPath("responses[0].goalRoomStatus").description("골룸 상태"), fieldWithPath("responses[0].currentMemberCount").description("현재 골룸에 참여한 인원 수"), fieldWithPath("responses[0].limitedMemberCount").description( "골룸에 참여할 수 있는 제한 인원 수"), @@ -688,12 +688,12 @@ class RoadmapReadApiTest extends ControllerTestHelper { private RoadmapGoalRoomResponses 골룸_응답들을_생성한다() { final RoadmapGoalRoomResponse roadmapGoalRoomResponse1 = new RoadmapGoalRoomResponse(1L, "골룸 이름1", - GoalRoomStatus.RECRUITING, 3, 6, + GoalRoomStatus.RECRUITING.name(), 3, 6, LocalDateTime.of(2023, 7, 20, 13, 0, 0), LocalDate.now(), LocalDate.now().plusDays(100), new MemberResponse(1L, "황시진", "default-member-image")); final RoadmapGoalRoomResponse roadmapGoalRoomResponse2 = new RoadmapGoalRoomResponse(2L, "골룸 이름2", - GoalRoomStatus.RECRUITING, 4, 10, + GoalRoomStatus.RECRUITING.name(), 4, 10, LocalDateTime.of(2023, 7, 10, 13, 0, 0), LocalDate.now(), LocalDate.now().plusDays(100), new MemberResponse(2L, "시진이", "default-member-image")); diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapRepositoryTest.java index 2129accf6..0d25f7650 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapRepositoryTest.java @@ -463,10 +463,10 @@ public RoadmapRepositoryTest(final MemberRepository memberRepository, roadmapRepository.saveAll(List.of(gameRoadmap, travelRoadmap, deletedGameRoadmap)); // when - final List roadmapsFirstPage = roadmapRepository.findRoadmapsWithCategoryByMemberIdOrderByLatest(creator, + final List roadmapsFirstPage = roadmapRepository.findRoadmapsWithCategoryByMemberIdOrderByLatest(creator.getId(), null, 2); final List roadmapsSecondPage = roadmapRepository.findRoadmapsWithCategoryByMemberIdOrderByLatest( - creator, roadmapsFirstPage.get(1).getId(), 2); + creator.getId(), roadmapsFirstPage.get(1).getId(), 2); // then assertAll( diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java index fdaa6716d..1b151418d 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java @@ -30,6 +30,7 @@ import co.kirikiri.roadmap.service.dto.RoadmapGoalRoomsOrderTypeDto; import co.kirikiri.roadmap.service.dto.request.RoadmapOrderTypeRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapSearchRequest; +import co.kirikiri.roadmap.service.dto.response.MemberResponse; import co.kirikiri.roadmap.service.dto.response.MemberRoadmapResponse; import co.kirikiri.roadmap.service.dto.response.MemberRoadmapResponses; import co.kirikiri.roadmap.service.dto.response.RoadmapCategoryResponse; @@ -43,7 +44,6 @@ import co.kirikiri.roadmap.service.dto.response.RoadmapReviewResponse; import co.kirikiri.roadmap.service.dto.response.RoadmapTagResponse; import co.kirikiri.service.FileService; -import co.kirikiri.service.dto.member.response.MemberResponse; import co.kirikiri.service.exception.NotFoundException; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -424,7 +424,7 @@ roadmapId, new RoadmapCategoryResponse(1L, "운동"), "로드맵 제목", "로 when(memberRepository.findByIdentifier(any())) .thenReturn(Optional.of(member)); - when(roadmapRepository.findRoadmapsWithCategoryByMemberIdOrderByLatest(any(), any(), anyInt())) + when(roadmapRepository.findRoadmapsWithCategoryByMemberIdOrderByLatest(anyLong(), any(), anyInt())) .thenReturn(List.of(roadmap2, roadmap1)); // when @@ -476,12 +476,12 @@ roadmapId, new RoadmapCategoryResponse(1L, "운동"), "로드맵 제목", "로 .willReturn(Optional.of(roadmap)); final RoadmapGoalRoomResponses expected = new RoadmapGoalRoomResponses(List.of( - new RoadmapGoalRoomResponse(2L, "goalroom2", GoalRoomStatus.RECRUITING, 1, 10, + new RoadmapGoalRoomResponse(2L, "goalroom2", GoalRoomStatus.RECRUITING.name(), 1, 10, LocalDateTime.now(), TODAY, TODAY.plusDays(20), new MemberResponse(member3.getId(), member3.getNickname().getValue(), "http://example.com/serverFilePath")), - new RoadmapGoalRoomResponse(1L, "goalroom1", GoalRoomStatus.RECRUITING, 1, 10, + new RoadmapGoalRoomResponse(1L, "goalroom1", GoalRoomStatus.RECRUITING.name(), 1, 10, LocalDateTime.now(), TODAY, TODAY.plusDays(20), new MemberResponse(member2.getId(), member2.getNickname().getValue(), From 7a1b1f3b1b3d3b0ce0475b71e6b0c36ed92247c2 Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Sun, 14 Jan 2024 10:54:44 +0900 Subject: [PATCH 14/22] =?UTF-8?q?refactor:=20Event=20=EA=B0=9D=EC=B2=B4?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EB=8F=84=EB=A9=94=EC=9D=B8=20=EC=A7=81?= =?UTF-8?q?=EC=A0=91=20=EC=A0=84=EB=8B=AC=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../persistence/RoadmapContentRepository.java | 2 + .../service/RoadmapCreateEventListener.java | 11 +++-- .../roadmap/service/RoadmapCreateService.java | 3 +- .../service/event/RoadmapCreateEvent.java | 3 +- .../RoadmapContentRepositoryTest.java | 21 +++++++++ .../RoadmapCreateEventListenerTest.java | 47 ++++++++++++------- 6 files changed, 62 insertions(+), 25 deletions(-) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapContentRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapContentRepository.java index cdc7c8f7e..ef3639a75 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapContentRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapContentRepository.java @@ -10,6 +10,8 @@ public interface RoadmapContentRepository extends JpaRepository { + Optional findFirstByRoadmapIdOrderByCreatedAtDesc(final Long roadmapId); + Optional findFirstByRoadmapOrderByCreatedAtDesc(final Roadmap roadmap); @Query("select rc from RoadmapContent rc " diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateEventListener.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateEventListener.java index 34fb91528..87c28a9c6 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateEventListener.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateEventListener.java @@ -2,7 +2,6 @@ import co.kirikiri.common.dto.FileInformation; import co.kirikiri.domain.ImageContentType; -import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapContent; import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodeImage; @@ -17,6 +16,7 @@ import co.kirikiri.service.exception.BadRequestException; import co.kirikiri.service.exception.ServerException; import lombok.RequiredArgsConstructor; +import org.springframework.cache.annotation.CacheEvict; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -36,12 +36,13 @@ public class RoadmapCreateEventListener { @Async @TransactionalEventListener @Transactional + @CacheEvict(value = "roadmapList", allEntries = true) public void handleRoadmapCreate(final RoadmapCreateEvent roadmapCreateEvent) { saveRoadmapNodeImage(roadmapCreateEvent); } private void saveRoadmapNodeImage(final RoadmapCreateEvent roadmapCreateEvent) { - final RoadmapContent lastRoadmapContent = findLastRoadmapContent(roadmapCreateEvent.roadmap()); + final RoadmapContent lastRoadmapContent = findLastRoadmapContent(roadmapCreateEvent.roadmapId()); for (final RoadmapNodeSaveDto roadmapNodeSaveDto : roadmapCreateEvent.roadmapSaveDto().roadmapNodes()) { final RoadmapNode roadmapNode = findRoadmapNodeByTitle(lastRoadmapContent, roadmapNodeSaveDto); final RoadmapNodeImages roadmapNodeImages = makeRoadmapNodeImages(roadmapNodeSaveDto, roadmapNode); @@ -50,8 +51,8 @@ private void saveRoadmapNodeImage(final RoadmapCreateEvent roadmapCreateEvent) { roadmapContentRepository.save(lastRoadmapContent); } - private RoadmapContent findLastRoadmapContent(final Roadmap roadmap) { - return roadmap.findLastRoadmapContent() + private RoadmapContent findLastRoadmapContent(final Long roadmapId) { + return roadmapContentRepository.findFirstByRoadmapIdOrderByCreatedAtDesc(roadmapId) .orElseThrow(() -> new ServerException("로드맵 컨텐츠가 존재하지 않습니다.")); } @@ -59,7 +60,7 @@ private RoadmapNode findRoadmapNodeByTitle(final RoadmapContent lastRoadmapConte final RoadmapNodeSaveDto roadmapNodeSaveDto) { return lastRoadmapContent.findRoadmapNodeByTitle(roadmapNodeSaveDto.title()) .orElseThrow(() -> new BadRequestException( - "해당 제목을 가지고있는 로드맵 노드가 없습니다. title = " + roadmapNodeSaveDto.title())); + "해당 제목을 가지고 있는 로드맵 노드가 없습니다. title = " + roadmapNodeSaveDto.title())); } private RoadmapNodeImages makeRoadmapNodeImages(final RoadmapNodeSaveDto roadmapNodeSaveDto, diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java index 3586c164e..e7c19056f 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java @@ -52,7 +52,6 @@ public class RoadmapCreateService { private final RoadmapGoalRoomService roadmapGoalRoomService; private final ApplicationEventPublisher applicationEventPublisher; - @CacheEvict(value = "roadmapList", allEntries = true) public Long create(final RoadmapSaveRequest request, final String identifier) { final Member member = findMemberByIdentifier(identifier); final RoadmapCategory roadmapCategory = findRoadmapCategoryById(request.categoryId()); @@ -60,7 +59,7 @@ public Long create(final RoadmapSaveRequest request, final String identifier) { final Roadmap roadmap = createRoadmap(member.getId(), roadmapSaveDto, roadmapCategory); final Roadmap savedRoadmap = roadmapRepository.save(roadmap); - applicationEventPublisher.publishEvent(new RoadmapCreateEvent(savedRoadmap, roadmapSaveDto)); + applicationEventPublisher.publishEvent(new RoadmapCreateEvent(savedRoadmap.getId(), roadmapSaveDto)); return savedRoadmap.getId(); } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/event/RoadmapCreateEvent.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/event/RoadmapCreateEvent.java index cc6f142e8..f107fc599 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/event/RoadmapCreateEvent.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/event/RoadmapCreateEvent.java @@ -1,10 +1,9 @@ package co.kirikiri.roadmap.service.event; -import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.service.dto.RoadmapSaveDto; public record RoadmapCreateEvent( - Roadmap roadmap, + Long roadmapId, RoadmapSaveDto roadmapSaveDto ) { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapContentRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapContentRepositoryTest.java index caace7105..637dad432 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapContentRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapContentRepositoryTest.java @@ -53,6 +53,27 @@ public RoadmapContentRepositoryTest(final MemberRepository memberRepository, ); } + @Test + void 로드맵_아이디로_로드맵의_가장_최근_컨텐츠를_조회한다() { + // given + final Roadmap savedRoadmap = roadmapRepository.save(로드맵을_생성한다()); + final RoadmapContent oldRoadmapContent = roadmapContentRepository.findFirstByRoadmapIdOrderByCreatedAtDesc( + savedRoadmap.getId()).get(); + + final RoadmapContent newRoadmapContent = new RoadmapContent("로드맵 제목"); + savedRoadmap.addContent(newRoadmapContent); + + // when + final RoadmapContent expectedRoadmapContent = roadmapContentRepository.findFirstByRoadmapIdOrderByCreatedAtDesc( + savedRoadmap.getId()).get(); + + // then + assertAll( + () -> assertThat(oldRoadmapContent).isNotEqualTo(expectedRoadmapContent), + () -> assertThat(expectedRoadmapContent).isEqualTo(newRoadmapContent) + ); + } + @Test void 로드맵의_가장_최근_컨텐츠를_조회한다() { // given diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java index 30f18f240..5ed602a27 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java @@ -27,10 +27,11 @@ import java.io.IOException; import java.util.List; +import java.util.Optional; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) class RoadmapCreateEventListenerTest { @@ -55,7 +56,7 @@ class RoadmapCreateEventListenerTest { final RoadmapNode roadmapNode = new RoadmapNode("roadmapNodeTitle", "roadmapNodeContent"); roadmapContent.addNodes(new RoadmapNodes(List.of(roadmapNode))); - final Roadmap roadmap = new Roadmap("roadmapTitle", "inroduction", 10, + final Roadmap roadmap = new Roadmap(1L, "roadmapTitle", "introduction", 10, RoadmapDifficulty.DIFFICULT, memberId, new RoadmapCategory("category")); final MultipartFile imageFile = new MockMultipartFile(roadmapNode.getTitle(), @@ -70,9 +71,11 @@ class RoadmapCreateEventListenerTest { roadmap.addContent(roadmapContent); - final RoadmapCreateEvent roadmapCreateEvent = new RoadmapCreateEvent(roadmap, roadmapSaveDto); + final RoadmapCreateEvent roadmapCreateEvent = new RoadmapCreateEvent(roadmap.getId(), roadmapSaveDto); // When + when(roadmapContentRepository.findFirstByRoadmapIdOrderByCreatedAtDesc(anyLong())) + .thenReturn(Optional.of(roadmapContent)); roadmapCreateEventListener.handleRoadmapCreate(roadmapCreateEvent); // Then @@ -82,7 +85,7 @@ class RoadmapCreateEventListenerTest { @Test void 로드맵에_컨텐츠가_존재하지_않을_경우_예외를_던진다() throws IOException { //given - final Roadmap roadmap = new Roadmap("roadmapTitle", "inroduction", 10, + final Roadmap roadmap = new Roadmap(1L, "roadmapTitle", "inroduction", 10, RoadmapDifficulty.DIFFICULT, memberId, new RoadmapCategory("category")); final MultipartFile imageFile = new MockMultipartFile("roadmapNodeTitle", @@ -95,12 +98,16 @@ class RoadmapCreateEventListenerTest { "roadmapNodeContent", RoadmapDifficultyType.DIFFICULT, 10, List.of(roadmapNodeSaveDto), List.of(new RoadmapTagSaveDto("tag"))); - final RoadmapCreateEvent roadmapCreateEvent = new RoadmapCreateEvent(roadmap, roadmapSaveDto); + final RoadmapCreateEvent roadmapCreateEvent = new RoadmapCreateEvent(roadmap.getId(), roadmapSaveDto); //when + when(roadmapContentRepository.findFirstByRoadmapIdOrderByCreatedAtDesc(anyLong())) + .thenReturn(Optional.empty()); + //then assertThatThrownBy(() -> roadmapCreateEventListener.handleRoadmapCreate(roadmapCreateEvent)) - .isInstanceOf(ServerException.class); + .isInstanceOf(ServerException.class) + .hasMessage("로드맵 컨텐츠가 존재하지 않습니다."); } @Test @@ -110,7 +117,7 @@ class RoadmapCreateEventListenerTest { final RoadmapNode roadmapNode = new RoadmapNode("roadmapNodeTitle", "roadmapNodeContent"); roadmapContent.addNodes(new RoadmapNodes(List.of(roadmapNode))); - final Roadmap roadmap = new Roadmap("roadmapTitle", "inroduction", 10, + final Roadmap roadmap = new Roadmap(1L, "roadmapTitle", "introduction", 10, RoadmapDifficulty.DIFFICULT, memberId, new RoadmapCategory("category")); final MultipartFile imageFile = new MockMultipartFile(roadmapNode.getTitle(), @@ -125,12 +132,16 @@ class RoadmapCreateEventListenerTest { roadmap.addContent(roadmapContent); - final RoadmapCreateEvent roadmapCreateEvent = new RoadmapCreateEvent(roadmap, roadmapSaveDto); + final RoadmapCreateEvent roadmapCreateEvent = new RoadmapCreateEvent(roadmap.getId(), roadmapSaveDto); //when + when(roadmapContentRepository.findFirstByRoadmapIdOrderByCreatedAtDesc(anyLong())) + .thenReturn(Optional.of(roadmapContent)); + //then assertThatThrownBy(() -> roadmapCreateEventListener.handleRoadmapCreate(roadmapCreateEvent)) - .isInstanceOf(BadRequestException.class); + .isInstanceOf(BadRequestException.class) + .hasMessage("해당 제목을 가지고 있는 로드맵 노드가 없습니다. title = Wrong Title"); } @Test @@ -140,14 +151,14 @@ class RoadmapCreateEventListenerTest { final RoadmapNode roadmapNode = new RoadmapNode("roadmapNodeTitle", "roadmapNodeContent"); roadmapContent.addNodes(new RoadmapNodes(List.of(roadmapNode))); - final Roadmap roadmap = new Roadmap("roadmapTitle", "inroduction", 10, + final Roadmap roadmap = new Roadmap(1L, "roadmapTitle", "inroduction", 10, RoadmapDifficulty.DIFFICULT, memberId, new RoadmapCategory("category")); final MultipartFile imageFile = new MockMultipartFile(roadmapNode.getTitle(), null, "image/jpeg", "tempImage".getBytes()); - final FileInformation fileInformation = new FileInformation(imageFile.getOriginalFilename(), - imageFile.getSize(), imageFile.getContentType(), imageFile.getInputStream()); - final RoadmapNodeSaveDto roadmapNodeSaveDto = new RoadmapNodeSaveDto("Wrong Title", roadmapNode.getContent(), + final FileInformation fileInformation = new FileInformation(null, imageFile.getSize(), + imageFile.getContentType(), imageFile.getInputStream()); + final RoadmapNodeSaveDto roadmapNodeSaveDto = new RoadmapNodeSaveDto("roadmapNodeTitle", roadmapNode.getContent(), List.of(fileInformation)); final RoadmapSaveDto roadmapSaveDto = new RoadmapSaveDto(1L, roadmap.getTitle(), roadmap.getIntroduction(), roadmapContent.getContent(), RoadmapDifficultyType.DIFFICULT, 10, List.of(roadmapNodeSaveDto), @@ -155,11 +166,15 @@ class RoadmapCreateEventListenerTest { roadmap.addContent(roadmapContent); - final RoadmapCreateEvent roadmapCreateEvent = new RoadmapCreateEvent(roadmap, roadmapSaveDto); + final RoadmapCreateEvent roadmapCreateEvent = new RoadmapCreateEvent(roadmap.getId(), roadmapSaveDto); //when + when(roadmapContentRepository.findFirstByRoadmapIdOrderByCreatedAtDesc(anyLong())) + .thenReturn(Optional.of(roadmapContent)); + //then assertThatThrownBy(() -> roadmapCreateEventListener.handleRoadmapCreate(roadmapCreateEvent)) - .isInstanceOf(BadRequestException.class); + .isInstanceOf(BadRequestException.class) + .hasMessage("원본 파일의 이름이 존재하지 않습니다."); } } From 3c5fc043f82fd0e7b71b22228c100832e2823a3d Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Sun, 14 Jan 2024 13:17:13 +0900 Subject: [PATCH 15/22] =?UTF-8?q?refactor:=20RoadmapNode=EC=97=90=EC=84=9C?= =?UTF-8?q?=20RoadmapContent=20=EC=9D=98=EC=A1=B4=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../roadmap/domain/RoadmapContent.java | 1 - .../kirikiri/roadmap/domain/RoadmapNode.java | 21 ----------- .../kirikiri/roadmap/domain/RoadmapNodes.java | 16 ++------- .../persistence/RoadmapNodeRepository.java | 12 ------- .../roadmap/domain/RoadmapContentTest.java | 13 ++++--- .../roadmap/domain/RoadmapNodesTest.java | 36 +++++++++---------- 6 files changed, 26 insertions(+), 73 deletions(-) delete mode 100644 backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapNodeRepository.java diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContent.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContent.java index dfa9db0d8..12da97e86 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContent.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContent.java @@ -56,7 +56,6 @@ private void validateContentLength(final String content) { public void addNodes(final RoadmapNodes nodes) { this.nodes.addAll(nodes); - nodes.updateAllRoadmapContent(this); } public boolean isNotSameRoadmap(final Roadmap roadmap) { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNode.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNode.java index 2a641d291..bc351bd93 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNode.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNode.java @@ -5,9 +5,6 @@ import jakarta.persistence.Column; import jakarta.persistence.Embedded; import jakarta.persistence.Entity; -import jakarta.persistence.FetchType; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; import lombok.AccessLevel; import lombok.NoArgsConstructor; @@ -26,10 +23,6 @@ public class RoadmapNode extends BaseEntity { @Column(length = 2200, nullable = false) private String content; - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "roadmap_content_id", nullable = false) - private RoadmapContent roadmapContent; - @Embedded private final RoadmapNodeImages roadmapNodeImages = new RoadmapNodeImages(); @@ -67,16 +60,6 @@ public void addImages(final RoadmapNodeImages roadmapNodeImages) { this.roadmapNodeImages.addAll(roadmapNodeImages); } - public boolean isNotSameRoadmapContent(final RoadmapContent roadmapContent) { - return this.roadmapContent == null || !this.roadmapContent.equals(roadmapContent); - } - - public void updateRoadmapContent(final RoadmapContent roadmapContent) { - if (this.roadmapContent == null) { - this.roadmapContent = roadmapContent; - } - } - public String getTitle() { return title; } @@ -85,10 +68,6 @@ public String getContent() { return content; } - public RoadmapContent getRoadmapContent() { - return roadmapContent; - } - public RoadmapNodeImages getRoadmapNodeImages() { return roadmapNodeImages; } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodes.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodes.java index ee8a0236e..5d1d81eb1 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodes.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapNodes.java @@ -4,6 +4,7 @@ import jakarta.persistence.CascadeType; import jakarta.persistence.Embeddable; import jakarta.persistence.FetchType; +import jakarta.persistence.JoinColumn; import jakarta.persistence.OneToMany; import lombok.AccessLevel; import lombok.NoArgsConstructor; @@ -19,7 +20,8 @@ public class RoadmapNodes { @OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE}, - mappedBy = "roadmapContent") + orphanRemoval = true) + @JoinColumn(name = "roadmap_content_id", nullable = false) private final List values = new ArrayList<>(); public RoadmapNodes(final List roadmapNodes) { @@ -47,18 +49,6 @@ public void addAll(final RoadmapNodes roadmapNodes) { validateTitleDistinct(values); } - public void updateAllRoadmapContent(final RoadmapContent content) { - for (final RoadmapNode roadmapNode : values) { - updateRoadmapContent(roadmapNode, content); - } - } - - private void updateRoadmapContent(final RoadmapNode roadmapNode, final RoadmapContent content) { - if (roadmapNode.isNotSameRoadmapContent(content)) { - roadmapNode.updateRoadmapContent(content); - } - } - public Optional findById(final Long roadmapNodeId) { return values.stream() .filter(it -> it.getId().equals(roadmapNodeId)) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapNodeRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapNodeRepository.java deleted file mode 100644 index 888791a32..000000000 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapNodeRepository.java +++ /dev/null @@ -1,12 +0,0 @@ -package co.kirikiri.roadmap.persistence; - -import co.kirikiri.roadmap.domain.RoadmapContent; -import co.kirikiri.roadmap.domain.RoadmapNode; -import org.springframework.data.jpa.repository.JpaRepository; - -import java.util.List; - -public interface RoadmapNodeRepository extends JpaRepository { - - List findAllByRoadmapContent(final RoadmapContent roadmapContent); -} diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentTest.java index b4a08e0e6..343906912 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentTest.java @@ -36,18 +36,18 @@ class RoadmapContentTest { void 로드맵_본문에_노드들을_추가한다() { // given final RoadmapContent content = new RoadmapContent("content"); + final RoadmapNodes roadmapNodes = new RoadmapNodes( + List.of(new RoadmapNode("title1", "content1"), new RoadmapNode("title2", "content1"))); // when - content.addNodes( - new RoadmapNodes( - List.of(new RoadmapNode("title1", "content1"), new RoadmapNode("title2", "content1")))); + content.addNodes(roadmapNodes); // then final RoadmapNodes nodes = content.getNodes(); assertAll( () -> assertThat(nodes.getValues()).hasSize(2), - () -> assertThat(nodes.getValues().get(0).getRoadmapContent()).isEqualTo(content), - () -> assertThat(nodes.getValues().get(1).getRoadmapContent()).isEqualTo(content) + () -> assertThat(nodes.getValues().get(0).getTitle()).isEqualTo("title1"), + () -> assertThat(nodes.getValues().get(1).getTitle()).isEqualTo("title2") ); } @@ -60,8 +60,7 @@ class RoadmapContentTest { // then final String title = "title"; assertThatThrownBy(() -> content.addNodes( - new RoadmapNodes( - List.of(new RoadmapNode(title, "content1"), new RoadmapNode(title, "content1"))))); + new RoadmapNodes(List.of(new RoadmapNode(title, "content1"), new RoadmapNode(title, "content1"))))); } @Test diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodesTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodesTest.java index 51ba2a17d..46503d56f 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodesTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodesTest.java @@ -5,7 +5,6 @@ import java.util.List; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertAll; class RoadmapNodesTest { @@ -21,22 +20,21 @@ class RoadmapNodesTest { assertThat(roadmapNodes.getValues()).hasSize(2); } - @Test - void 로드맵_노드들의_로드맵_본문을_업데이트한다() { - // given - final RoadmapNodes roadmapNodes = new RoadmapNodes( - List.of(new RoadmapNode("로드맵 노드 제목1", "로드맵 노드 내용1"), new RoadmapNode("로드맵 노드 제목2", "로드맵 노드 내용2"))); - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); - - // when - roadmapNodes.updateAllRoadmapContent(roadmapContent); - - // then - final List nodes = roadmapNodes.getValues(); - assertAll( - () -> assertThat(nodes.get(0).getRoadmapContent()).isEqualTo(roadmapContent), - () -> assertThat(nodes.get(1).getRoadmapContent()).isEqualTo(roadmapContent) - ); - } - +// @Test +// void 로드맵_노드들의_로드맵_본문을_업데이트한다() { +// // given +// final RoadmapNodes roadmapNodes = new RoadmapNodes( +// List.of(new RoadmapNode("로드맵 노드 제목1", "로드맵 노드 내용1"), new RoadmapNode("로드맵 노드 제목2", "로드맵 노드 내용2"))); +// final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); +// +// // when +// roadmapNodes.updateAllRoadmapContent(roadmapContent); +// +// // then +// final List nodes = roadmapNodes.getValues(); +// assertAll( +// () -> assertThat(nodes.get(0).getRoadmapContentId()).isEqualTo(roadmapContent.getId()), +// () -> assertThat(nodes.get(1).getRoadmapContentId()).isEqualTo(roadmapContent.getId()) +// ); +// } } From 9cf3c2af5b8ca39847fac16543ac57602522c303 Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Sun, 14 Jan 2024 23:56:52 +0900 Subject: [PATCH 16/22] =?UTF-8?q?refactor:=20Roadmap=EA=B3=BC=20RoadmapCon?= =?UTF-8?q?tent,=20RoadmapReview=EA=B0=84=20=EC=9D=98=EC=A1=B4=20=EA=B4=80?= =?UTF-8?q?=EA=B3=84=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GoalRoomMemberQueryRepositoryImpl.java | 2 +- .../goalroom/GoalRoomQueryRepository.java | 11 +- .../goalroom/GoalRoomQueryRepositoryImpl.java | 22 +- .../co/kirikiri/roadmap/domain/Roadmap.java | 29 -- .../roadmap/domain/RoadmapContent.java | 32 +- .../roadmap/domain/RoadmapContents.java | 10 - .../roadmap/domain/RoadmapReview.java | 24 +- .../roadmap/domain/RoadmapReviews.java | 9 +- .../persistence/RoadmapContentRepository.java | 11 +- .../persistence/RoadmapQueryRepository.java | 3 - .../RoadmapQueryRepositoryImpl.java | 22 +- .../persistence/RoadmapRepository.java | 4 + .../RoadmapReviewQueryRepository.java | 7 +- .../RoadmapReviewQueryRepositoryImpl.java | 13 +- .../persistence/RoadmapReviewRepository.java | 5 +- .../roadmap/service/RoadmapCreateService.java | 63 +-- .../service/RoadmapGoalRoomService.java | 6 +- .../roadmap/service/RoadmapReadService.java | 18 +- .../service/scheduler/RoadmapScheduler.java | 4 +- .../goalroom/GoalRoomCreateService.java | 14 +- .../goalroom/RoadmapGoalRoomServiceImpl.java | 18 +- .../goalroom/GoalRoomPendingMemberTest.java | 4 +- .../goalroom/GoalRoomPendingMembersTest.java | 4 +- .../domain/goalroom/GoalRoomTest.java | 63 +-- .../goalroom/CheckFeedRepositoryTest.java | 119 ++--- .../GoalRoomMemberRepositoryTest.java | 167 +++---- .../GoalRoomPendingMemberRepositoryTest.java | 157 +++--- .../goalroom/GoalRoomRepositoryTest.java | 108 ++-- .../GoalRoomToDoCheckRepositoryTest.java | 24 +- .../roadmap/domain/RoadmapContentTest.java | 24 +- .../roadmap/domain/RoadmapContentsTest.java | 40 +- .../roadmap/domain/RoadmapReviewTest.java | 9 +- .../kirikiri/roadmap/domain/RoadmapTest.java | 43 -- .../RoadmapContentRepositoryTest.java | 62 +-- .../persistence/RoadmapRepositoryTest.java | 126 +++-- .../RoadmapReviewRepositoryTest.java | 76 +-- .../RoadmapCreateEventListenerTest.java | 27 +- .../service/RoadmapCreateServiceTest.java | 38 +- .../service/RoadmapReadServiceTest.java | 59 +-- .../roadmap/service/RoadmapSchedulerTest.java | 55 +- .../service/GoalRoomCreateServiceTest.java | 471 +++++++----------- .../service/GoalRoomReadServiceTest.java | 211 ++++---- .../service/GoalRoomSchedulerTest.java | 36 +- 43 files changed, 881 insertions(+), 1369 deletions(-) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberQueryRepositoryImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberQueryRepositoryImpl.java index e2f5ce90c..12aefa04b 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberQueryRepositoryImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomMemberQueryRepositoryImpl.java @@ -38,7 +38,7 @@ public Optional findByRoadmapIdAndMemberIdentifierAndGoalRoomSta .innerJoin(goalRoomMember.member, member) .fetchJoin() .where( - goalRoom.roadmapContent.roadmap.id.eq(roadmapId), + goalRoom.roadmapContent.roadmapId.eq(roadmapId), member.identifier.eq(identifier), goalRoom.status.eq(status)) .fetchOne()); diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepository.java index ee15abe48..8fe37ee73 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepository.java @@ -4,7 +4,6 @@ import co.kirikiri.domain.goalroom.GoalRoomStatus; import co.kirikiri.domain.member.Member; import co.kirikiri.persistence.goalroom.dto.RoadmapGoalRoomsOrderType; -import co.kirikiri.roadmap.domain.Roadmap; import java.time.LocalDate; import java.util.List; @@ -18,10 +17,10 @@ public interface GoalRoomQueryRepository { Optional findByIdWithContentAndTodos(final Long goalRoomId); - List findGoalRoomsByRoadmapAndCond(final Roadmap roadmap, - final RoadmapGoalRoomsOrderType filterType, - final Long lastId, - final int pageSize); + List findGoalRoomsByRoadmapIdAndCond(final Long roadmapId, + final RoadmapGoalRoomsOrderType filterType, + final Long lastId, + final int pageSize); Optional findByIdWithTodos(final Long goalRoomId); @@ -31,7 +30,7 @@ List findGoalRoomsByRoadmapAndCond(final Roadmap roadmap, Optional findByIdWithNodes(final Long goalRoomId); - List findByRoadmap(final Roadmap roadmap); + List findByRoadmapId(final Long roadmapId); List findAllRecruitingGoalRoomsByStartDateEarlierThan(final LocalDate startDate); } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepositoryImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepositoryImpl.java index 5fe835bec..9ebd9f053 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepositoryImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/persistence/goalroom/GoalRoomQueryRepositoryImpl.java @@ -5,7 +5,6 @@ import co.kirikiri.domain.member.Member; import co.kirikiri.persistence.QuerydslRepositorySupporter; import co.kirikiri.persistence.goalroom.dto.RoadmapGoalRoomsOrderType; -import co.kirikiri.roadmap.domain.Roadmap; import com.querydsl.core.types.OrderSpecifier; import com.querydsl.core.types.dsl.BooleanExpression; import jakarta.persistence.LockModeType; @@ -60,17 +59,16 @@ public Optional findByIdWithContentAndTodos(final Long goalRoomId) { } @Override - public List findGoalRoomsByRoadmapAndCond(final Roadmap roadmap, - final RoadmapGoalRoomsOrderType orderType, - final Long lastId, - final int pageSize) { + public List findGoalRoomsByRoadmapIdAndCond(final Long roadmapId, + final RoadmapGoalRoomsOrderType orderType, + final Long lastId, + final int pageSize) { return selectFrom(goalRoom) .innerJoin(goalRoom.roadmapContent, roadmapContent) - .on(roadmapContent.roadmap.eq(roadmap)) + .on(roadmapContent.roadmapId.eq(roadmapId)) .where( statusCond(orderType), - lessThanLastId(lastId, orderType), - roadmapCond(roadmap)) + lessThanLastId(lastId, orderType)) .limit(pageSize + LIMIT_OFFSET) .orderBy(sortCond(orderType)) .fetch(); @@ -118,10 +116,10 @@ public Optional findByIdWithNodes(final Long goalRoomId) { } @Override - public List findByRoadmap(final Roadmap roadmap) { + public List findByRoadmapId(final Long roadmapId) { return selectFrom(goalRoom) .innerJoin(goalRoom.roadmapContent, roadmapContent) - .where(roadmapContent.roadmap.eq(roadmap)) + .where(roadmapContent.roadmapId.eq(roadmapId)) .fetch(); } @@ -174,10 +172,6 @@ private BooleanExpression lessThanLastId(final Long lastId, final RoadmapGoalRoo ); } - private BooleanExpression roadmapCond(final Roadmap roadmap) { - return goalRoom.roadmapContent.roadmap.eq(roadmap); - } - private BooleanExpression equalOrEarlierStartDateThan(final LocalDate date) { return goalRoom.startDate.loe(date); } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/Roadmap.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/Roadmap.java index 384c6c00a..832bbd2a1 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/Roadmap.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/Roadmap.java @@ -15,7 +15,6 @@ import lombok.NoArgsConstructor; import java.util.Objects; -import java.util.Optional; @Entity @NoArgsConstructor(access = AccessLevel.PROTECTED) @@ -52,15 +51,9 @@ public class Roadmap extends BaseCreatedTimeEntity { @JoinColumn(name = "category_id", nullable = false) private RoadmapCategory category; - @Embedded - private RoadmapContents contents = new RoadmapContents(); - @Embedded private RoadmapTags tags = new RoadmapTags(); - @Embedded - private RoadmapReviews reviews = new RoadmapReviews(); - public Roadmap(final String title, final String introduction, final int requiredPeriod, final RoadmapDifficulty difficulty, final Long creatorId, final RoadmapCategory category) { this(null, title, introduction, requiredPeriod, difficulty, RoadmapStatus.CREATED, creatorId, category); @@ -123,13 +116,6 @@ private void validateRequiredPeriod(final int requiredPeriod) { } } - public void addContent(final RoadmapContent content) { - contents.add(content); - if (content.isNotSameRoadmap(this)) { - content.updateRoadmap(this); - } - } - public void addTags(final RoadmapTags tags) { this.tags.addAll(tags); } @@ -138,21 +124,10 @@ public boolean isCreator(final Long memberId) { return Objects.equals(creatorId, memberId); } - public void addReview(final RoadmapReview review) { - reviews.add(review); - if (review.isNotSameRoadmap(this)) { - review.updateRoadmap(this); - } - } - public void delete() { this.status = RoadmapStatus.DELETED; } - public Optional findLastRoadmapContent() { - return this.contents.findLastRoadmapContent(); - } - public boolean isDeleted() { return status == RoadmapStatus.DELETED; } @@ -169,10 +144,6 @@ public RoadmapCategory getCategory() { return category; } - public RoadmapContents getContents() { - return contents; - } - public String getIntroduction() { return introduction; } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContent.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContent.java index 12da97e86..c381c3f6f 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContent.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContent.java @@ -5,9 +5,6 @@ import jakarta.persistence.Column; import jakarta.persistence.Embedded; import jakarta.persistence.Entity; -import jakarta.persistence.FetchType; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; @@ -24,21 +21,20 @@ public class RoadmapContent extends BaseUpdatedTimeEntity { @Column(length = 2200) private String content; - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "roadmap_id", nullable = false) - private Roadmap roadmap; + private Long roadmapId; @Embedded private final RoadmapNodes nodes = new RoadmapNodes(); - public RoadmapContent(final String content) { - this(null, content); + public RoadmapContent(final String content, final Long roadmapId) { + this(null, content, roadmapId); } - public RoadmapContent(final Long id, final String content) { + public RoadmapContent(final Long id, final String content, final Long roadmapId) { validate(content); this.id = id; this.content = content; + this.roadmapId = roadmapId; } private void validate(final String content) { @@ -58,16 +54,6 @@ public void addNodes(final RoadmapNodes nodes) { this.nodes.addAll(nodes); } - public boolean isNotSameRoadmap(final Roadmap roadmap) { - return this.roadmap == null || !this.roadmap.equals(roadmap); - } - - public void updateRoadmap(final Roadmap roadmap) { - if (this.roadmap == null) { - this.roadmap = roadmap; - } - } - public int nodesSize() { return nodes.size(); } @@ -84,11 +70,11 @@ public String getContent() { return content; } - public RoadmapNodes getNodes() { - return nodes; + public Long getRoadmapId() { + return roadmapId; } - public Roadmap getRoadmap() { - return roadmap; + public RoadmapNodes getNodes() { + return nodes; } } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContents.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContents.java index 99b0816de..25d70fafd 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContents.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContents.java @@ -1,10 +1,5 @@ package co.kirikiri.roadmap.domain; -import jakarta.persistence.CascadeType; -import jakarta.persistence.Column; -import jakarta.persistence.Embeddable; -import jakarta.persistence.FetchType; -import jakarta.persistence.OneToMany; import lombok.AccessLevel; import lombok.NoArgsConstructor; @@ -12,14 +7,9 @@ import java.util.List; import java.util.Optional; -@Embeddable @NoArgsConstructor(access = AccessLevel.PROTECTED) public class RoadmapContents { - @OneToMany(fetch = FetchType.LAZY, - cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE}, - mappedBy = "roadmap") - @Column(nullable = false) private final List values = new ArrayList<>(); public RoadmapContents(final List contents) { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReview.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReview.java index 9a507b2cf..9374686b2 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReview.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReview.java @@ -4,9 +4,6 @@ import co.kirikiri.roadmap.domain.exception.RoadmapException; import jakarta.persistence.Column; import jakarta.persistence.Entity; -import jakarta.persistence.FetchType; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; import lombok.AccessLevel; import lombok.NoArgsConstructor; @@ -31,17 +28,16 @@ public class RoadmapReview extends BaseUpdatedTimeEntity { private Long memberId; - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "roadmap_id") - private Roadmap roadmap; + private Long roadmapId; - public RoadmapReview(final String content, final Double rate, final Long memberId) { + public RoadmapReview(final String content, final Double rate, final Long memberId, final Long roadmapId) { if (content != null) { validate(content, rate); } this.content = content; this.rate = rate; this.memberId = memberId; + this.roadmapId = roadmapId; } private void validate(final String content, final Double rate) { @@ -62,16 +58,6 @@ private void validateRate(final Double rate) { } } - public void updateRoadmap(final Roadmap roadmap) { - if (this.roadmap == null) { - this.roadmap = roadmap; - } - } - - public boolean isNotSameRoadmap(final Roadmap roadmap) { - return this.roadmap == null || !this.roadmap.equals(roadmap); - } - public String getContent() { return content; } @@ -83,4 +69,8 @@ public Double getRate() { public Long getMemberId() { return memberId; } + + public Long getRoadmapId() { + return roadmapId; + } } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReviews.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReviews.java index 98fcc7353..2e360e084 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReviews.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReviews.java @@ -1,9 +1,6 @@ package co.kirikiri.roadmap.domain; -import jakarta.persistence.CascadeType; import jakarta.persistence.Embeddable; -import jakarta.persistence.FetchType; -import jakarta.persistence.OneToMany; import lombok.AccessLevel; import lombok.NoArgsConstructor; @@ -14,9 +11,9 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) public class RoadmapReviews { - @OneToMany(fetch = FetchType.LAZY, - cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE}, - orphanRemoval = true, mappedBy = "roadmap") + // @OneToMany(fetch = FetchType.LAZY, +// cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE}, +// orphanRemoval = true, mappedBy = "roadmap") private List values = new ArrayList<>(); public void add(final RoadmapReview review) { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapContentRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapContentRepository.java index ef3639a75..061bc520f 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapContentRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapContentRepository.java @@ -1,21 +1,16 @@ package co.kirikiri.roadmap.persistence; -import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapContent; import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; +import java.util.List; import java.util.Optional; public interface RoadmapContentRepository extends JpaRepository { Optional findFirstByRoadmapIdOrderByCreatedAtDesc(final Long roadmapId); - Optional findFirstByRoadmapOrderByCreatedAtDesc(final Roadmap roadmap); + List findAllByRoadmapId(final Long roadmapId); - @Query("select rc from RoadmapContent rc " - + "join fetch rc.roadmap r " - + "where rc.id = :roadmapContentId") - Optional findByIdWithRoadmap(@Param("roadmapContentId") final Long roadmapContentId); + void deleteAllByRoadmapId(final Long roadmapId); } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepository.java index 0deace654..2f57c0033 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepository.java @@ -2,7 +2,6 @@ import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; -import co.kirikiri.roadmap.domain.RoadmapStatus; import co.kirikiri.roadmap.persistence.dto.RoadmapOrderType; import co.kirikiri.roadmap.persistence.dto.RoadmapSearchDto; @@ -28,6 +27,4 @@ List findRoadmapsWithCategoryByMemberIdOrderByLatest(final Long memberI final int pageSize); Optional findByIdAndMemberIdentifier(final Long roadmapId, final String identifier); - - List findWithRoadmapContentByStatus(final RoadmapStatus status); } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepositoryImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepositoryImpl.java index 1f0ff75d5..ec02ac435 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepositoryImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapQueryRepositoryImpl.java @@ -26,7 +26,6 @@ import static co.kirikiri.domain.member.QMember.member; import static co.kirikiri.roadmap.domain.QRoadmap.roadmap; import static co.kirikiri.roadmap.domain.QRoadmapCategory.roadmapCategory; -import static co.kirikiri.roadmap.domain.QRoadmapContent.roadmapContent; import static co.kirikiri.roadmap.domain.QRoadmapReview.roadmapReview; import static co.kirikiri.roadmap.domain.QRoadmapTag.roadmapTag; @@ -105,15 +104,6 @@ public Optional findByIdAndMemberIdentifier(final Long roadmapId, final .fetchOne()); } - @Override - public List findWithRoadmapContentByStatus(final RoadmapStatus status) { - return selectFrom(roadmap) - .innerJoin(roadmap.contents.values, roadmapContent) - .fetchJoin() - .where(statusCond(status)) - .fetch(); - } - private BooleanExpression roadmapCond(final Long roadmapId) { return roadmap.id.eq(roadmapId); } @@ -171,19 +161,19 @@ private OrderSpecifier sortCond(final RoadmapOrderType orderType) { if (orderType == RoadmapOrderType.GOAL_ROOM_COUNT) { return new OrderSpecifier<>( Order.DESC, - goalRoomCountCond(goalRoom.roadmapContent.roadmap.eq(roadmap)) + goalRoomCountCond(goalRoom.roadmapContent.roadmapId.eq(roadmap.id)) ); } if (orderType == RoadmapOrderType.PARTICIPANT_COUNT) { return new OrderSpecifier<>( Order.DESC, - participantCountCond(goalRoomMember.goalRoom.roadmapContent.roadmap.eq(roadmap)) + participantCountCond(goalRoomMember.goalRoom.roadmapContent.roadmapId.eq(roadmap.id)) ); } if (orderType == RoadmapOrderType.REVIEW_RATE) { return new OrderSpecifier<>( Order.DESC, - reviewRateCond(roadmapReview.roadmap.eq(roadmap)) + reviewRateCond(roadmapReview.roadmapId.eq(roadmap.id)) ); } return roadmap.createdAt.desc(); @@ -212,17 +202,17 @@ private BooleanExpression lessThanLastId(final Long lastId, final RoadmapOrderTy return null; } if (orderType == RoadmapOrderType.GOAL_ROOM_COUNT) { - final NumberPath goalRoomRoadmapId = goalRoom.roadmapContent.roadmap.id; + final NumberPath goalRoomRoadmapId = goalRoom.roadmapContent.roadmapId; return goalRoomCountCond(goalRoomRoadmapId.eq(roadmap.id)) .lt(goalRoomCountCond(goalRoomRoadmapId.eq(lastId))); } if (orderType == RoadmapOrderType.PARTICIPANT_COUNT) { - final NumberPath goalRoomMemberRoadmapId = goalRoomMember.goalRoom.roadmapContent.roadmap.id; + final NumberPath goalRoomMemberRoadmapId = goalRoomMember.goalRoom.roadmapContent.roadmapId; return participantCountCond(goalRoomMemberRoadmapId.eq(roadmap.id)) .lt(participantCountCond(goalRoomMemberRoadmapId.eq(lastId))); } if (orderType == RoadmapOrderType.REVIEW_RATE) { - final NumberPath roadmapReviewRoadmapId = roadmapReview.roadmap.id; + final NumberPath roadmapReviewRoadmapId = roadmapReview.roadmapId; return reviewRateCond(roadmapReviewRoadmapId.eq(roadmap.id)) .lt(reviewRateCond(roadmapReviewRoadmapId.eq(lastId))); } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapRepository.java index f0819e5d9..21910dbac 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapRepository.java @@ -1,8 +1,12 @@ package co.kirikiri.roadmap.persistence; import co.kirikiri.roadmap.domain.Roadmap; +import co.kirikiri.roadmap.domain.RoadmapStatus; import org.springframework.data.jpa.repository.JpaRepository; +import java.util.List; + public interface RoadmapRepository extends JpaRepository, RoadmapQueryRepository { + List findByStatus(final RoadmapStatus status); } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepository.java index 182b4cf5f..53e7a6d97 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepository.java @@ -1,13 +1,12 @@ package co.kirikiri.roadmap.persistence; -import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapReview; import java.util.List; public interface RoadmapReviewQueryRepository { - List findRoadmapReviewByRoadmapOrderByLatest(final Roadmap roadmap, - final Long lastId, - final int pageSize); + List findRoadmapReviewByRoadmapIdOrderByLatest(final Long roadmapId, + final Long lastId, + final int pageSize); } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepositoryImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepositoryImpl.java index 609a77951..c20b51779 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepositoryImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewQueryRepositoryImpl.java @@ -1,7 +1,6 @@ package co.kirikiri.roadmap.persistence; import co.kirikiri.persistence.QuerydslRepositorySupporter; -import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapReview; import com.querydsl.core.types.OrderSpecifier; import com.querydsl.core.types.dsl.BooleanExpression; @@ -19,18 +18,18 @@ public RoadmapReviewQueryRepositoryImpl() { } @Override - public List findRoadmapReviewByRoadmapOrderByLatest(final Roadmap roadmap, - final Long lastId, - final int pageSize) { + public List findRoadmapReviewByRoadmapIdOrderByLatest(final Long roadmapId, + final Long lastId, + final int pageSize) { return selectFrom(roadmapReview) - .where(roadmapCond(roadmap), lessThanLastId(lastId)) + .where(roadmapCond(roadmapId), lessThanLastId(lastId)) .limit(pageSize) .orderBy(orderByCreatedAtDesc()) .fetch(); } - private BooleanExpression roadmapCond(final Roadmap roadmap) { - return roadmapReview.roadmap.eq(roadmap); + private BooleanExpression roadmapCond(final Long roadmapId) { + return roadmapReview.roadmapId.eq(roadmapId); } private BooleanExpression lessThanLastId(final Long lastId) { diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepository.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepository.java index a2b1f4bd5..6b03197be 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepository.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepository.java @@ -1,6 +1,5 @@ package co.kirikiri.roadmap.persistence; -import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapReview; import org.springframework.data.jpa.repository.JpaRepository; @@ -8,5 +7,7 @@ public interface RoadmapReviewRepository extends JpaRepository, RoadmapReviewQueryRepository { - Optional findByRoadmapAndMemberId(final Roadmap roadmap, final Long memberId); + Optional findByRoadmapIdAndMemberId(final Long roadmapId, final Long memberId); + + void deleteAllByRoadmapId(final Long roadmapId); } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java index e7c19056f..78ac48564 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java @@ -14,6 +14,7 @@ import co.kirikiri.roadmap.domain.RoadmapTags; import co.kirikiri.roadmap.domain.vo.RoadmapTagName; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; +import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import co.kirikiri.roadmap.persistence.RoadmapReviewRepository; import co.kirikiri.roadmap.service.dto.RoadmapNodeSaveDto; @@ -47,6 +48,7 @@ public class RoadmapCreateService { private final MemberRepository memberRepository; private final RoadmapRepository roadmapRepository; + private final RoadmapContentRepository roadmapContentRepository; private final RoadmapReviewRepository roadmapReviewRepository; private final RoadmapCategoryRepository roadmapCategoryRepository; private final RoadmapGoalRoomService roadmapGoalRoomService; @@ -59,9 +61,13 @@ public Long create(final RoadmapSaveRequest request, final String identifier) { final Roadmap roadmap = createRoadmap(member.getId(), roadmapSaveDto, roadmapCategory); final Roadmap savedRoadmap = roadmapRepository.save(roadmap); + final RoadmapNodes roadmapNodes = makeRoadmapNodes(roadmapSaveDto.roadmapNodes()); + final RoadmapContent roadmapContent = makeRoadmapContent(roadmapSaveDto, savedRoadmap.getId(), roadmapNodes); + roadmapContentRepository.save(roadmapContent); + applicationEventPublisher.publishEvent(new RoadmapCreateEvent(savedRoadmap.getId(), roadmapSaveDto)); - return savedRoadmap.getId(); + return roadmap.getId(); } private Member findMemberByIdentifier(final String identifier) { @@ -76,27 +82,17 @@ private RoadmapCategory findRoadmapCategoryById(final Long categoryId) { private Roadmap createRoadmap(final Long memberId, final RoadmapSaveDto roadmapSaveDto, final RoadmapCategory roadmapCategory) { - final RoadmapNodes roadmapNodes = makeRoadmapNodes(roadmapSaveDto.roadmapNodes()); - final RoadmapContent roadmapContent = makeRoadmapContent(roadmapSaveDto, roadmapNodes); - final RoadmapTags roadmapTags = makeRoadmapTags(roadmapSaveDto.tags()); final Roadmap roadmap = makeRoadmap(memberId, roadmapSaveDto, roadmapCategory); - roadmap.addContent(roadmapContent); + final RoadmapTags roadmapTags = makeRoadmapTags(roadmapSaveDto.tags()); roadmap.addTags(roadmapTags); return roadmap; } - private RoadmapNodes makeRoadmapNodes(final List roadmapNodeSaveDtos) { - return new RoadmapNodes( - roadmapNodeSaveDtos.stream() - .map(node -> new RoadmapNode(node.title(), node.content())) - .toList() - ); - } - - private RoadmapContent makeRoadmapContent(final RoadmapSaveDto roadmapSaveDto, final RoadmapNodes roadmapNodes) { - final RoadmapContent roadmapContent = new RoadmapContent(roadmapSaveDto.content()); - roadmapContent.addNodes(roadmapNodes); - return roadmapContent; + private Roadmap makeRoadmap(final Long memberId, final RoadmapSaveDto roadmapSaveDto, + final RoadmapCategory roadmapCategory) { + return new Roadmap(roadmapSaveDto.title(), roadmapSaveDto.introduction(), + roadmapSaveDto.requiredPeriod(), RoadmapDifficulty.valueOf(roadmapSaveDto.difficulty().name()), memberId, + roadmapCategory); } private RoadmapTags makeRoadmapTags(final List roadmapTagSaveDto) { @@ -107,11 +103,18 @@ private RoadmapTags makeRoadmapTags(final List roadmapTagSave ); } - private Roadmap makeRoadmap(final Long memberId, final RoadmapSaveDto roadmapSaveDto, - final RoadmapCategory roadmapCategory) { - return new Roadmap(roadmapSaveDto.title(), roadmapSaveDto.introduction(), - roadmapSaveDto.requiredPeriod(), RoadmapDifficulty.valueOf(roadmapSaveDto.difficulty().name()), memberId, - roadmapCategory); + private RoadmapNodes makeRoadmapNodes(final List roadmapNodeSaveDtos) { + return new RoadmapNodes( + roadmapNodeSaveDtos.stream() + .map(node -> new RoadmapNode(node.title(), node.content())) + .toList() + ); + } + + private RoadmapContent makeRoadmapContent(final RoadmapSaveDto roadmapSaveDto, final Long roadmapId, final RoadmapNodes roadmapNodes) { + final RoadmapContent roadmapContent = new RoadmapContent(roadmapSaveDto.content(), roadmapId); + roadmapContent.addNodes(roadmapNodes); + return roadmapContent; } public void createReview(final Long roadmapId, final String identifier, final RoadmapReviewSaveRequest request) { @@ -120,10 +123,10 @@ public void createReview(final Long roadmapId, final String identifier, final Ro .getId(); validateReviewQualification(roadmap, memberId); - validateReviewCount(roadmap, memberId); + validateReviewCount(roadmapId, memberId); final RoadmapReviewDto roadmapReviewDto = RoadmapMapper.convertRoadmapReviewDto(request, memberId); - final RoadmapReview roadmapReview = new RoadmapReview(roadmapReviewDto.content(), roadmapReviewDto.rate(), memberId); - roadmap.addReview(roadmapReview); + final RoadmapReview roadmapReview = new RoadmapReview(roadmapReviewDto.content(), roadmapReviewDto.rate(), memberId, roadmapId); + roadmapReviewRepository.save(roadmapReview); } private Roadmap findRoadmapById(final Long id) { @@ -138,10 +141,10 @@ private void validateReviewQualification(final Roadmap roadmap, final Long membe } } - private void validateReviewCount(final Roadmap roadmap, final Long memberId) { - if (roadmapReviewRepository.findByRoadmapAndMemberId(roadmap, memberId).isPresent()) { + private void validateReviewCount(final Long roadmapId, final Long memberId) { + if (roadmapReviewRepository.findByRoadmapIdAndMemberId(roadmapId, memberId).isPresent()) { throw new BadRequestException( - "이미 작성한 리뷰가 존재합니다. roadmapId = " + roadmap.getId() + " memberId = " + memberId); + "이미 작성한 리뷰가 존재합니다. roadmapId = " + roadmapId + " memberId = " + memberId); } } @@ -149,8 +152,10 @@ private void validateReviewCount(final Roadmap roadmap, final Long memberId) { public void deleteRoadmap(final String identifier, final Long roadmapId) { final Roadmap roadmap = findRoadmapById(roadmapId); validateRoadmapCreator(roadmapId, identifier); - if (!roadmapGoalRoomService.hasGoalRooms(roadmap)) { + if (!roadmapGoalRoomService.hasGoalRooms(roadmapId)) { roadmapRepository.delete(roadmap); + roadmapContentRepository.deleteAllByRoadmapId(roadmapId); + roadmapReviewRepository.deleteAllByRoadmapId(roadmapId); return; } roadmap.delete(); diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java index 190845356..ed13ba003 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapGoalRoomService.java @@ -11,11 +11,11 @@ public interface RoadmapGoalRoomService { Member findCompletedGoalRoomMember(final Long roadmapId, final String identifier); - boolean hasGoalRooms(final Roadmap roadmap); + boolean hasGoalRooms(final Long roadmapId); RoadmapGoalRoomNumberDto findRoadmapGoalRoomsByRoadmap(final Roadmap roadmap); - RoadmapGoalRoomResponses makeRoadmapGoalRoomResponsesByOrderType(final Roadmap roadmap, final RoadmapGoalRoomsOrderTypeDto orderTypeDto, final CustomScrollRequest scrollRequest); + RoadmapGoalRoomResponses makeRoadmapGoalRoomResponsesByOrderType(final Long roadmapId, final RoadmapGoalRoomsOrderTypeDto orderTypeDto, final CustomScrollRequest scrollRequest); - boolean canDeleteGoalRoomsInRoadmap(final Roadmap roadmap); + boolean canDeleteGoalRoomsInRoadmap(final Long roadmapId); } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java index 63b58c17e..9873d8e39 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReadService.java @@ -65,21 +65,21 @@ public class RoadmapReadService { private final FileService fileService; @Cacheable(value = "roadmap", keyGenerator = "cacheKeyGenerator", cacheManager = "redisCacheManager") - public RoadmapResponse findRoadmap(final Long id) { - final Roadmap roadmap = findRoadmapById(id); - final RoadmapContent recentRoadmapContent = findRecentContent(roadmap); + public RoadmapResponse findRoadmap(final Long roadmapId) { + final Roadmap roadmap = findRoadmapById(roadmapId); + final RoadmapContent recentRoadmapContent = findRecentContent(roadmapId); final RoadmapGoalRoomNumberDto roadmapGoalRoomNumberDto = roadmapGoalRoomService.findRoadmapGoalRoomsByRoadmap(roadmap); final RoadmapDto roadmapDto = makeRoadmapDto(roadmap, recentRoadmapContent); return RoadmapMapper.convertToRoadmapResponse(roadmapDto, roadmapGoalRoomNumberDto); } private Roadmap findRoadmapById(final Long id) { - return roadmapRepository.findRoadmapById(id) + return roadmapRepository.findById(id) .orElseThrow(() -> new NotFoundException("존재하지 않는 로드맵입니다. roadmapId = " + id)); } - private RoadmapContent findRecentContent(final Roadmap roadmap) { - return roadmapContentRepository.findFirstByRoadmapOrderByCreatedAtDesc(roadmap) + private RoadmapContent findRecentContent(final Long roadmapId) { + return roadmapContentRepository.findFirstByRoadmapIdOrderByCreatedAtDesc(roadmapId) .orElseThrow(() -> new NotFoundException("로드맵에 컨텐츠가 존재하지 않습니다.")); } @@ -225,14 +225,14 @@ public RoadmapGoalRoomResponses findRoadmapGoalRoomsByOrderType(final Long roadm final RoadmapGoalRoomsOrderTypeDto orderTypeDto, final CustomScrollRequest scrollRequest) { final Roadmap roadmap = findRoadmapById(roadmapId); - return roadmapGoalRoomService.makeRoadmapGoalRoomResponsesByOrderType(roadmap, orderTypeDto, scrollRequest); + return roadmapGoalRoomService.makeRoadmapGoalRoomResponsesByOrderType(roadmap.getId(), orderTypeDto, scrollRequest); } public List findRoadmapReviews(final Long roadmapId, final CustomScrollRequest scrollRequest) { final Roadmap roadmap = findRoadmapById(roadmapId); - final List roadmapReviews = roadmapReviewRepository.findRoadmapReviewByRoadmapOrderByLatest( - roadmap, scrollRequest.lastId(), scrollRequest.size()); + final List roadmapReviews = roadmapReviewRepository.findRoadmapReviewByRoadmapIdOrderByLatest( + roadmap.getId(), scrollRequest.lastId(), scrollRequest.size()); final List roadmapReviewReadDtos = makeRoadmapReviewReadDtos(roadmapReviews); return RoadmapMapper.convertToRoadmapReviewResponses(roadmapReviewReadDtos); } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java index aadeb4e59..7bc0cf623 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java @@ -24,14 +24,14 @@ public class RoadmapScheduler { @Scheduled(cron = "0 0 4 * * *") public void deleteRoadmaps() { final RoadmapStatus status = RoadmapStatus.DELETED; - final List deletedStatusRoadmaps = roadmapRepository.findWithRoadmapContentByStatus(status); + final List deletedStatusRoadmaps = roadmapRepository.findByStatus(status); for (final Roadmap roadmap : deletedStatusRoadmaps) { delete(roadmap); } } private void delete(final Roadmap roadmap) { - final boolean canDelete = roadmapGoalRoomService.canDeleteGoalRoomsInRoadmap(roadmap); + final boolean canDelete = roadmapGoalRoomService.canDeleteGoalRoomsInRoadmap(roadmap.getId()); // TODO : GoalRoom 내부의 Roadmap 직접 의존 제거 시 로드맵에 포함된 GoalRoom 따로 제거해주기 (이벤트 활용) if (canDelete) { roadmapRepository.delete(roadmap); diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomCreateService.java b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomCreateService.java index ffb2d16a8..e0987585f 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomCreateService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/GoalRoomCreateService.java @@ -22,6 +22,7 @@ import co.kirikiri.roadmap.domain.RoadmapContent; import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.persistence.RoadmapContentRepository; +import co.kirikiri.roadmap.persistence.RoadmapRepository; import co.kirikiri.service.FilePathGenerator; import co.kirikiri.service.FileService; import co.kirikiri.service.ImageDirType; @@ -32,6 +33,7 @@ import co.kirikiri.service.dto.goalroom.request.GoalRoomCreateRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomTodoRequest; import co.kirikiri.service.dto.goalroom.response.GoalRoomToDoCheckResponse; +import co.kirikiri.service.exception.AuthenticationException; import co.kirikiri.service.exception.BadRequestException; import co.kirikiri.service.exception.NotFoundException; import co.kirikiri.service.mapper.GoalRoomMapper; @@ -55,6 +57,7 @@ public class GoalRoomCreateService { private final FilePathGenerator filePathGenerator; private final MemberRepository memberRepository; private final GoalRoomRepository goalRoomRepository; + private final RoadmapRepository roadmapRepository; private final RoadmapContentRepository roadmapContentRepository; private final GoalRoomMemberRepository goalRoomMemberRepository; private final GoalRoomToDoCheckRepository goalRoomToDoCheckRepository; @@ -76,17 +79,22 @@ public Long create(final GoalRoomCreateRequest goalRoomCreateRequest, final Stri } private RoadmapContent findRoadmapContentById(final Long roadmapContentId) { - return roadmapContentRepository.findByIdWithRoadmap(roadmapContentId) - .orElseThrow(() -> new NotFoundException("존재하지 않는 로드맵입니다.")); + return roadmapContentRepository.findById(roadmapContentId) + .orElseThrow(() -> new NotFoundException("존재하지 않는 로드맵 컨텐츠입니다.")); } private void validateDeletedRoadmap(final RoadmapContent roadmapContent) { - final Roadmap roadmap = roadmapContent.getRoadmap(); + final Roadmap roadmap = findRoadmapById(roadmapContent.getRoadmapId()); if (roadmap.isDeleted()) { throw new BadRequestException("삭제된 로드맵에 대해 골룸을 생성할 수 없습니다."); } } + private Roadmap findRoadmapById(final Long roadmapId) { + return roadmapRepository.findById(roadmapId) + .orElseThrow(() -> new AuthenticationException("존재하지 않는 로드맵입니다.")); + } + private void validateNodeSizeEqual(final int roadmapNodesSize, final int goalRoomRoadmapNodeDtosSize) { if (roadmapNodesSize != goalRoomRoadmapNodeDtosSize) { throw new BadRequestException("모든 노드에 대해 기간이 설정돼야 합니다."); diff --git a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java index f05407fce..324607b71 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/service/goalroom/RoadmapGoalRoomServiceImpl.java @@ -51,23 +51,23 @@ public Member findCompletedGoalRoomMember(final Long roadmapId, final String ide } @Override - public boolean hasGoalRooms(final Roadmap roadmap) { - return !findGoalRoomsByRoadmap(roadmap).isEmpty(); + public boolean hasGoalRooms(final Long roadmapId) { + return !findGoalRoomsByRoadmapId(roadmapId).isEmpty(); } - private List findGoalRoomsByRoadmap(final Roadmap roadmap) { - return goalRoomRepository.findByRoadmap(roadmap); + private List findGoalRoomsByRoadmapId(final Long roadmapId) { + return goalRoomRepository.findByRoadmapId(roadmapId); } @Override public RoadmapGoalRoomNumberDto findRoadmapGoalRoomsByRoadmap(final Roadmap roadmap) { - return GoalRoomMapper.convertRoadmapGoalRoomDto(findGoalRoomsByRoadmap(roadmap)); + return GoalRoomMapper.convertRoadmapGoalRoomDto(findGoalRoomsByRoadmapId(roadmap.getId())); } @Override - public RoadmapGoalRoomResponses makeRoadmapGoalRoomResponsesByOrderType(final Roadmap roadmap, final RoadmapGoalRoomsOrderTypeDto orderTypeDto, final CustomScrollRequest scrollRequest) { + public RoadmapGoalRoomResponses makeRoadmapGoalRoomResponsesByOrderType(final Long roadmapId, final RoadmapGoalRoomsOrderTypeDto orderTypeDto, final CustomScrollRequest scrollRequest) { final RoadmapGoalRoomsOrderType orderType = GoalRoomMapper.convertToGoalRoomOrderType(orderTypeDto); - final List roadmapGoalRoomDtos = goalRoomRepository.findGoalRoomsByRoadmapAndCond(roadmap, orderType, scrollRequest.lastId(), scrollRequest.size()) + final List roadmapGoalRoomDtos = goalRoomRepository.findGoalRoomsByRoadmapIdAndCond(roadmapId, orderType, scrollRequest.lastId(), scrollRequest.size()) .stream() .map(this::makeGoalRoomDto) .toList(); @@ -92,8 +92,8 @@ private MemberDto makeMemberDto(final Member creator) { @Override @Transactional - public boolean canDeleteGoalRoomsInRoadmap(final Roadmap roadmap) { - final List goalRooms = goalRoomRepository.findByRoadmap(roadmap); + public boolean canDeleteGoalRoomsInRoadmap(final Long roadmapId) { + final List goalRooms = goalRoomRepository.findByRoadmapId(roadmapId); return canDeleteRoadmapBasedOnGoalRooms(goalRooms); } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMemberTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMemberTest.java index 522e08673..51247c0b8 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMemberTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMemberTest.java @@ -25,7 +25,7 @@ class GoalRoomPendingMemberTest { new Nickname("nickname"), null, new MemberProfile(Gender.FEMALE, "kirikiri1@email.com")); final GoalRoom goalRoom = new GoalRoom(new GoalRoomName("goalroom"), new LimitedMemberCount(10), - new RoadmapContent("content"), member); + new RoadmapContent("content", null), member); // when final GoalRoomPendingMember goalRoomPendingMember = new GoalRoomPendingMember(GoalRoomRole.LEADER, goalRoom, @@ -42,7 +42,7 @@ class GoalRoomPendingMemberTest { new Nickname("nickname"), null, new MemberProfile(Gender.FEMALE, "kirikiri1@email.com")); final GoalRoom goalRoom = new GoalRoom(new GoalRoomName("goalroom"), new LimitedMemberCount(10), - new RoadmapContent("content"), member); + new RoadmapContent("content", 1L), member); // when final GoalRoomPendingMember goalRoomPendingMember = new GoalRoomPendingMember(GoalRoomRole.FOLLOWER, goalRoom, diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembersTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembersTest.java index 1f4641d15..b72775bbd 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembersTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembersTest.java @@ -30,7 +30,7 @@ null, new EncryptedPassword(new Password("password2!")), void 골룸의_리더를_찾는다() { // given final GoalRoom goalRoom = new GoalRoom(new GoalRoomName("goalroom"), new LimitedMemberCount(10), - new RoadmapContent("content"), MEMBER1); + new RoadmapContent("content", 1L), MEMBER1); // when final GoalRoomPendingMembers goalRoomPendingMembers = new GoalRoomPendingMembers(List.of( @@ -46,7 +46,7 @@ null, new EncryptedPassword(new Password("password2!")), void 골룸의_리더가_없으면_예외가_발생한다() { // given final GoalRoom goalRoom = new GoalRoom(new GoalRoomName("goalroom"), new LimitedMemberCount(10), - new RoadmapContent("content"), MEMBER1); + new RoadmapContent("content", 1L), MEMBER1); // when final GoalRoomPendingMembers goalRoomPendingMembers = new GoalRoomPendingMembers(List.of( diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomTest.java index 9f6745463..2c0a9f16c 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomTest.java @@ -11,11 +11,7 @@ import co.kirikiri.domain.member.vo.Identifier; import co.kirikiri.domain.member.vo.Nickname; import co.kirikiri.domain.member.vo.Password; -import co.kirikiri.roadmap.domain.Roadmap; -import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; -import co.kirikiri.roadmap.domain.RoadmapContents; -import co.kirikiri.roadmap.domain.RoadmapDifficulty; import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodeImages; import co.kirikiri.roadmap.domain.RoadmapNodes; @@ -54,11 +50,8 @@ static void setUp() { void 골룸의_총_기간을_계산한다() { // given final Member creator = 크리에이터를_생성한다(); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(targetRoadmapContent, creator); + final RoadmapContent roadmapContent = 로드맵_콘텐츠를_생성한다(); + final GoalRoom goalRoom = 골룸을_생성한다(roadmapContent, creator); // when final int totalPeriod = goalRoom.calculateTotalPeriod(); @@ -72,7 +65,7 @@ static void setUp() { void 골룸에_대기중인_인원수를_계산한다() { // given final GoalRoom goalRoom = new GoalRoom(new GoalRoomName("goalroom"), new LimitedMemberCount(10), - new RoadmapContent("content"), member); + new RoadmapContent("content", 1L), member); final Member member1 = new Member(2L, new Identifier("identifier2"), null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임2"), null, @@ -94,7 +87,7 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 void 골룸에_사용자를_추가한다() { //given final GoalRoom goalRoom = new GoalRoom(GOAL_ROOM_NAME, new LimitedMemberCount(10), - new RoadmapContent("로드맵 내용"), member); + new RoadmapContent("로드맵 내용", 1L), member); final Member follower = 사용자를_생성한다(2L, "identifier12", "시진이"); //when @@ -109,7 +102,7 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 @Test void 모집중이_아닌_골룸에_사용자를_추가하면_예외가_발생한다() { //given - final GoalRoom goalRoom = new GoalRoom(GOAL_ROOM_NAME, new LimitedMemberCount(10), new RoadmapContent("로드맵 내용"), + final GoalRoom goalRoom = new GoalRoom(GOAL_ROOM_NAME, new LimitedMemberCount(10), new RoadmapContent("로드맵 내용", 1L), 사용자를_생성한다(2L, "identifier1", "시진이")); goalRoom.start(); @@ -122,7 +115,7 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 @Test void 제한_인원이_가득_찬_골룸에_사용자를_추가하면_예외가_발생한다() { //given - final GoalRoom goalRoom = new GoalRoom(GOAL_ROOM_NAME, new LimitedMemberCount(1), new RoadmapContent("로드맵 내용"), + final GoalRoom goalRoom = new GoalRoom(GOAL_ROOM_NAME, new LimitedMemberCount(1), new RoadmapContent("로드맵 내용", 1L), 사용자를_생성한다(2L, "identifier1", "시진이")); //when,then @@ -135,7 +128,7 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 void 이미_참여_중인_사용자를_골룸에_추가하면_예외가_발생한다() { //given final GoalRoom goalRoom = new GoalRoom(GOAL_ROOM_NAME, new LimitedMemberCount(2), - new RoadmapContent("로드맵 내용"), member); + new RoadmapContent("로드맵 내용", 1L), member); //when,then assertThatThrownBy(() -> goalRoom.join(member)) @@ -147,11 +140,8 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 void 골룸의_총_인증_횟수를_구한다() { //given final Member creator = 크리에이터를_생성한다(); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(targetRoadmapContent, creator); + final RoadmapContent roadmapContent = 로드맵_콘텐츠를_생성한다(); + final GoalRoom goalRoom = 골룸을_생성한다(roadmapContent, creator); //expect assertThat(goalRoom.getAllCheckCount()).isEqualTo(20); @@ -161,11 +151,8 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 void 골룸이_시작하기_전에_참여_멤버를_확인한다() { //given final Member creator = 크리에이터를_생성한다(); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(targetRoadmapContent, creator); + final RoadmapContent roadmapContent = 로드맵_콘텐츠를_생성한다(); + final GoalRoom goalRoom = 골룸을_생성한다(roadmapContent, creator); final Member 참여자 = 사용자를_생성한다(2L, "identifier1", "팔로워"); goalRoom.join(참여자); @@ -181,11 +168,8 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 void 골룸이_시작한_후에_참여_멤버를_확인한다() { //given final Member creator = 크리에이터를_생성한다(); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(targetRoadmapContent, creator); + final RoadmapContent roadmapContent = 로드맵_콘텐츠를_생성한다(); + final GoalRoom goalRoom = 골룸을_생성한다(roadmapContent, creator); final Member 참여자 = 사용자를_생성한다(2L, "identifier1", "팔로워"); // goalRoom.join(참여자); @@ -202,7 +186,7 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 void 골룸을_나간다() { //given final GoalRoom goalRoom = new GoalRoom(GOAL_ROOM_NAME, new LimitedMemberCount(2), - new RoadmapContent("로드맵 내용"), member); + new RoadmapContent("로드맵 내용", 1L), member); // when goalRoom.leave(member); @@ -215,7 +199,7 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 void 골룸에_참여하지_않은_멤버가_나가면_예외가_발생한다() { //given final GoalRoom goalRoom = new GoalRoom(GOAL_ROOM_NAME, new LimitedMemberCount(2), - new RoadmapContent("로드맵 내용"), member); + new RoadmapContent("로드맵 내용", 1L), member); final Member notJoinMember = new Member(new Identifier("identifier2"), new EncryptedPassword(new Password("password2!")), @@ -231,11 +215,8 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 void 골룸이_종료된지_3개월_이상_지나지_않으면_false를_반환한다() { //given final Member creator = 크리에이터를_생성한다(); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(targetRoadmapContent, creator); + final RoadmapContent roadmapContent = 로드맵_콘텐츠를_생성한다(); + final GoalRoom goalRoom = 골룸을_생성한다(roadmapContent, creator); // when final boolean result = goalRoom.isCompletedAfterMonths(3); @@ -256,13 +237,9 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 new Nickname(nickname), null, memberProfile); } - private Roadmap 로드맵을_생성한다(final Member creator) { - final RoadmapCategory category = new RoadmapCategory("게임"); + private RoadmapContent 로드맵_콘텐츠를_생성한다() { final List roadmapNodes = 로드맵_노드들을_생성한다(); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmapNodes); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); - roadmap.addContent(roadmapContent); - return roadmap; + return 로드맵_본문을_생성한다(roadmapNodes); } private List 로드맵_노드들을_생성한다() { @@ -273,7 +250,7 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 } private RoadmapContent 로드맵_본문을_생성한다(final List roadmapNodes) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", 1L); roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); return roadmapContent; } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/CheckFeedRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/CheckFeedRepositoryTest.java index 72034f246..4c5e4b7f9 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/CheckFeedRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/CheckFeedRepositoryTest.java @@ -23,13 +23,13 @@ import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; -import co.kirikiri.roadmap.domain.RoadmapContents; import co.kirikiri.roadmap.domain.RoadmapDifficulty; import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodeImage; import co.kirikiri.roadmap.domain.RoadmapNodeImages; import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; +import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import org.junit.jupiter.api.Test; @@ -54,6 +54,7 @@ class CheckFeedRepositoryTest { private final MemberRepository memberRepository; private final RoadmapCategoryRepository roadmapCategoryRepository; private final RoadmapRepository roadmapRepository; + private final RoadmapContentRepository roadmapContentRepository; private final GoalRoomRepository goalRoomRepository; private final GoalRoomMemberRepository goalRoomMemberRepository; private final CheckFeedRepository checkFeedRepository; @@ -61,12 +62,14 @@ class CheckFeedRepositoryTest { public CheckFeedRepositoryTest(final MemberRepository memberRepository, final RoadmapCategoryRepository roadmapCategoryRepository, final RoadmapRepository roadmapRepository, + final RoadmapContentRepository roadmapContentRepository, final GoalRoomRepository goalRoomRepository, final GoalRoomMemberRepository goalRoomMemberRepository, final CheckFeedRepository checkFeedRepository) { this.memberRepository = memberRepository; this.roadmapCategoryRepository = roadmapCategoryRepository; this.roadmapRepository = roadmapRepository; + this.roadmapContentRepository = roadmapContentRepository; this.goalRoomRepository = goalRoomRepository; this.goalRoomMemberRepository = goalRoomMemberRepository; this.checkFeedRepository = checkFeedRepository; @@ -76,13 +79,11 @@ public CheckFeedRepositoryTest(final MemberRepository memberRepository, void 사용자가_해당_골룸에서_오늘_올린_피드의_존재유무를_확인한다() { //given final Member creator = 사용자를_저장한다("cokiri", "코끼리"); - final RoadmapCategory category = 카테고리를_저장한다("여가"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); final Member member = 사용자를_저장한다("participant", "참여자"); - final GoalRoom goalRoom = 골룸을_저장한다(targetRoadmapContent, member); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final GoalRoomMember leader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, creator); final GoalRoomMember joinedMember = new GoalRoomMember(GoalRoomRole.FOLLOWER, LocalDateTime.now(), goalRoom, @@ -110,13 +111,11 @@ public CheckFeedRepositoryTest(final MemberRepository memberRepository, void 사용자가_현재_진행중인_노드에서_인증한_횟수를_확인한다() { //given final Member creator = 사용자를_저장한다("cokiri", "코끼리"); - final RoadmapCategory category = 카테고리를_저장한다("여가"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); final Member member = 사용자를_저장한다("participant", "참여자"); - final GoalRoom goalRoom = 골룸을_저장한다(targetRoadmapContent, member); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final GoalRoomMember leader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, creator); final GoalRoomMember joinedMember = new GoalRoomMember(GoalRoomRole.FOLLOWER, LocalDateTime.now(), goalRoom, @@ -141,13 +140,11 @@ public CheckFeedRepositoryTest(final MemberRepository memberRepository, void 사용자가_골룸에서_등록한_인증_피드_횟수를_확인한다() { //given final Member creator = 사용자를_저장한다("cokiri", "코끼리"); - final RoadmapCategory category = 카테고리를_저장한다("여가"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); final Member member = 사용자를_저장한다("participant", "참여자"); - final GoalRoom goalRoom = 골룸을_저장한다(targetRoadmapContent, member); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final GoalRoomMember leader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, creator); final GoalRoomMember joinedMember = new GoalRoomMember(GoalRoomRole.FOLLOWER, LocalDateTime.now(), goalRoom, @@ -175,14 +172,12 @@ public CheckFeedRepositoryTest(final MemberRepository memberRepository, void 특정_골룸에서_등록된_모든_인증_피드들을_조회한다() { //given final Member creator = 사용자를_저장한다("cokiri", "코끼리"); - final RoadmapCategory category = 카테고리를_저장한다("여가"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); final Member member = 사용자를_저장한다("participant", "참여자"); - final GoalRoom goalRoom1 = 골룸을_저장한다(targetRoadmapContent, creator); - final GoalRoom goalRoom2 = 골룸을_저장한다(targetRoadmapContent, creator); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom1 = 골룸을_저장한다(roadmapContent, creator); + final GoalRoom goalRoom2 = 골룸을_저장한다(roadmapContent, creator); final GoalRoomMember leader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom1, creator); final GoalRoomMember joinedMember = new GoalRoomMember(GoalRoomRole.FOLLOWER, LocalDateTime.now(), goalRoom1, @@ -216,13 +211,11 @@ public CheckFeedRepositoryTest(final MemberRepository memberRepository, void 골룸이_진행중일_때_특정_노드_동안_등록된_인증_피드들을_조회한다() { //given final Member creator = 사용자를_저장한다("cokiri", "코끼리"); - final RoadmapCategory category = 카테고리를_저장한다("여가"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); final Member member = 사용자를_저장한다("participant", "참여자"); - final GoalRoom goalRoom = 골룸을_저장한다(targetRoadmapContent, member); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final GoalRoomMember leader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, creator); final GoalRoomMember joinedMember = new GoalRoomMember(GoalRoomRole.FOLLOWER, LocalDateTime.now(), goalRoom, @@ -259,13 +252,11 @@ public CheckFeedRepositoryTest(final MemberRepository memberRepository, void 진행중인_골룸에서_특정_노드_기간이_아니면_빈_인증_피드들_반환한다() { //given final Member creator = 사용자를_저장한다("cokiri", "코끼리"); - final RoadmapCategory category = 카테고리를_저장한다("여가"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); final Member member = 사용자를_저장한다("participant", "참여자"); - final GoalRoom goalRoom = 골룸을_저장한다(targetRoadmapContent, member); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final GoalRoomMember leader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, creator); final GoalRoomMember joinedMember = new GoalRoomMember(GoalRoomRole.FOLLOWER, LocalDateTime.now(), goalRoom, @@ -293,13 +284,11 @@ public CheckFeedRepositoryTest(final MemberRepository memberRepository, void 골룸이_완료됐을_때는_특정한_노드_동안이_아닌_모든_기간_동안_등록된_인증_피드들을_조회한다() { //given final Member creator = 사용자를_저장한다("cokiri", "코끼리"); - final RoadmapCategory category = 카테고리를_저장한다("여가"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); final Member member = 사용자를_저장한다("participant", "참여자"); - final GoalRoom goalRoom = 골룸을_저장한다(targetRoadmapContent, member); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final GoalRoomMember leader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, creator); final GoalRoomMember joinedMember = new GoalRoomMember(GoalRoomRole.FOLLOWER, LocalDateTime.now(), goalRoom, @@ -338,13 +327,11 @@ public CheckFeedRepositoryTest(final MemberRepository memberRepository, void 골룸_진행_중에_특정_노드_동안_등록된_인증_피드들을_등록한_사용자의_정보와_함께_조회한다() { //given final Member creator = 사용자를_저장한다("cokiri", "코끼리"); - final RoadmapCategory category = 카테고리를_저장한다("여가"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); final Member member = 사용자를_저장한다("participant", "참여자"); - final GoalRoom goalRoom = 골룸을_저장한다(targetRoadmapContent, member); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final GoalRoomMember leader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, creator); final GoalRoomMember joinedMember = new GoalRoomMember(GoalRoomRole.FOLLOWER, LocalDateTime.now(), goalRoom, @@ -397,13 +384,11 @@ public CheckFeedRepositoryTest(final MemberRepository memberRepository, void 골룸_완료_시_모든_기간_동안_등록된_인증_피드들을_등록한_사용자의_정보와_함께_조회한다() { //given final Member creator = 사용자를_저장한다("cokiri", "코끼리"); - final RoadmapCategory category = 카테고리를_저장한다("여가"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); final Member member = 사용자를_저장한다("participant", "참여자"); - final GoalRoom goalRoom = 골룸을_저장한다(targetRoadmapContent, member); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final GoalRoomMember leader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, creator); final GoalRoomMember joinedMember = new GoalRoomMember(GoalRoomRole.FOLLOWER, LocalDateTime.now(), goalRoom, @@ -443,19 +428,23 @@ public CheckFeedRepositoryTest(final MemberRepository memberRepository, return memberRepository.save(creator); } - private RoadmapCategory 카테고리를_저장한다(final String name) { + private RoadmapCategory 카테고리를_생성한다(final String name) { final RoadmapCategory roadmapCategory = new RoadmapCategory(name); return roadmapCategoryRepository.save(roadmapCategory); } - private Roadmap 로드맵을_저장한다(final Member creator, final RoadmapCategory category) { - final List roadmapNodes = 로드맵_노드들을_생성한다(); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmapNodes); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); - roadmap.addContent(roadmapContent); + private Roadmap 로드맵을_저장한다(final String title, final Member creator, final RoadmapCategory category) { + final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); return roadmapRepository.save(roadmap); } + private RoadmapContent 로드맵_본문을_저장한다(final Long roadmapId) { + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId); + final List roadmapNodes = 로드맵_노드들을_생성한다(); + roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); + return roadmapContentRepository.save(roadmapContent); + } + private List 로드맵_노드들을_생성한다() { final RoadmapNode roadmapNode1 = new RoadmapNode("로드맵 1주차", "로드맵 1주차 내용"); roadmapNode1.addImages(new RoadmapNodeImages(노드_이미지들을_생성한다())); @@ -463,12 +452,6 @@ public CheckFeedRepositoryTest(final MemberRepository memberRepository, return List.of(roadmapNode1, roadmapNode2); } - private RoadmapContent 로드맵_본문을_생성한다(final List roadmapNodes) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); - roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); - return roadmapContent; - } - private List 노드_이미지들을_생성한다() { return List.of( new RoadmapNodeImage("node-image1.png", "node-image1-save-path", ImageContentType.PNG), diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepositoryTest.java index 135051064..d940c48a4 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepositoryTest.java @@ -23,13 +23,13 @@ import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; -import co.kirikiri.roadmap.domain.RoadmapContents; import co.kirikiri.roadmap.domain.RoadmapDifficulty; import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodeImage; import co.kirikiri.roadmap.domain.RoadmapNodeImages; import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; +import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; @@ -50,20 +50,23 @@ class GoalRoomMemberRepositoryTest { private static final LocalDate THIRTY_DAY_LATER = TODAY.plusDays(30); private final MemberRepository memberRepository; + private final RoadmapCategoryRepository roadmapCategoryRepository; private final RoadmapRepository roadmapRepository; + private final RoadmapContentRepository roadmapContentRepository; private final GoalRoomRepository goalRoomRepository; - private final RoadmapCategoryRepository roadmapCategoryRepository; private final GoalRoomMemberRepository goalRoomMemberRepository; public GoalRoomMemberRepositoryTest(final MemberRepository memberRepository, + final RoadmapCategoryRepository roadmapCategoryRepository, final RoadmapRepository roadmapRepository, + final RoadmapContentRepository roadmapContentRepository, final GoalRoomRepository goalRoomRepository, - final RoadmapCategoryRepository roadmapCategoryRepository, final GoalRoomMemberRepository goalRoomMemberRepository) { this.memberRepository = memberRepository; + this.roadmapCategoryRepository = roadmapCategoryRepository; this.roadmapRepository = roadmapRepository; + this.roadmapContentRepository = roadmapContentRepository; this.goalRoomRepository = goalRoomRepository; - this.roadmapCategoryRepository = roadmapCategoryRepository; this.goalRoomMemberRepository = goalRoomMemberRepository; } @@ -71,22 +74,18 @@ public GoalRoomMemberRepositoryTest(final MemberRepository memberRepository, void 골룸과_사용자_아이디로_골룸_사용자_목록을_조회한다() { // given final Member creator = 크리에이터를_저장한다(); - final RoadmapCategory category = 카테고리를_저장한다("게임"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - - final GoalRoom goalRoom = 골룸을_생성한다(targetRoadmapContent, creator); - final GoalRoom savedGoalRoom = goalRoomRepository.save(goalRoom); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final GoalRoomMember goalRoomMember = new GoalRoomMember(GoalRoomRole.LEADER, - LocalDateTime.of(2023, 7, 19, 12, 0, 0), savedGoalRoom, creator); + LocalDateTime.of(2023, 7, 19, 12, 0, 0), goalRoom, creator); final GoalRoomMember expected = goalRoomMemberRepository.save(goalRoomMember); // when final Optional findGoalRoomMember = goalRoomMemberRepository.findByGoalRoomAndMemberIdentifier( - savedGoalRoom, new Identifier("cokirikiri")); + goalRoom, new Identifier("cokirikiri")); // then assertThat(findGoalRoomMember.get()) @@ -99,18 +98,14 @@ public GoalRoomMemberRepositoryTest(final MemberRepository memberRepository, void 골룸과_사용자_아이디로_골룸_사용자_목록_조회시_없으면_빈값을_반환한다() { // given final Member creator = 크리에이터를_저장한다(); - final RoadmapCategory category = 카테고리를_저장한다("게임"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - - final GoalRoom goalRoom = 골룸을_생성한다(targetRoadmapContent, creator); - final GoalRoom savedGoalRoom = goalRoomRepository.save(goalRoom); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); // when final Optional findGoalRoomMember = goalRoomMemberRepository.findByGoalRoomAndMemberIdentifier( - savedGoalRoom, new Identifier("cokirikiri2")); + goalRoom, new Identifier("cokirikiri2")); // then assertThat(findGoalRoomMember) @@ -121,25 +116,21 @@ public GoalRoomMemberRepositoryTest(final MemberRepository memberRepository, void 골룸으로_사용자_목록과_멤버를_함께_조회한다() { // given final Member creator = 크리에이터를_저장한다(); - final RoadmapCategory category = 카테고리를_저장한다("게임"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - - final GoalRoom goalRoom = 골룸을_생성한다(targetRoadmapContent, creator); - final GoalRoom savedGoalRoom = goalRoomRepository.save(goalRoom); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final Member member1 = 사용자를_생성한다("identifier1", "password2!", "name1", "kirikiri1@email.com"); final Member member2 = 사용자를_생성한다("identifier2", "password3!", "name2", "kirikiri1@email.com"); final Member member3 = 사용자를_생성한다("identifier3", "password4!", "name3", "kirikiri1@email.com"); final GoalRoomMember goalRoomMember1 = new GoalRoomMember(GoalRoomRole.LEADER, - LocalDateTime.of(2023, 7, 19, 12, 0, 0), savedGoalRoom, member1); + LocalDateTime.of(2023, 7, 19, 12, 0, 0), goalRoom, member1); final GoalRoomMember goalRoomMember2 = new GoalRoomMember(GoalRoomRole.FOLLOWER, - LocalDateTime.of(2023, 7, 20, 12, 0, 0), savedGoalRoom, member2); + LocalDateTime.of(2023, 7, 20, 12, 0, 0), goalRoom, member2); final GoalRoomMember goalRoomMember3 = new GoalRoomMember(GoalRoomRole.FOLLOWER, - LocalDateTime.of(2023, 7, 21, 12, 0, 0), savedGoalRoom, member3); + LocalDateTime.of(2023, 7, 21, 12, 0, 0), goalRoom, member3); final List expected = goalRoomMemberRepository.saveAll( List.of(goalRoomMember1, goalRoomMember2, goalRoomMember3)); @@ -156,31 +147,27 @@ public GoalRoomMemberRepositoryTest(final MemberRepository memberRepository, void 골룸_아이디로_골룸_사용자를_조회하고_들어온지_오래된_순서대로_정렬한다() { // given final Member creator = 크리에이터를_저장한다(); - final RoadmapCategory category = 카테고리를_저장한다("게임"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - - final GoalRoom goalRoom = 골룸을_생성한다(targetRoadmapContent, creator); - final GoalRoom savedGoalRoom = goalRoomRepository.save(goalRoom); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final Member member1 = 사용자를_생성한다("identifier1", "password2!", "name1", "kirikiri1@email.com"); final Member member2 = 사용자를_생성한다("identifier2", "password3!", "name2", "kirikiri1@email.com"); final Member member3 = 사용자를_생성한다("identifier3", "password4!", "name3", "kirikiri1@email.com"); final GoalRoomMember goalRoomMember1 = new GoalRoomMember(GoalRoomRole.LEADER, - LocalDateTime.of(2023, 7, 19, 12, 0, 0), savedGoalRoom, member1); + LocalDateTime.of(2023, 7, 19, 12, 0, 0), goalRoom, member1); final GoalRoomMember goalRoomMember2 = new GoalRoomMember(GoalRoomRole.FOLLOWER, - LocalDateTime.of(2023, 7, 20, 12, 0, 0), savedGoalRoom, member2); + LocalDateTime.of(2023, 7, 20, 12, 0, 0), goalRoom, member2); final GoalRoomMember goalRoomMember3 = new GoalRoomMember(GoalRoomRole.FOLLOWER, - LocalDateTime.of(2023, 7, 21, 12, 0, 0), savedGoalRoom, member3); + LocalDateTime.of(2023, 7, 21, 12, 0, 0), goalRoom, member3); final List expected = goalRoomMemberRepository.saveAll( List.of(goalRoomMember1, goalRoomMember2, goalRoomMember3)); // when final List goalRoomMembers = goalRoomMemberRepository.findByGoalRoomIdOrderedBySortType( - savedGoalRoom.getId(), GoalRoomMemberSortType.JOINED_ASC); + goalRoom.getId(), GoalRoomMemberSortType.JOINED_ASC); // then assertThat(goalRoomMembers) @@ -191,32 +178,28 @@ public GoalRoomMemberRepositoryTest(final MemberRepository memberRepository, void 골룸_아이디로_골룸_사용자를_조회하고_마지막으로_들어온_순서대로_정렬한다() { // given final Member creator = 크리에이터를_저장한다(); - final RoadmapCategory category = 카테고리를_저장한다("게임"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - - final GoalRoom goalRoom = 골룸을_생성한다(targetRoadmapContent, creator); - final GoalRoom savedGoalRoom = goalRoomRepository.save(goalRoom); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final Member member1 = 사용자를_생성한다("identifier1", "password2!", "name1", "kirikiri1@email.com"); final Member member2 = 사용자를_생성한다("identifier2", "password3!", "name2", "kirikiri1@email.com"); final Member member3 = 사용자를_생성한다("identifier3", "password4!", "name3", "kirikiri1@email.com"); final GoalRoomMember goalRoomMember1 = new GoalRoomMember(GoalRoomRole.LEADER, - LocalDateTime.of(2023, 7, 19, 12, 0, 0), savedGoalRoom, member1); + LocalDateTime.of(2023, 7, 19, 12, 0, 0), goalRoom, member1); final GoalRoomMember goalRoomMember2 = new GoalRoomMember(GoalRoomRole.FOLLOWER, - LocalDateTime.of(2023, 7, 20, 12, 0, 0), savedGoalRoom, member2); + LocalDateTime.of(2023, 7, 20, 12, 0, 0), goalRoom, member2); final GoalRoomMember goalRoomMember3 = new GoalRoomMember(GoalRoomRole.FOLLOWER, - LocalDateTime.of(2023, 7, 21, 12, 0, 0), savedGoalRoom, member3); + LocalDateTime.of(2023, 7, 21, 12, 0, 0), goalRoom, member3); final GoalRoomMember savedGoalRoomMember1 = goalRoomMemberRepository.save(goalRoomMember1); final GoalRoomMember savedGoalRoomMember2 = goalRoomMemberRepository.save(goalRoomMember2); final GoalRoomMember savedGoalRoomMember3 = goalRoomMemberRepository.save(goalRoomMember3); // when final List goalRoomMembers = goalRoomMemberRepository.findByGoalRoomIdOrderedBySortType( - savedGoalRoom.getId(), GoalRoomMemberSortType.JOINED_DESC); + goalRoom.getId(), GoalRoomMemberSortType.JOINED_DESC); // then assertThat(goalRoomMembers) @@ -227,36 +210,32 @@ public GoalRoomMemberRepositoryTest(final MemberRepository memberRepository, void 골룸_아이디로_골룸_사용자를_조회하고_달성률이_높은_순대로_정렬한다() { // given final Member creator = 크리에이터를_저장한다(); - final RoadmapCategory category = 카테고리를_저장한다("게임"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - - final GoalRoom goalRoom = 골룸을_생성한다(targetRoadmapContent, creator); - final GoalRoom savedGoalRoom = goalRoomRepository.save(goalRoom); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final Member member1 = 사용자를_생성한다("identifier1", "password2!", "name1", "kirikiri1@email.com"); final Member member2 = 사용자를_생성한다("identifier2", "password3!", "name2", "kirikiri1@email.com"); final Member member3 = 사용자를_생성한다("identifier3", "password4!", "name3", "kirikiri1@email.com"); final GoalRoomMember goalRoomMember1 = new GoalRoomMember(GoalRoomRole.LEADER, - LocalDateTime.of(2023, 7, 19, 12, 0, 0), savedGoalRoom, member1); + LocalDateTime.of(2023, 7, 19, 12, 0, 0), goalRoom, member1); goalRoomMember1.updateAccomplishmentRate(30.0); final GoalRoomMember goalRoomMember2 = new GoalRoomMember(GoalRoomRole.FOLLOWER, - LocalDateTime.of(2023, 7, 20, 12, 0, 0), savedGoalRoom, member2); + LocalDateTime.of(2023, 7, 20, 12, 0, 0), goalRoom, member2); goalRoomMember2.updateAccomplishmentRate(70.0); final GoalRoomMember goalRoomMember3 = new GoalRoomMember(GoalRoomRole.FOLLOWER, - LocalDateTime.of(2023, 7, 21, 12, 0, 0), savedGoalRoom, member3); + LocalDateTime.of(2023, 7, 21, 12, 0, 0), goalRoom, member3); goalRoomMember3.updateAccomplishmentRate(10.0); final List expected = goalRoomMemberRepository.saveAll( List.of(goalRoomMember2, goalRoomMember1, goalRoomMember3)); // when final List goalRoomMembers1 = goalRoomMemberRepository.findByGoalRoomIdOrderedBySortType( - savedGoalRoom.getId(), GoalRoomMemberSortType.ACCOMPLISHMENT_RATE); + goalRoom.getId(), GoalRoomMemberSortType.ACCOMPLISHMENT_RATE); final List goalRoomMembers2 = goalRoomMemberRepository.findByGoalRoomIdOrderedBySortType( - savedGoalRoom.getId(), null); + goalRoom.getId(), null); // then assertThat(goalRoomMembers1) @@ -268,15 +247,11 @@ public GoalRoomMemberRepositoryTest(final MemberRepository memberRepository, @Test void 골룸_아이디와_사용자_아이디로_골룸_멤버를_조회한다() { // given - final Member creator = 사용자를_생성한다("identifier1", "password!1", "name1", "kirikiri1@email.com"); - final RoadmapCategory category = 카테고리를_저장한다("여가"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - - final GoalRoom goalRoom = 골룸을_생성한다(targetRoadmapContent, creator); - goalRoomRepository.save(goalRoom); + final Member creator = 크리에이터를_저장한다(); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final GoalRoomMember goalRoomMember = new GoalRoomMember( GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, creator @@ -311,11 +286,23 @@ public GoalRoomMemberRepositoryTest(final MemberRepository memberRepository, return memberRepository.save(member); } - private RoadmapCategory 카테고리를_저장한다(final String name) { + private RoadmapCategory 카테고리를_생성한다(final String name) { final RoadmapCategory roadmapCategory = new RoadmapCategory(name); return roadmapCategoryRepository.save(roadmapCategory); } + private Roadmap 로드맵을_저장한다(final String title, final Member creator, final RoadmapCategory category) { + final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); + return roadmapRepository.save(roadmap); + } + + private RoadmapContent 로드맵_본문을_저장한다(final Long roadmapId) { + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId); + final List roadmapNodes = 로드맵_노드들을_생성한다(); + roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); + return roadmapContentRepository.save(roadmapContent); + } + private List 로드맵_노드들을_생성한다() { final RoadmapNode roadmapNode1 = new RoadmapNode("로드맵 1주차", "로드맵 1주차 내용"); roadmapNode1.addImages(new RoadmapNodeImages(노드_이미지들을_생성한다())); @@ -323,12 +310,6 @@ public GoalRoomMemberRepositoryTest(final MemberRepository memberRepository, return List.of(roadmapNode1, roadmapNode2); } - private RoadmapContent 로드맵_본문을_생성한다(final List roadmapNodes) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); - roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); - return roadmapContent; - } - private List 노드_이미지들을_생성한다() { return List.of( new RoadmapNodeImage("node-image1.png", "node-image1-save-path", ImageContentType.PNG), @@ -336,15 +317,7 @@ public GoalRoomMemberRepositoryTest(final MemberRepository memberRepository, ); } - private Roadmap 로드맵을_저장한다(final Member creator, final RoadmapCategory category) { - final List roadmapNodes = 로드맵_노드들을_생성한다(); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmapNodes); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); - roadmap.addContent(roadmapContent); - return roadmapRepository.save(roadmap); - } - - private GoalRoom 골룸을_생성한다(final RoadmapContent roadmapContent, final Member member) { + private GoalRoom 골룸을_저장한다(final RoadmapContent roadmapContent, final Member member) { final GoalRoom goalRoom = new GoalRoom(new GoalRoomName("골룸"), new LimitedMemberCount(10), roadmapContent, member); final List roadmapNodes = roadmapContent.getNodes().getValues(); @@ -361,6 +334,6 @@ public GoalRoomMemberRepositoryTest(final MemberRepository memberRepository, final GoalRoomRoadmapNodes goalRoomRoadmapNodes = new GoalRoomRoadmapNodes( List.of(firstGoalRoomRoadmapNode, secondGoalRoomRoadmapNode)); goalRoom.addAllGoalRoomRoadmapNodes(goalRoomRoadmapNodes); - return goalRoom; + return goalRoomRepository.save(goalRoom); } } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepositoryTest.java index 58d070140..e5e721bdf 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepositoryTest.java @@ -23,13 +23,13 @@ import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; -import co.kirikiri.roadmap.domain.RoadmapContents; import co.kirikiri.roadmap.domain.RoadmapDifficulty; import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodeImage; import co.kirikiri.roadmap.domain.RoadmapNodeImages; import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; +import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -50,19 +50,22 @@ class GoalRoomPendingMemberRepositoryTest { private static final LocalDate THIRTY_DAY_LATER = TODAY.plusDays(30); private final MemberRepository memberRepository; + private final RoadmapCategoryRepository roadmapCategoryRepository; private final RoadmapRepository roadmapRepository; + private final RoadmapContentRepository roadmapContentRepository; private final GoalRoomRepository goalRoomRepository; - private final RoadmapCategoryRepository roadmapCategoryRepository; private final GoalRoomPendingMemberRepository goalRoomPendingMemberRepository; public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberRepository, final RoadmapCategoryRepository roadmapCategoryRepository, final RoadmapRepository roadmapRepository, + final RoadmapContentRepository roadmapContentRepository, final GoalRoomRepository goalRoomRepository, final GoalRoomPendingMemberRepository goalRoomPendingMemberRepository) { this.memberRepository = memberRepository; this.roadmapCategoryRepository = roadmapCategoryRepository; this.roadmapRepository = roadmapRepository; + this.roadmapContentRepository = roadmapContentRepository; this.goalRoomRepository = goalRoomRepository; this.goalRoomPendingMemberRepository = goalRoomPendingMemberRepository; } @@ -71,21 +74,17 @@ public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberReposito void 골룸과_사용자_아이디로_골룸_사용자_대기_목록을_조회한다() { // given final Member creator = 크리에이터를_저장한다(); - final RoadmapCategory category = 카테고리를_저장한다("게임"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - - final GoalRoom goalRoom = 골룸을_생성한다(targetRoadmapContent, creator); - final GoalRoom savedGoalRoom = goalRoomRepository.save(goalRoom); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final GoalRoomPendingMember expected = new GoalRoomPendingMember(GoalRoomRole.LEADER, - LocalDateTime.of(2023, 7, 19, 12, 0, 0), savedGoalRoom, creator); + LocalDateTime.of(2023, 7, 19, 12, 0, 0), goalRoom, creator); // when final Optional findGoalRoomPendingMember = goalRoomPendingMemberRepository.findByGoalRoomAndMemberIdentifier( - savedGoalRoom, new Identifier("cokirikiri")); + goalRoom, new Identifier("cokirikiri")); // then assertThat(findGoalRoomPendingMember.get()) @@ -98,18 +97,14 @@ public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberReposito void 골룸과_사용자_아이디로_골룸_사용자_대기_목록_조회시_없으면_빈값을_반환한다() { // given final Member creator = 크리에이터를_저장한다(); - final RoadmapCategory category = 카테고리를_저장한다("게임"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - - final GoalRoom goalRoom = 골룸을_생성한다(targetRoadmapContent, creator); - final GoalRoom savedGoalRoom = goalRoomRepository.save(goalRoom); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); // when final Optional findGoalRoomPendingMember = goalRoomPendingMemberRepository.findByGoalRoomAndMemberIdentifier( - savedGoalRoom, new Identifier("cokirikiri2")); + goalRoom, new Identifier("cokirikiri2")); // then assertThat(findGoalRoomPendingMember) @@ -120,27 +115,23 @@ public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberReposito void 골룸으로_사용자_대기_목록과_멤버를_함께_조회한다() { // given final Member creator = 크리에이터를_저장한다(); - final RoadmapCategory category = 카테고리를_저장한다("게임"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - - final GoalRoom goalRoom = 골룸을_생성한다(targetRoadmapContent, creator); - final GoalRoom savedGoalRoom = goalRoomRepository.save(goalRoom); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final Member member1 = 사용자를_생성한다("identifier1", "password2!", "name1", "kirikiri1@email.com"); final Member member2 = 사용자를_생성한다("identifier2", "password3!", "name2", "kirikiri1@email.com"); final Member member3 = 사용자를_생성한다("identifier3", "password4!", "name3", "kirikiri1@email.com"); final GoalRoomPendingMember goalRoomPendingMember = new GoalRoomPendingMember(GoalRoomRole.LEADER, - LocalDateTime.now(), savedGoalRoom, creator); + LocalDateTime.now(), goalRoom, creator); final GoalRoomPendingMember goalRoomPendingMember1 = new GoalRoomPendingMember(GoalRoomRole.FOLLOWER, - LocalDateTime.now(), savedGoalRoom, member1); + LocalDateTime.now(), goalRoom, member1); final GoalRoomPendingMember goalRoomPendingMember2 = new GoalRoomPendingMember(GoalRoomRole.FOLLOWER, - LocalDateTime.now(), savedGoalRoom, member2); + LocalDateTime.now(), goalRoom, member2); final GoalRoomPendingMember goalRoomPendingMember3 = new GoalRoomPendingMember(GoalRoomRole.FOLLOWER, - LocalDateTime.now(), savedGoalRoom, member3); + LocalDateTime.now(), goalRoom, member3); goalRoomPendingMemberRepository.saveAll( List.of(goalRoomPendingMember1, goalRoomPendingMember2, goalRoomPendingMember3)); @@ -162,17 +153,15 @@ public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberReposito void 골룸에_참가한다() { //given final Member creator = 크리에이터를_저장한다(); - final RoadmapCategory category = 카테고리를_저장한다("게임"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(targetRoadmapContent, creator); - final GoalRoom savedGoalRoom = goalRoomRepository.save(goalRoom); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final Member follower = 사용자를_생성한다("identifier2", "password!2", "name", "kirikiri1@email.com"); //when - savedGoalRoom.join(follower); + goalRoom.join(follower); //then final List goalRoomPendingMembers = goalRoomPendingMemberRepository.findByGoalRoom( @@ -192,14 +181,10 @@ public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberReposito void 골룸_아이디로_골룸_사용자를_조회하고_들어온지_오래된_순서대로_정렬한다() { // given final Member creator = 크리에이터를_저장한다(); - final RoadmapCategory category = 카테고리를_저장한다("게임"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - - final GoalRoom goalRoom = 골룸을_생성한다(targetRoadmapContent, creator); - final GoalRoom savedGoalRoom = goalRoomRepository.save(goalRoom); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final Member member1 = 사용자를_생성한다("identifier1", "password2!", "name1", "kirikiri1@email.com"); final Member member2 = 사용자를_생성한다("identifier2", "password3!", "name2", "kirikiri1@email.com"); @@ -207,11 +192,11 @@ public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberReposito final GoalRoomPendingMember goalRoomPendingMember0 = goalRoom.getGoalRoomPendingMembers().getValues().get(0); final GoalRoomPendingMember goalRoomPendingMember1 = new GoalRoomPendingMember(GoalRoomRole.FOLLOWER, - LocalDateTime.now(), savedGoalRoom, member1); + LocalDateTime.now(), goalRoom, member1); final GoalRoomPendingMember goalRoomPendingMember2 = new GoalRoomPendingMember(GoalRoomRole.FOLLOWER, - LocalDateTime.now(), savedGoalRoom, member2); + LocalDateTime.now(), goalRoom, member2); final GoalRoomPendingMember goalRoomPendingMember3 = new GoalRoomPendingMember(GoalRoomRole.FOLLOWER, - LocalDateTime.now(), savedGoalRoom, member3); + LocalDateTime.now(), goalRoom, member3); goalRoomPendingMemberRepository.saveAll( List.of(goalRoomPendingMember1, goalRoomPendingMember2, goalRoomPendingMember3)); final List expected = List.of(goalRoomPendingMember0, goalRoomPendingMember1, @@ -219,7 +204,7 @@ public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberReposito // when final List goalRoomPendingMembers = goalRoomPendingMemberRepository.findByGoalRoomIdOrderedBySortType( - savedGoalRoom.getId(), GoalRoomMemberSortType.JOINED_ASC); + goalRoom.getId(), GoalRoomMemberSortType.JOINED_ASC); // then assertThat(goalRoomPendingMembers) @@ -230,14 +215,10 @@ public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberReposito void 골룸_아이디로_골룸_사용자를_조회하고_마지막으로_들어온_순서대로_정렬한다() { // given final Member creator = 크리에이터를_저장한다(); - final RoadmapCategory category = 카테고리를_저장한다("게임"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - - final GoalRoom goalRoom = 골룸을_생성한다(targetRoadmapContent, creator); - final GoalRoom savedGoalRoom = goalRoomRepository.save(goalRoom); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final Member member1 = 사용자를_생성한다("identifier1", "password2!", "name1", "kirikiri1@email.com"); final Member member2 = 사용자를_생성한다("identifier2", "password3!", "name2", "kirikiri1@email.com"); @@ -245,11 +226,11 @@ public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberReposito final GoalRoomPendingMember goalRoomPendingMember0 = goalRoom.getGoalRoomPendingMembers().getValues().get(0); final GoalRoomPendingMember goalRoomPendingMember1 = new GoalRoomPendingMember(GoalRoomRole.LEADER, - LocalDateTime.now(), savedGoalRoom, member1); + LocalDateTime.now(), goalRoom, member1); final GoalRoomPendingMember goalRoomPendingMember2 = new GoalRoomPendingMember(GoalRoomRole.FOLLOWER, - LocalDateTime.now(), savedGoalRoom, member2); + LocalDateTime.now(), goalRoom, member2); final GoalRoomPendingMember goalRoomPendingMember3 = new GoalRoomPendingMember(GoalRoomRole.FOLLOWER, - LocalDateTime.now(), savedGoalRoom, member3); + LocalDateTime.now(), goalRoom, member3); final GoalRoomPendingMember savedGoalRoomPendingMember1 = goalRoomPendingMemberRepository.save( goalRoomPendingMember1); final GoalRoomPendingMember savedGoalRoomPendingMember2 = goalRoomPendingMemberRepository.save( @@ -261,7 +242,7 @@ public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberReposito // when final List goalRoomPendingMembers = goalRoomPendingMemberRepository.findByGoalRoomIdOrderedBySortType( - savedGoalRoom.getId(), GoalRoomMemberSortType.JOINED_DESC); + goalRoom.getId(), GoalRoomMemberSortType.JOINED_DESC); // then assertThat(goalRoomPendingMembers) @@ -272,14 +253,10 @@ public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberReposito void 골룸_아이디로_골룸_사용자를_조회하고_정렬조건을_달성률순_또는_입력하지_않은경우_참여한순으로_정렬한다() { // given final Member creator = 크리에이터를_저장한다(); - final RoadmapCategory category = 카테고리를_저장한다("게임"); - final Roadmap roadmap = 로드맵을_저장한다(creator, category); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - - final GoalRoom goalRoom = 골룸을_생성한다(targetRoadmapContent, creator); - final GoalRoom savedGoalRoom = goalRoomRepository.save(goalRoom); + final RoadmapCategory category = 카테고리를_생성한다("여행"); + final Roadmap roadmap = 로드맵을_저장한다("title", creator, category); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_저장한다(roadmapContent, creator); final Member member1 = 사용자를_생성한다("identifier1", "password2!", "name1", "kirikiri1@email.com"); final Member member2 = 사용자를_생성한다("identifier2", "password3!", "name2", "kirikiri1@email.com"); @@ -287,11 +264,11 @@ public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberReposito final GoalRoomPendingMember goalRoomPendingMember0 = goalRoom.getGoalRoomPendingMembers().getValues().get(0); final GoalRoomPendingMember goalRoomPendingMember1 = new GoalRoomPendingMember(GoalRoomRole.LEADER, - LocalDateTime.now(), savedGoalRoom, member1); + LocalDateTime.now(), goalRoom, member1); final GoalRoomPendingMember goalRoomPendingMember2 = new GoalRoomPendingMember(GoalRoomRole.FOLLOWER, - LocalDateTime.now(), savedGoalRoom, member2); + LocalDateTime.now(), goalRoom, member2); final GoalRoomPendingMember goalRoomPendingMember3 = new GoalRoomPendingMember(GoalRoomRole.FOLLOWER, - LocalDateTime.now(), savedGoalRoom, member3); + LocalDateTime.now(), goalRoom, member3); goalRoomPendingMemberRepository.saveAll( List.of(goalRoomPendingMember1, goalRoomPendingMember2, goalRoomPendingMember3)); final List expected = List.of(goalRoomPendingMember0, goalRoomPendingMember1, @@ -299,9 +276,9 @@ public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberReposito // when final List goalRoomPendingMembers1 = goalRoomPendingMemberRepository.findByGoalRoomIdOrderedBySortType( - savedGoalRoom.getId(), GoalRoomMemberSortType.ACCOMPLISHMENT_RATE); + goalRoom.getId(), GoalRoomMemberSortType.ACCOMPLISHMENT_RATE); final List goalRoomPendingMembers2 = goalRoomPendingMemberRepository.findByGoalRoomIdOrderedBySortType( - savedGoalRoom.getId(), null); + goalRoom.getId(), null); // then assertThat(goalRoomPendingMembers1) @@ -327,19 +304,23 @@ public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberReposito return memberRepository.save(member); } - private RoadmapCategory 카테고리를_저장한다(final String name) { + private RoadmapCategory 카테고리를_생성한다(final String name) { final RoadmapCategory roadmapCategory = new RoadmapCategory(name); return roadmapCategoryRepository.save(roadmapCategory); } - private Roadmap 로드맵을_저장한다(final Member creator, final RoadmapCategory category) { - final List roadmapNodes = 로드맵_노드들을_생성한다(); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmapNodes); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); - roadmap.addContent(roadmapContent); + private Roadmap 로드맵을_저장한다(final String title, final Member creator, final RoadmapCategory category) { + final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); return roadmapRepository.save(roadmap); } + private RoadmapContent 로드맵_본문을_저장한다(final Long roadmapId) { + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId); + final List roadmapNodes = 로드맵_노드들을_생성한다(); + roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); + return roadmapContentRepository.save(roadmapContent); + } + private List 로드맵_노드들을_생성한다() { final RoadmapNode roadmapNode1 = new RoadmapNode("로드맵 1주차", "로드맵 1주차 내용"); roadmapNode1.addImages(new RoadmapNodeImages(노드_이미지들을_생성한다())); @@ -347,12 +328,6 @@ public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberReposito return List.of(roadmapNode1, roadmapNode2); } - private RoadmapContent 로드맵_본문을_생성한다(final List roadmapNodes) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); - roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); - return roadmapContent; - } - private List 노드_이미지들을_생성한다() { return List.of( new RoadmapNodeImage("node-image1.png", "node-image1-save-path", ImageContentType.PNG), @@ -360,7 +335,7 @@ public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberReposito ); } - private GoalRoom 골룸을_생성한다(final RoadmapContent roadmapContent, final Member member) { + private GoalRoom 골룸을_저장한다(final RoadmapContent roadmapContent, final Member member) { final GoalRoom goalRoom = new GoalRoom(new GoalRoomName("골룸"), new LimitedMemberCount(10), roadmapContent, member); final List roadmapNodes = roadmapContent.getNodes().getValues(); @@ -378,6 +353,6 @@ public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberReposito final GoalRoomRoadmapNodes goalRoomRoadmapNodes = new GoalRoomRoadmapNodes( List.of(firstGoalRoomRoadmapNode, secondGoalRoomRoadmapNode)); goalRoom.addAllGoalRoomRoadmapNodes(goalRoomRoadmapNodes); - return goalRoom; + return goalRoomRepository.save(goalRoom); } } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomRepositoryTest.java index efd69497a..541c82644 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomRepositoryTest.java @@ -26,6 +26,7 @@ import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; +import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import org.junit.jupiter.api.Test; @@ -44,18 +45,21 @@ class GoalRoomRepositoryTest { private static final LocalDate THIRTY_DAY_LATER = TODAY.plusDays(30); private final MemberRepository memberRepository; + private final RoadmapCategoryRepository roadmapCategoryRepository; private final RoadmapRepository roadmapRepository; + private final RoadmapContentRepository roadmapContentRepository; private final GoalRoomRepository goalRoomRepository; - private final RoadmapCategoryRepository roadmapCategoryRepository; public GoalRoomRepositoryTest(final MemberRepository memberRepository, + final RoadmapCategoryRepository roadmapCategoryRepository, final RoadmapRepository roadmapRepository, - final GoalRoomRepository goalRoomRepository, - final RoadmapCategoryRepository roadmapCategoryRepository) { + final RoadmapContentRepository roadmapContentRepository, + final GoalRoomRepository goalRoomRepository) { this.memberRepository = memberRepository; + this.roadmapCategoryRepository = roadmapCategoryRepository; this.roadmapRepository = roadmapRepository; + this.roadmapContentRepository = roadmapContentRepository; this.goalRoomRepository = goalRoomRepository; - this.roadmapCategoryRepository = roadmapCategoryRepository; } @Test @@ -63,10 +67,11 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, //given final Member creator = 사용자를_생성한다("name1", "kirikiri@email.com", "identifier1", "password!1"); final RoadmapCategory category = 카테고리를_저장한다("여가"); + final Roadmap roadmap = 로드맵을_저장한다(creator, category); + final RoadmapNode roadmapNode1 = 로드맵_노드를_생성한다("로드맵 1주차", "로드맵 1주차 내용"); final RoadmapNode roadmapNode2 = 로드맵_노드를_생성한다("로드맵 2주차", "로드맵 2주차 내용"); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(List.of(roadmapNode1, roadmapNode2)); - 로드맵을_생성한다(creator, category, roadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(List.of(roadmapNode1, roadmapNode2), roadmap.getId()); final GoalRoomRoadmapNode goalRoomRoadmapNode1 = 골룸_로드맵_노드를_생성한다(TODAY, TODAY.plusDays(10), roadmapNode1); @@ -93,10 +98,11 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, //given final Member creator = 사용자를_생성한다("name1", "kirikiri@email.com", "identifier1", "password!1"); final RoadmapCategory category = 카테고리를_저장한다("여가"); + final Roadmap roadmap = 로드맵을_저장한다(creator, category); + final RoadmapNode roadmapNode1 = 로드맵_노드를_생성한다("로드맵 1주차", "로드맵 1주차 내용"); final RoadmapNode roadmapNode2 = 로드맵_노드를_생성한다("로드맵 2주차", "로드맵 2주차 내용"); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(List.of(roadmapNode1, roadmapNode2)); - final Roadmap roadmap = 로드맵을_생성한다(creator, category, roadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(List.of(roadmapNode1, roadmapNode2), roadmap.getId()); final GoalRoomRoadmapNode goalRoomRoadmapNode1 = 골룸_로드맵_노드를_생성한다(TODAY, TODAY.plusDays(10), roadmapNode1); @@ -117,9 +123,9 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, goalRoomRepository.save(goalRoom2); // when - final List goalRooms1 = goalRoomRepository.findGoalRoomsByRoadmapAndCond(roadmap, + final List goalRooms1 = goalRoomRepository.findGoalRoomsByRoadmapIdAndCond(roadmap.getId(), RoadmapGoalRoomsOrderType.LATEST, null, 1); - final List goalRooms2 = goalRoomRepository.findGoalRoomsByRoadmapAndCond(roadmap, + final List goalRooms2 = goalRoomRepository.findGoalRoomsByRoadmapIdAndCond(roadmap.getId(), RoadmapGoalRoomsOrderType.LATEST, goalRoom2.getId(), 10); assertThat(goalRooms1) @@ -133,10 +139,11 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, //given final Member creator = 사용자를_생성한다("name1", "kirikiri@email.com", "identifier1", "password!1"); final RoadmapCategory category = 카테고리를_저장한다("여가"); + final Roadmap roadmap = 로드맵을_저장한다(creator, category); + final RoadmapNode roadmapNode1 = 로드맵_노드를_생성한다("로드맵 1주차", "로드맵 1주차 내용"); final RoadmapNode roadmapNode2 = 로드맵_노드를_생성한다("로드맵 2주차", "로드맵 2주차 내용"); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(List.of(roadmapNode1, roadmapNode2)); - final Roadmap roadmap = 로드맵을_생성한다(creator, category, roadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(List.of(roadmapNode1, roadmapNode2), roadmap.getId()); final GoalRoomRoadmapNode goalRoomRoadmapNode1 = 골룸_로드맵_노드를_생성한다(TODAY, TODAY.plusDays(10), roadmapNode1); final GoalRoomRoadmapNode goalRoomRoadmapNode2 = 골룸_로드맵_노드를_생성한다(TODAY.plusDays(11), TODAY.plusDays(20), @@ -156,9 +163,9 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, goalRoomRepository.save(goalRoom2); // when - final List goalRooms1 = goalRoomRepository.findGoalRoomsByRoadmapAndCond(roadmap, + final List goalRooms1 = goalRoomRepository.findGoalRoomsByRoadmapIdAndCond(roadmap.getId(), RoadmapGoalRoomsOrderType.CLOSE_TO_DEADLINE, null, 1); - final List goalRooms2 = goalRoomRepository.findGoalRoomsByRoadmapAndCond(roadmap, + final List goalRooms2 = goalRoomRepository.findGoalRoomsByRoadmapIdAndCond(roadmap.getId(), RoadmapGoalRoomsOrderType.CLOSE_TO_DEADLINE, goalRoom1.getId(), 10); // then @@ -171,9 +178,10 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, // given final Member creator = 크리에이터를_저장한다(); final RoadmapCategory category = 카테고리를_저장한다("게임"); + final Roadmap roadmap = 로드맵을_저장한다(creator, category); + final RoadmapNode roadmapNode1 = 로드맵_노드를_생성한다("로드맵 1주차", "로드맵 1주차 내용"); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(List.of(roadmapNode1)); - 로드맵을_생성한다(creator, category, roadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(List.of(roadmapNode1), roadmap.getId()); final GoalRoomRoadmapNode goalRoomRoadmapNode1 = 골룸_로드맵_노드를_생성한다(TODAY, TODAY.plusDays(10), roadmapNode1); @@ -207,10 +215,11 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, void 투두리스트와_함께_골룸을_조회한다() { final Member creator = 사용자를_생성한다("name1", "kirikiri@email.com", "identifier1", "password!1"); final RoadmapCategory category = 카테고리를_저장한다("여가"); + final Roadmap roadmap = 로드맵을_저장한다(creator, category); + final RoadmapNode roadmapNode1 = 로드맵_노드를_생성한다("로드맵 1주차", "로드맵 1주차 내용"); final RoadmapNode roadmapNode2 = 로드맵_노드를_생성한다("로드맵 2주차", "로드맵 2주차 내용"); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(List.of(roadmapNode1, roadmapNode2)); - 로드맵을_생성한다(creator, category, roadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(List.of(roadmapNode1, roadmapNode2), roadmap.getId()); final GoalRoomRoadmapNode goalRoomRoadmapNode1 = 골룸_로드맵_노드를_생성한다(TODAY, TODAY.plusDays(10), roadmapNode1); @@ -244,9 +253,10 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, void 골룸_아이디로_골룸과_로드맵컨텐츠_골룸노드_투두_정보를_조회한다() { final Member creator = 크리에이터를_저장한다(); final RoadmapCategory category = 카테고리를_저장한다("게임"); + final Roadmap roadmap = 로드맵을_저장한다(creator, category); + final RoadmapNode roadmapNode = 로드맵_노드를_생성한다("로드맵 1주차", "로드맵 1주차 내용"); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(List.of(roadmapNode)); - 로드맵을_생성한다(creator, category, roadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(List.of(roadmapNode), roadmap.getId()); final GoalRoomRoadmapNode goalRoomRoadmapNode1 = 골룸_로드맵_노드를_생성한다(TODAY, TODAY.plusDays(10), roadmapNode); @@ -291,9 +301,10 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, //given final Member creator = 크리에이터를_저장한다(); final RoadmapCategory category = 카테고리를_저장한다("게임"); + final Roadmap roadmap = 로드맵을_저장한다(creator, category); + final RoadmapNode roadmapNode1 = 로드맵_노드를_생성한다("로드맵 1주차", "로드맵 1주차 내용"); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(List.of(roadmapNode1)); - 로드맵을_생성한다(creator, category, roadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(List.of(roadmapNode1), roadmap.getId()); final GoalRoomRoadmapNode goalRoomRoadmapNode1 = 골룸_로드맵_노드를_생성한다(TODAY, TODAY.plusDays(10), roadmapNode1); @@ -310,8 +321,8 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, new GoalRoomRoadmapNodes(List.of(goalRoomRoadmapNode2)), creator); final GoalRoom goalRoom3 = 골룸을_생성한다("goalroom3", 20, roadmapContent, new GoalRoomRoadmapNodes(List.of(goalRoomRoadmapNode3)), creator); - final GoalRoom goalRoom4 = 골룸을_생성한다("goalroom3", 20, roadmapContent, - new GoalRoomRoadmapNodes(List.of(goalRoomRoadmapNode3)), creator); + final GoalRoom goalRoom4 = 골룸을_생성한다("goalroom4", 20, roadmapContent, + new GoalRoomRoadmapNodes(List.of(goalRoomRoadmapNode4)), creator); final Member member = 사용자를_생성한다("팔로워", "010-111-1111", "identifier2", "password2@"); goalRoom1.join(member); @@ -345,9 +356,10 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, //given final Member creator = 크리에이터를_저장한다(); final RoadmapCategory category = 카테고리를_저장한다("게임"); + final Roadmap roadmap = 로드맵을_저장한다(creator, category); + final RoadmapNode roadmapNode1 = 로드맵_노드를_생성한다("로드맵 1주차", "로드맵 1주차 내용"); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(List.of(roadmapNode1)); - 로드맵을_생성한다(creator, category, roadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(List.of(roadmapNode1), roadmap.getId()); final GoalRoomRoadmapNode goalRoomRoadmapNode1 = 골룸_로드맵_노드를_생성한다(TODAY, TODAY.plusDays(10), roadmapNode1); @@ -364,8 +376,8 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, new GoalRoomRoadmapNodes(List.of(goalRoomRoadmapNode2)), creator); final GoalRoom goalRoom3 = 골룸을_생성한다("goalroom3", 20, roadmapContent, new GoalRoomRoadmapNodes(List.of(goalRoomRoadmapNode3)), creator); - final GoalRoom goalRoom4 = 골룸을_생성한다("goalroom3", 20, roadmapContent, - new GoalRoomRoadmapNodes(List.of(goalRoomRoadmapNode3)), creator); + final GoalRoom goalRoom4 = 골룸을_생성한다("goalroom4", 20, roadmapContent, + new GoalRoomRoadmapNodes(List.of(goalRoomRoadmapNode4)), creator); final Member member = 사용자를_생성한다("팔로워", "010-111-1111", "identifier2", "password2@"); goalRoom1.join(member); @@ -406,10 +418,11 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, void 노드와_함께_골룸을_조회한다() { final Member creator = 사용자를_생성한다("name1", "kirikiri@email.com", "identifier1", "password!1"); final RoadmapCategory category = 카테고리를_저장한다("여가"); + final Roadmap roadmap = 로드맵을_저장한다(creator, category); + final RoadmapNode roadmapNode1 = 로드맵_노드를_생성한다("로드맵 1주차", "로드맵 1주차 내용"); final RoadmapNode roadmapNode2 = 로드맵_노드를_생성한다("로드맵 2주차", "로드맵 2주차 내용"); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(List.of(roadmapNode1, roadmapNode2)); - 로드맵을_생성한다(creator, category, roadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(List.of(roadmapNode1, roadmapNode2), roadmap.getId()); final GoalRoomRoadmapNode goalRoomRoadmapNode1 = 골룸_로드맵_노드를_생성한다(TODAY, TODAY.plusDays(10), roadmapNode1); @@ -435,9 +448,10 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, //given final Member creator = 크리에이터를_저장한다(); final RoadmapCategory category = 카테고리를_저장한다("게임"); + final Roadmap roadmap = 로드맵을_저장한다(creator, category); + final RoadmapNode roadmapNode = 로드맵_노드를_생성한다("로드맵 1주차", "로드맵 1주차 내용"); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(List.of(roadmapNode)); - final Roadmap roadmap = 로드맵을_생성한다(creator, category, roadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(List.of(roadmapNode), roadmap.getId()); final GoalRoomRoadmapNode goalRoomRoadmapNode1 = 골룸_로드맵_노드를_생성한다(TODAY, TEN_DAY_LATER, roadmapNode); @@ -455,7 +469,7 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, goalRoomRepository.save(goalRoom3); // when - final List goalRooms = goalRoomRepository.findByRoadmap(roadmap); + final List goalRooms = goalRoomRepository.findByRoadmapId(roadmap.getId()); // then assertThat(goalRooms) @@ -467,17 +481,16 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, // given final Member creator = 사용자를_생성한다("name1", "kirikiri@email.com", "identifier1", "password!1"); final RoadmapCategory category = 카테고리를_저장한다("여가"); + + final Roadmap roadmap1 = 로드맵을_저장한다(creator, category); final RoadmapNode roadmapNode1 = 로드맵_노드를_생성한다("로드맵 1주차", "로드맵 1주차 내용"); final RoadmapNode roadmapNode2 = 로드맵_노드를_생성한다("로드맵 2주차", "로드맵 2주차 내용"); + final RoadmapContent roadmapContent1 = 로드맵_본문을_저장한다(List.of(roadmapNode1, roadmapNode2), roadmap1.getId()); - final RoadmapContent roadmapContent1 = 로드맵_본문을_생성한다(List.of(roadmapNode1, roadmapNode2)); - final Roadmap roadmap1 = 로드맵을_생성한다(creator, category, roadmapContent1); - + final Roadmap roadmap2 = 로드맵을_저장한다(creator, category); final RoadmapNode roadmapNode3 = 로드맵_노드를_생성한다("로드맵 1주차 입니다.", "로드맵 1주차 내용"); final RoadmapNode roadmapNode4 = 로드맵_노드를_생성한다("로드맵 2주차 입니다.", "로드맵 2주차 내용"); - - final RoadmapContent roadmapContent2 = 로드맵_본문을_생성한다(List.of(roadmapNode3, roadmapNode4)); - 로드맵을_생성한다(creator, category, roadmapContent2); + final RoadmapContent roadmapContent2 = 로드맵_본문을_저장한다(List.of(roadmapNode3, roadmapNode4), roadmap2.getId()); final Member member = 사용자를_생성한다("name2", "kirikiri@email.com", "identifier2", "password!2"); @@ -498,7 +511,7 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, goalRoomRepository.saveAll(List.of(goalRoom1, goalRoom2, goalRoom3)); // when - final List goalRooms = goalRoomRepository.findByRoadmap(roadmap1); + final List goalRooms = goalRoomRepository.findByRoadmapId(roadmap1.getId()); // then assertThat(goalRooms).isEqualTo(List.of(goalRoom1, goalRoom2)); @@ -509,9 +522,10 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, //given final Member creator = 크리에이터를_저장한다(); final RoadmapCategory category = 카테고리를_저장한다("게임"); + final Roadmap roadmap = 로드맵을_저장한다(creator, category); + final RoadmapNode roadmapNode = 로드맵_노드를_생성한다("로드맵 1주차", "로드맵 1주차 내용"); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(List.of(roadmapNode)); - 로드맵을_생성한다(creator, category, roadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(List.of(roadmapNode), roadmap.getId()); final GoalRoomRoadmapNode todayGoalRoomRoadmapNode = 골룸_로드맵_노드를_생성한다(TODAY, TEN_DAY_LATER, roadmapNode); @@ -557,17 +571,15 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, return new RoadmapNode(title, content); } - private RoadmapContent 로드맵_본문을_생성한다(final List roadmapNodes) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); + private RoadmapContent 로드맵_본문을_저장한다(final List roadmapNodes, final Long roadmapId) { + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId); roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); - return roadmapContent; + return roadmapContentRepository.save(roadmapContent); } - private Roadmap 로드맵을_생성한다(final Member creator, final RoadmapCategory category, - final RoadmapContent roadmapContent) { + private Roadmap 로드맵을_저장한다(final Member creator, final RoadmapCategory category) { final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 30, RoadmapDifficulty.DIFFICULT, creator.getId(), category); - roadmap.addContent(roadmapContent); return roadmapRepository.save(roadmap); } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepositoryTest.java index fd47c1049..39e2867db 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepositoryTest.java @@ -27,6 +27,7 @@ import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; +import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import org.junit.jupiter.api.Test; @@ -43,6 +44,7 @@ class GoalRoomToDoCheckRepositoryTest { private final MemberRepository memberRepository; private final RoadmapRepository roadmapRepository; + private final RoadmapContentRepository roadmapContentRepository; private final GoalRoomRepository goalRoomRepository; private final GoalRoomMemberRepository goalRoomMemberRepository; private final RoadmapCategoryRepository roadmapCategoryRepository; @@ -50,12 +52,14 @@ class GoalRoomToDoCheckRepositoryTest { public GoalRoomToDoCheckRepositoryTest(final MemberRepository memberRepository, final RoadmapRepository roadmapRepository, + final RoadmapContentRepository roadmapContentRepository, final GoalRoomRepository goalRoomRepository, final GoalRoomMemberRepository goalRoomMemberRepository, final RoadmapCategoryRepository roadmapCategoryRepository, final GoalRoomToDoCheckRepository goalRoomToDoCheckRepository) { this.memberRepository = memberRepository; this.roadmapRepository = roadmapRepository; + this.roadmapContentRepository = roadmapContentRepository; this.goalRoomRepository = goalRoomRepository; this.goalRoomMemberRepository = goalRoomMemberRepository; this.roadmapCategoryRepository = roadmapCategoryRepository; @@ -67,10 +71,11 @@ public GoalRoomToDoCheckRepositoryTest(final MemberRepository memberRepository, // given final Member creator = 사용자를_생성한다("name1", "01011111111", "identifier1", "password!1"); final RoadmapCategory category = 카테고리를_저장한다("여가"); + final Roadmap roadmap = 로드맵을_저장한다(creator, category); + final RoadmapNode roadmapNode1 = 로드맵_노드를_생성한다("로드맵 1주차", "로드맵 1주차 내용"); final RoadmapNode roadmapNode2 = 로드맵_노드를_생성한다("로드맵 2주차", "로드맵 2주차 내용"); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(List.of(roadmapNode1, roadmapNode2)); - 로드맵을_생성한다(creator, category, roadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(List.of(roadmapNode1, roadmapNode2), roadmap.getId()); final GoalRoomRoadmapNode goalRoomRoadmapNode1 = 골룸_로드맵_노드를_생성한다(TODAY, TODAY.plusDays(10), roadmapNode1); @@ -113,10 +118,11 @@ public GoalRoomToDoCheckRepositoryTest(final MemberRepository memberRepository, // given final Member creator = 사용자를_생성한다("name1", "01011111111", "identifier1", "password!1"); final RoadmapCategory category = 카테고리를_저장한다("여가"); + final Roadmap roadmap = 로드맵을_저장한다(creator, category); + final RoadmapNode roadmapNode1 = 로드맵_노드를_생성한다("로드맵 1주차", "로드맵 1주차 내용"); final RoadmapNode roadmapNode2 = 로드맵_노드를_생성한다("로드맵 2주차", "로드맵 2주차 내용"); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(List.of(roadmapNode1, roadmapNode2)); - 로드맵을_생성한다(creator, category, roadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_저장한다(List.of(roadmapNode1, roadmapNode2), roadmap.getId()); final GoalRoomRoadmapNode goalRoomRoadmapNode1 = 골룸_로드맵_노드를_생성한다(TODAY, TODAY.plusDays(10), roadmapNode1); @@ -171,17 +177,15 @@ public GoalRoomToDoCheckRepositoryTest(final MemberRepository memberRepository, return new RoadmapNode(title, content); } - private RoadmapContent 로드맵_본문을_생성한다(final List roadmapNodes) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); + private RoadmapContent 로드맵_본문을_저장한다(final List roadmapNodes, final Long roadmapId) { + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId); roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); - return roadmapContent; + return roadmapContentRepository.save(roadmapContent); } - private Roadmap 로드맵을_생성한다(final Member creator, final RoadmapCategory category, - final RoadmapContent roadmapContent) { + private Roadmap 로드맵을_저장한다(final Member creator, final RoadmapCategory category) { final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 30, RoadmapDifficulty.DIFFICULT, creator.getId(), category); - roadmap.addContent(roadmapContent); return roadmapRepository.save(roadmap); } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentTest.java index 343906912..1f448fc7b 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentTest.java @@ -5,7 +5,6 @@ import java.util.List; -import static co.kirikiri.roadmap.domain.RoadmapDifficulty.DIFFICULT; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertAll; @@ -19,7 +18,7 @@ class RoadmapContentTest { final String content = "a".repeat(2001); // expect - assertThatThrownBy(() -> new RoadmapContent(content)) + assertThatThrownBy(() -> new RoadmapContent(content, 1L)) .isInstanceOf(RoadmapException.class); } @@ -29,13 +28,13 @@ class RoadmapContentTest { final String content = null; // expect - assertDoesNotThrow(() -> new RoadmapContent(content)); + assertDoesNotThrow(() -> new RoadmapContent(content, 1L)); } @Test void 로드맵_본문에_노드들을_추가한다() { // given - final RoadmapContent content = new RoadmapContent("content"); + final RoadmapContent content = new RoadmapContent("content", 1L); final RoadmapNodes roadmapNodes = new RoadmapNodes( List.of(new RoadmapNode("title1", "content1"), new RoadmapNode("title2", "content1"))); @@ -54,7 +53,7 @@ class RoadmapContentTest { @Test void 로드맵_본문에_노드를_추가할때_이름이_겹치면_예외를_던진다() { // given - final RoadmapContent content = new RoadmapContent("content"); + final RoadmapContent content = new RoadmapContent("content", 1L); // when // then @@ -62,19 +61,4 @@ class RoadmapContentTest { assertThatThrownBy(() -> content.addNodes( new RoadmapNodes(List.of(new RoadmapNode(title, "content1"), new RoadmapNode(title, "content1"))))); } - - @Test - void 로드맵_본문의_로드맵인_경우_false를_반환한다() { - // given - final RoadmapContent content = new RoadmapContent("content"); - final Long creatorId = 1L; - final RoadmapCategory category = new RoadmapCategory(1L, "여가"); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 30, DIFFICULT, creatorId, category); - - // when - roadmap.addContent(content); - - // then - assertThat(content.isNotSameRoadmap(roadmap)).isFalse(); - } } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentsTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentsTest.java index e859f31d1..a3f0b63f8 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentsTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentsTest.java @@ -1,28 +1,22 @@ package co.kirikiri.roadmap.domain; -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - class RoadmapContentsTest { - @Test - void 로드맵_본문을_추가한다() { - // given - final RoadmapNodes roadmapNodes = new RoadmapNodes(List.of(new RoadmapNode("로드맵 노드 제목", "로드맵 노드 내용"))); - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); - roadmapContent.addNodes(roadmapNodes); - final RoadmapContents roadmapContents = new RoadmapContents(List.of(roadmapContent)); - final RoadmapContent updatedRoadmapContent = new RoadmapContent("로드맵 본문 수정본"); - updatedRoadmapContent.addNodes(roadmapNodes); - - // when - roadmapContents.add(updatedRoadmapContent); - - // then - assertThat(roadmapContents.getValues()).usingRecursiveComparison() - .isEqualTo(List.of(roadmapContent, updatedRoadmapContent)); - } +// @Test +// void 로드맵_본문을_추가한다() { +// // given +// final RoadmapNodes roadmapNodes = new RoadmapNodes(List.of(new RoadmapNode("로드맵 노드 제목", "로드맵 노드 내용"))); +// final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); +// roadmapContent.addNodes(roadmapNodes); +// final RoadmapContents roadmapContents = new RoadmapContents(List.of(roadmapContent)); +// final RoadmapContent updatedRoadmapContent = new RoadmapContent("로드맵 본문 수정본"); +// updatedRoadmapContent.addNodes(roadmapNodes); +// +// // when +// roadmapContents.add(updatedRoadmapContent); +// +// // then +// assertThat(roadmapContents.getValues()).usingRecursiveComparison() +// .isEqualTo(List.of(roadmapContent, updatedRoadmapContent)); +// } } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapReviewTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapReviewTest.java index c839785f3..36c2a4b7b 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapReviewTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapReviewTest.java @@ -17,10 +17,11 @@ class RoadmapReviewTest { // given final String content = "a".repeat(1000); final Long memberId = 1L; + final Long roadmapId = 1L; // expected final RoadmapReview roadmapReview = - assertDoesNotThrow(() -> new RoadmapReview(content, rate, memberId)); + assertDoesNotThrow(() -> new RoadmapReview(content, rate, memberId, roadmapId)); assertThat(roadmapReview) .isInstanceOf(RoadmapReview.class); } @@ -30,9 +31,10 @@ class RoadmapReviewTest { // given final String content = "a".repeat(1001); final Long memberId = 1L; + final Long roadmapId = 1L; // expected - assertThatThrownBy(() -> new RoadmapReview(content, null, memberId)) + assertThatThrownBy(() -> new RoadmapReview(content, null, memberId, roadmapId)) .isInstanceOf(RoadmapException.class); } @@ -41,9 +43,10 @@ class RoadmapReviewTest { void 리뷰_별점이_0과_5사이의_소수점_5_단위의_값이_아니면_예외가_발생한다(final double rate) { // given final Long memberId = 1L; + final Long roadmapId = 1L; // expected - assertThatThrownBy(() -> new RoadmapReview("리뷰", rate, memberId)) + assertThatThrownBy(() -> new RoadmapReview("리뷰", rate, memberId, roadmapId)) .isInstanceOf(RoadmapException.class); } } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTest.java index 83a58ceb4..b420856ed 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTest.java @@ -1,21 +1,11 @@ package co.kirikiri.roadmap.domain; -import co.kirikiri.domain.member.EncryptedPassword; -import co.kirikiri.domain.member.Gender; -import co.kirikiri.domain.member.Member; -import co.kirikiri.domain.member.MemberProfile; -import co.kirikiri.domain.member.vo.Identifier; -import co.kirikiri.domain.member.vo.Nickname; -import co.kirikiri.domain.member.vo.Password; import co.kirikiri.roadmap.domain.exception.RoadmapException; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; -import java.util.List; - import static co.kirikiri.roadmap.domain.RoadmapDifficulty.DIFFICULT; -import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; @@ -23,8 +13,6 @@ class RoadmapTest { private final Long creatorId = 1L; private final RoadmapCategory category = 카테고리를_생성한다(); - private final List roadmapNodes = 로드맵_노드들을_생성한다(); - private final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmapNodes); @Test void 로드맵이_성공적으로_생성된다() { @@ -33,19 +21,6 @@ class RoadmapTest { creatorId, category)); } - @Test - void 로드맵에_본문을_추가한다() { - // given - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 30, DIFFICULT, creatorId, category); - - // when - roadmap.addContent(roadmapContent); - - // then - final RoadmapContents contents = roadmap.getContents(); - assertThat(contents.getValues()).hasSize(1); - } - @ParameterizedTest @ValueSource(ints = {0, 41}) void 로드맵_제목의_길이가_1보다_작거나_40보다_크면_예외가_발생한다(final int titleLength) { @@ -76,25 +51,7 @@ class RoadmapTest { .isInstanceOf(RoadmapException.class); } - private Member 크리에이터를_생성한다() { - final MemberProfile profile = new MemberProfile(Gender.FEMALE, "kirikiri1@email.com"); - - return new Member(new Identifier("creator"), new EncryptedPassword(new Password("password1")), - new Nickname("nickname"), null, profile); - } - private RoadmapCategory 카테고리를_생성한다() { return new RoadmapCategory(1L, "여가"); } - - private List 로드맵_노드들을_생성한다() { - return List.of(new RoadmapNode("로드맵 1주차", "로드맵 1주차 내용"), - new RoadmapNode("로드맵 2주차", "로드맵 2주차 내용")); - } - - private RoadmapContent 로드맵_본문을_생성한다(final List roadmapNodes) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); - roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); - return roadmapContent; - } } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapContentRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapContentRepositoryTest.java index 637dad432..c8374e369 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapContentRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapContentRepositoryTest.java @@ -15,6 +15,8 @@ import co.kirikiri.roadmap.domain.RoadmapDifficulty; import org.junit.jupiter.api.Test; +import java.util.List; + import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertAll; @@ -36,74 +38,52 @@ public RoadmapContentRepositoryTest(final MemberRepository memberRepository, this.roadmapContentRepository = roadmapContentRepository; } - @Test - void 로드맵_컨텐츠를_로드맵과_함께_조회한다() { - // given - final Roadmap roadmap = 로드맵을_생성한다(); - final Roadmap savedRoadmap = roadmapRepository.save(roadmap); - final Long roadmapContentId = savedRoadmap.getContents().getValues().get(0).getId(); - - // when - final RoadmapContent roadmapContent = roadmapContentRepository.findByIdWithRoadmap(roadmapContentId).get(); - - // then - assertAll( - () -> assertThat(roadmapContent).isEqualTo(savedRoadmap.getContents().getValues().get(0)), - () -> assertThat(roadmapContent.getRoadmap()).isEqualTo(savedRoadmap) - ); - } - @Test void 로드맵_아이디로_로드맵의_가장_최근_컨텐츠를_조회한다() { // given - final Roadmap savedRoadmap = roadmapRepository.save(로드맵을_생성한다()); + final Roadmap roadmap = 로드맵을_저장한다(); + 로드맵_컨텐츠를_저장한다(roadmap.getId()); final RoadmapContent oldRoadmapContent = roadmapContentRepository.findFirstByRoadmapIdOrderByCreatedAtDesc( - savedRoadmap.getId()).get(); + roadmap.getId()).get(); - final RoadmapContent newRoadmapContent = new RoadmapContent("로드맵 제목"); - savedRoadmap.addContent(newRoadmapContent); + final RoadmapContent newRoadmapContent = 로드맵_컨텐츠를_저장한다(roadmap.getId()); // when final RoadmapContent expectedRoadmapContent = roadmapContentRepository.findFirstByRoadmapIdOrderByCreatedAtDesc( - savedRoadmap.getId()).get(); + roadmap.getId()).get(); // then assertAll( () -> assertThat(oldRoadmapContent).isNotEqualTo(expectedRoadmapContent), - () -> assertThat(expectedRoadmapContent).isEqualTo(newRoadmapContent) + () -> assertThat(newRoadmapContent).isEqualTo(expectedRoadmapContent) ); } @Test - void 로드맵의_가장_최근_컨텐츠를_조회한다() { + void 로드맵에_생성된_모든_컨텐츠를_삭제한다() { // given - final Roadmap savedRoadmap = roadmapRepository.save(로드맵을_생성한다()); - final RoadmapContent oldRoadmapContent = roadmapContentRepository.findFirstByRoadmapOrderByCreatedAtDesc( - savedRoadmap).get(); - - final RoadmapContent newRoadmapContent = new RoadmapContent("로드맵 제목"); - savedRoadmap.addContent(newRoadmapContent); + final Roadmap roadmap = 로드맵을_저장한다(); + 로드맵_컨텐츠를_저장한다(roadmap.getId()); + 로드맵_컨텐츠를_저장한다(roadmap.getId()); // when - final RoadmapContent expectedRoadmapContent = roadmapContentRepository.findFirstByRoadmapOrderByCreatedAtDesc( - savedRoadmap).get(); + final List roadmapContents = roadmapContentRepository.findAllByRoadmapId(roadmap.getId()); + roadmapContentRepository.deleteAllByRoadmapId(roadmap.getId()); // then assertAll( - () -> assertThat(oldRoadmapContent).isNotEqualTo(expectedRoadmapContent), - () -> assertThat(expectedRoadmapContent).isEqualTo(newRoadmapContent) + () -> assertThat(roadmapContents).hasSize(2), + () -> assertThat(roadmapContentRepository.findAllByRoadmapId(roadmap.getId())) + .isEmpty() ); } - private Roadmap 로드맵을_생성한다() { + private Roadmap 로드맵을_저장한다() { final Member creator = 사용자를_생성한다(); final RoadmapCategory category = 로드맵_카테고리를_생성한다(); - final RoadmapContent content = new RoadmapContent("로드맵 제목"); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.NORMAL, creator.getId(), category); - roadmap.addContent(content); - return roadmap; + return roadmapRepository.save(roadmap); } private Member 사용자를_생성한다() { @@ -118,4 +98,8 @@ public RoadmapContentRepositoryTest(final MemberRepository memberRepository, final RoadmapCategory category = new RoadmapCategory("운동"); return roadmapCategoryRepository.save(category); } + + private RoadmapContent 로드맵_컨텐츠를_저장한다(final Long roadmapId) { + return roadmapContentRepository.save(new RoadmapContent("content", roadmapId)); + } } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapRepositoryTest.java index 0d25f7650..27bb5e0d4 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapRepositoryTest.java @@ -48,21 +48,27 @@ class RoadmapRepositoryTest { private final MemberRepository memberRepository; + private final RoadmapCategoryRepository roadmapCategoryRepository; private final RoadmapRepository roadmapRepository; + private final RoadmapContentRepository roadmapContentRepository; + private final RoadmapReviewRepository roadmapReviewRepository; private final GoalRoomRepository goalRoomRepository; private final GoalRoomMemberRepository goalRoomMemberRepository; - private final RoadmapCategoryRepository roadmapCategoryRepository; public RoadmapRepositoryTest(final MemberRepository memberRepository, + final RoadmapCategoryRepository roadmapCategoryRepository, final RoadmapRepository roadmapRepository, + final RoadmapContentRepository roadmapContentRepository, + final RoadmapReviewRepository roadmapReviewRepository, final GoalRoomRepository goalRoomRepository, - final GoalRoomMemberRepository goalRoomMemberRepository, - final RoadmapCategoryRepository roadmapCategoryRepository) { + final GoalRoomMemberRepository goalRoomMemberRepository) { this.memberRepository = memberRepository; + this.roadmapCategoryRepository = roadmapCategoryRepository; this.roadmapRepository = roadmapRepository; + this.roadmapContentRepository = roadmapContentRepository; + this.roadmapReviewRepository = roadmapReviewRepository; this.goalRoomRepository = goalRoomRepository; this.goalRoomMemberRepository = goalRoomMemberRepository; - this.roadmapCategoryRepository = roadmapCategoryRepository; } @Test @@ -88,7 +94,7 @@ public RoadmapRepositoryTest(final MemberRepository memberRepository, final Roadmap savedRoadmap = 로드맵을_저장한다("로드맵 제목", creator, category); // when - final Roadmap expectedRoadmap = roadmapRepository.findRoadmapById(savedRoadmap.getId()).get(); + final Roadmap expectedRoadmap = roadmapRepository.findById(savedRoadmap.getId()).get(); assertThat(expectedRoadmap) .usingRecursiveComparison() @@ -192,19 +198,26 @@ public RoadmapRepositoryTest(final MemberRepository memberRepository, final RoadmapCategory gameCategory = 카테고리를_생성한다("게임"); final RoadmapCategory travelCategory = 카테고리를_생성한다("여행"); - final Roadmap gameRoadmap1 = 노드_정보를_포함한_로드맵을_생성한다("게임 로드맵", creator, gameCategory); - final Roadmap gameRoadmap2 = 노드_정보를_포함한_로드맵을_생성한다("게임 로드맵2", creator, gameCategory); - final Roadmap travelRoadmap = 노드_정보를_포함한_로드맵을_생성한다("여행 로드맵", creator, travelCategory); - 노드_정보를_포함한_삭제된_로드맵을_저장한다("여행 로드맵2", creator, travelCategory); + final Roadmap gameRoadmap1 = 로드맵을_저장한다("게임 로드맵", creator, gameCategory); + final RoadmapContent gameRoadmapContent1 = 로드맵_컨텐츠를_저장한다(gameRoadmap1.getId()); + + final Roadmap gameRoadmap2 = 로드맵을_저장한다("게임 로드맵2", creator, gameCategory); + 로드맵_컨텐츠를_저장한다(gameRoadmap2.getId()); + + final Roadmap travelRoadmap = 로드맵을_저장한다("여행 로드맵", creator, travelCategory); + final RoadmapContent travelRoadmapContent = 로드맵_컨텐츠를_저장한다(travelRoadmap.getId()); + + final Roadmap deletedRoadmap = 삭제된_로드맵을_저장한다("여행 로드맵2", creator, travelCategory); + 로드맵_컨텐츠를_저장한다(deletedRoadmap.getId()); // gameRoadmap1 : 골룸 3개 - 골룸을_생성한다(gameRoadmap1.getContents().getValues().get(0), creator); - 골룸을_생성한다(gameRoadmap1.getContents().getValues().get(0), creator); - 골룸을_생성한다(gameRoadmap1.getContents().getValues().get(0), creator); + 골룸을_생성한다(gameRoadmapContent1, creator); + 골룸을_생성한다(gameRoadmapContent1, creator); + 골룸을_생성한다(gameRoadmapContent1, creator); // gameRoadmap2 : 골룸 0개 // travelRoadmap : 골룸 1개 - 골룸을_생성한다(travelRoadmap.getContents().getValues().get(0), creator); + 골룸을_생성한다(travelRoadmapContent, creator); final RoadmapCategory category = null; final RoadmapOrderType orderType = RoadmapOrderType.GOAL_ROOM_COUNT; @@ -237,14 +250,21 @@ public RoadmapRepositoryTest(final MemberRepository memberRepository, final RoadmapCategory gameCategory = 카테고리를_생성한다("게임"); final RoadmapCategory travelCategory = 카테고리를_생성한다("여행"); - final Roadmap gameRoadmap1 = 노드_정보를_포함한_로드맵을_생성한다("게임 로드맵", creator, gameCategory); - final Roadmap gameRoadmap2 = 노드_정보를_포함한_로드맵을_생성한다("게임 로드맵2", creator, gameCategory); - final Roadmap travelRoadmap = 노드_정보를_포함한_로드맵을_생성한다("여행 로드맵", creator, travelCategory); - 노드_정보를_포함한_삭제된_로드맵을_저장한다("여행 로드맵2", creator, travelCategory); + final Roadmap gameRoadmap1 = 로드맵을_저장한다("게임 로드맵", creator, gameCategory); + final RoadmapContent gameRoadmapContent1 = 로드맵_컨텐츠를_저장한다(gameRoadmap1.getId()); - 골룸을_생성한다(gameRoadmap1.getContents().getValues().get(0), creator); - final GoalRoom gameRoadmap2GoalRoom = 골룸을_생성한다(gameRoadmap2.getContents().getValues().get(0), creator); - final GoalRoom travelRoadmapGoalRoom = 골룸을_생성한다(travelRoadmap.getContents().getValues().get(0), creator); + final Roadmap gameRoadmap2 = 로드맵을_저장한다("게임 로드맵2", creator, gameCategory); + final RoadmapContent gameRoadmapContent2 = 로드맵_컨텐츠를_저장한다(gameRoadmap2.getId()); + + final Roadmap travelRoadmap = 로드맵을_저장한다("여행 로드맵", creator, travelCategory); + final RoadmapContent travelRoadmapContent = 로드맵_컨텐츠를_저장한다(travelRoadmap.getId()); + + final Roadmap deletedRoadmap = 삭제된_로드맵을_저장한다("여행 로드맵2", creator, travelCategory); + 로드맵_컨텐츠를_저장한다(deletedRoadmap.getId()); + + 골룸을_생성한다(gameRoadmapContent1, creator); + final GoalRoom gameRoadmap2GoalRoom = 골룸을_생성한다(gameRoadmapContent2, creator); + final GoalRoom travelRoadmapGoalRoom = 골룸을_생성한다(travelRoadmapContent, creator); // gameRoadmap1 : 참가인원 0명 // gameRoadmap2 : 참가인원 1명 @@ -289,25 +309,22 @@ public RoadmapRepositoryTest(final MemberRepository memberRepository, final RoadmapCategory gameCategory = 카테고리를_생성한다("게임"); final RoadmapCategory travelCategory = 카테고리를_생성한다("여행"); - final Roadmap gameRoadmap1 = 노드_정보를_포함한_로드맵을_생성한다("게임 로드맵", creator, gameCategory); - final Roadmap gameRoadmap2 = 노드_정보를_포함한_로드맵을_생성한다("게임 로드맵2", creator, gameCategory); - final Roadmap travelRoadmap = 노드_정보를_포함한_로드맵을_생성한다("여행 로드맵", creator, travelCategory); - 노드_정보를_포함한_삭제된_로드맵을_저장한다("여행 로드맵2", creator, travelCategory); + final Roadmap gameRoadmap1 = 로드맵을_저장한다("게임 로드맵", creator, gameCategory); + final Roadmap gameRoadmap2 = 로드맵을_저장한다("게임 로드맵2", creator, gameCategory); + final Roadmap travelRoadmap = 로드맵을_저장한다("여행 로드맵", creator, travelCategory); + 삭제된_로드맵을_저장한다("여행 로드맵2", creator, travelCategory); // gameRoadmap1 : 4.5 - final RoadmapReview gameRoadmap1Review = new RoadmapReview("리뷰1", 4.5, follower.getId()); - gameRoadmap1.addReview(gameRoadmap1Review); - roadmapRepository.save(gameRoadmap1); + final RoadmapReview gameRoadmap1Review = new RoadmapReview("리뷰1", 4.5, follower.getId(), gameRoadmap1.getId()); + roadmapReviewRepository.save(gameRoadmap1Review); // gameRoadmap2 : 5.0 - final RoadmapReview gameRoadmap2Review = new RoadmapReview("리뷰2", 5.0, follower.getId()); - gameRoadmap2.addReview(gameRoadmap2Review); - roadmapRepository.save(gameRoadmap2); + final RoadmapReview gameRoadmap2Review = new RoadmapReview("리뷰2", 5.0, follower.getId(), gameRoadmap2.getId()); + roadmapReviewRepository.save(gameRoadmap2Review); // travelRoadmap : 4.0 - final RoadmapReview travelRoadmapReview = new RoadmapReview("리뷰3", 4.0, follower.getId()); - travelRoadmap.addReview(travelRoadmapReview); - roadmapRepository.save(travelRoadmap); + final RoadmapReview travelRoadmapReview = new RoadmapReview("리뷰3", 4.0, follower.getId(), travelRoadmap.getId()); + roadmapReviewRepository.save(travelRoadmapReview); final RoadmapCategory category = null; final RoadmapOrderType orderType = RoadmapOrderType.REVIEW_RATE; @@ -525,7 +542,7 @@ public RoadmapRepositoryTest(final MemberRepository memberRepository, } @Test - void 삭제된_로드맵을_로드맵_본문과_함께_조회한다() { + void 삭제된_로드맵을_조회한다() { // given final Member creator = 사용자를_생성한다("cokirikiri", "코끼리"); final RoadmapCategory gameCategory = 카테고리를_생성한다("게임"); @@ -536,14 +553,10 @@ public RoadmapRepositoryTest(final MemberRepository memberRepository, final Roadmap deletedRoadmap = 삭제된_로드맵을_저장한다("로드맵", creator, travelCategory); // when - final List roadmapsByStatus = roadmapRepository.findWithRoadmapContentByStatus(RoadmapStatus.DELETED); + final List roadmapsByStatus = roadmapRepository.findByStatus(RoadmapStatus.DELETED); // then - assertAll( - () -> assertThat(roadmapsByStatus).isEqualTo(List.of(deletedRoadmap)), - () -> assertThat(roadmapsByStatus.get(0).getContents().getValues().get(0).getContent()) - .isEqualTo("로드맵 본문2") - ); + assertThat(roadmapsByStatus).isEqualTo(List.of(deletedRoadmap)); } private Member 사용자를_생성한다(final String identifier, final String nickname) { @@ -561,40 +574,27 @@ public RoadmapRepositoryTest(final MemberRepository memberRepository, private Roadmap 로드맵을_저장한다(final String title, final Member creator, final RoadmapCategory category) { final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); - roadmap.addContent(new RoadmapContent("로드맵 본문")); return roadmapRepository.save(roadmap); } private Roadmap 삭제된_로드맵을_저장한다(final String title, final Member creator, final RoadmapCategory category) { final Roadmap roadmap = new Roadmap(title, "로드맵 소개글2", 7, RoadmapDifficulty.DIFFICULT, creator.getId(), category); - roadmap.addContent(new RoadmapContent("로드맵 본문2")); roadmap.delete(); return roadmapRepository.save(roadmap); } - private Roadmap 로드맵을_태그와_저장한다(final String title, final Member creator, final RoadmapCategory category, - final RoadmapTags roadmapTags) { - final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); - roadmap.addTags(roadmapTags); - return roadmapRepository.save(roadmap); - } - - private Roadmap 노드_정보를_포함한_로드맵을_생성한다(final String title, final Member creator, final RoadmapCategory category) { - final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); + private RoadmapContent 로드맵_컨텐츠를_저장한다(final Long roadmapId) { final RoadmapNode roadmapNode1 = 로드맵_노드를_생성한다("로드맵 1주차", "로드맵 1주차 내용"); final RoadmapNode roadmapNode2 = 로드맵_노드를_생성한다("로드맵 2주차", "로드맵 2주차 내용"); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(List.of(roadmapNode1, roadmapNode2)); - roadmap.addContent(roadmapContent); - return roadmapRepository.save(roadmap); + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId); + roadmapContent.addNodes(new RoadmapNodes(List.of(roadmapNode1, roadmapNode2))); + return roadmapContentRepository.save(roadmapContent); } - private Roadmap 노드_정보를_포함한_삭제된_로드맵을_저장한다(final String title, final Member creator, final RoadmapCategory category) { + private Roadmap 로드맵을_태그와_저장한다(final String title, final Member creator, final RoadmapCategory category, + final RoadmapTags roadmapTags) { final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); - final RoadmapNode roadmapNode1 = 로드맵_노드를_생성한다("로드맵 1주차", "로드맵 1주차 내용"); - final RoadmapNode roadmapNode2 = 로드맵_노드를_생성한다("로드맵 2주차", "로드맵 2주차 내용"); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(List.of(roadmapNode1, roadmapNode2)); - roadmap.addContent(roadmapContent); - roadmap.delete(); + roadmap.addTags(roadmapTags); return roadmapRepository.save(roadmap); } @@ -602,12 +602,6 @@ public RoadmapRepositoryTest(final MemberRepository memberRepository, return new RoadmapNode(title, content); } - private RoadmapContent 로드맵_본문을_생성한다(final List roadmapNodes) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); - roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); - return roadmapContent; - } - private GoalRoom 골룸을_생성한다(final RoadmapContent roadmapContent, final Member member) { final LocalDate today = LocalDate.now(); final GoalRoomRoadmapNode goalRoomRoadmapNode1 = 골룸_로드맵_노드를_생성한다(today, today.plusDays(10), diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepositoryTest.java index 6bee8d130..2ad904e03 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapReviewRepositoryTest.java @@ -11,12 +11,7 @@ import co.kirikiri.domain.member.vo.Password; import co.kirikiri.persistence.helper.RepositoryTest; import co.kirikiri.persistence.member.MemberRepository; -import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; -import co.kirikiri.roadmap.domain.RoadmapContent; -import co.kirikiri.roadmap.domain.RoadmapDifficulty; -import co.kirikiri.roadmap.domain.RoadmapNode; -import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.roadmap.domain.RoadmapReview; import org.junit.jupiter.api.Test; @@ -48,15 +43,13 @@ public RoadmapReviewRepositoryTest(final MemberRepository memberRepository, void 로드맵과_사용자로_로드맵_리뷰_정보가_존재하면_반환한다() { // given final Member member = 사용자를_저장한다("코끼리", "cokirikiri"); - final RoadmapCategory category = 카테고리를_저장한다("게임"); - final Roadmap roadmap = 로드맵을_저장한다(member, category); + final Long roadmapId = 1L; - final RoadmapReview roadmapReview = new RoadmapReview("리뷰", 1.5, member.getId()); - roadmapReview.updateRoadmap(roadmap); + final RoadmapReview roadmapReview = new RoadmapReview("리뷰", 1.5, member.getId(), roadmapId); roadmapReviewRepository.save(roadmapReview); // when - final RoadmapReview findRoadmapReview = roadmapReviewRepository.findByRoadmapAndMemberId(roadmap, member.getId()) + final RoadmapReview findRoadmapReview = roadmapReviewRepository.findByRoadmapIdAndMemberId(roadmapId, member.getId()) .get(); // then @@ -68,15 +61,13 @@ public RoadmapReviewRepositoryTest(final MemberRepository memberRepository, // given final Member member = 사용자를_저장한다("코끼리", "cokirikiri"); final Member member2 = 사용자를_저장한다("끼리코", "kirikirico"); - final RoadmapCategory category = 카테고리를_저장한다("게임"); - final Roadmap roadmap = 로드맵을_저장한다(member, category); + final Long roadmapId = 1L; - final RoadmapReview roadmapReview = new RoadmapReview("리뷰", 2.5, member.getId()); - roadmapReview.updateRoadmap(roadmap); + final RoadmapReview roadmapReview = new RoadmapReview("리뷰", 2.5, member.getId(), roadmapId); roadmapReviewRepository.save(roadmapReview); // when - final Optional findRoadmapReview = roadmapReviewRepository.findByRoadmapAndMemberId(roadmap, + final Optional findRoadmapReview = roadmapReviewRepository.findByRoadmapIdAndMemberId(roadmapId, member2.getId()); // then @@ -89,25 +80,21 @@ public RoadmapReviewRepositoryTest(final MemberRepository memberRepository, final Member member = 사용자를_저장한다("코끼리", "cokirikiri"); final Member member2 = 사용자를_저장한다("끼리코", "kirikirico"); final Member member3 = 사용자를_저장한다("리끼코", "rikirikico"); - final RoadmapCategory category = 카테고리를_저장한다("게임"); - final Roadmap roadmap = 로드맵을_저장한다(member, category); - - final RoadmapReview roadmapReview1 = new RoadmapReview("리뷰1", 2.5, member.getId()); - final RoadmapReview roadmapReview2 = new RoadmapReview("리뷰2", 4.0, member2.getId()); - final RoadmapReview roadmapReview3 = new RoadmapReview("리뷰3", 5.0, member3.getId()); - roadmapReview1.updateRoadmap(roadmap); - roadmapReview2.updateRoadmap(roadmap); - roadmapReview3.updateRoadmap(roadmap); + final Long roadmapId = 1L; + + final RoadmapReview roadmapReview1 = new RoadmapReview("리뷰1", 2.5, member.getId(), roadmapId); + final RoadmapReview roadmapReview2 = new RoadmapReview("리뷰2", 4.0, member2.getId(), roadmapId); + final RoadmapReview roadmapReview3 = new RoadmapReview("리뷰3", 5.0, member3.getId(), roadmapId); roadmapReviewRepository.save(roadmapReview1); roadmapReviewRepository.save(roadmapReview2); roadmapReviewRepository.save(roadmapReview3); // when - final List roadmapReviewsFirstPage = roadmapReviewRepository.findRoadmapReviewByRoadmapOrderByLatest( - roadmap, null, 2); + final List roadmapReviewsFirstPage = roadmapReviewRepository.findRoadmapReviewByRoadmapIdOrderByLatest( + roadmapId, null, 2); - final List roadmapReviewsSecondPage = roadmapReviewRepository.findRoadmapReviewByRoadmapOrderByLatest( - roadmap, roadmapReviewsFirstPage.get(1).getId(), 2); + final List roadmapReviewsSecondPage = roadmapReviewRepository.findRoadmapReviewByRoadmapIdOrderByLatest( + roadmapId, roadmapReviewsFirstPage.get(1).getId(), 2); // then assertAll( @@ -122,18 +109,15 @@ public RoadmapReviewRepositoryTest(final MemberRepository memberRepository, void 로드맵에_대한_리뷰_정보가_없으면_빈_값을_반환한다() { // given final Member member = 사용자를_저장한다("코끼리", "cokirikiri"); - final Member member2 = 사용자를_저장한다("끼리코", "kirikirico"); - final RoadmapCategory category = 카테고리를_저장한다("게임"); - final Roadmap roadmap1 = 로드맵을_저장한다(member, category); - final Roadmap roadmap2 = 로드맵을_저장한다(member2, category); + final Long roadmapId = 1L; + final Long roadmapId2 = 2L; - final RoadmapReview roadmapReview = new RoadmapReview("리뷰", 2.5, member.getId()); - roadmapReview.updateRoadmap(roadmap1); + final RoadmapReview roadmapReview = new RoadmapReview("리뷰", 2.5, member.getId(), roadmapId2); roadmapReviewRepository.save(roadmapReview); // when - final List roadmapReviewsFirstPage = roadmapReviewRepository.findRoadmapReviewByRoadmapOrderByLatest( - roadmap2, null, 1); + final List roadmapReviewsFirstPage = roadmapReviewRepository.findRoadmapReviewByRoadmapIdOrderByLatest( + roadmapId, null, 1); // then assertThat(roadmapReviewsFirstPage).isEmpty(); @@ -151,24 +135,4 @@ public RoadmapReviewRepositoryTest(final MemberRepository memberRepository, final RoadmapCategory roadmapCategory = new RoadmapCategory(name); return roadmapCategoryRepository.save(roadmapCategory); } - - private Roadmap 로드맵을_저장한다(final Member creator, final RoadmapCategory category) { - final List roadmapNodes = 로드맵_노드들을_생성한다(); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmapNodes); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); - roadmap.addContent(roadmapContent); - return roadmapRepository.save(roadmap); - } - - private List 로드맵_노드들을_생성한다() { - final RoadmapNode roadmapNode1 = new RoadmapNode("로드맵 1주차", "로드맵 1주차 내용"); - final RoadmapNode roadmapNode2 = new RoadmapNode("로드맵 2주차", "로드맵 2주차 내용"); - return List.of(roadmapNode1, roadmapNode2); - } - - private RoadmapContent 로드맵_본문을_생성한다(final List roadmapNodes) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); - roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); - return roadmapContent; - } } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java index 5ed602a27..6e9eb38b0 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java @@ -52,12 +52,11 @@ class RoadmapCreateEventListenerTest { @Test void 정상적으로_로드맵_노드_이미지를_저장한다() throws IOException { - final RoadmapContent roadmapContent = new RoadmapContent("roadmapContent"); - final RoadmapNode roadmapNode = new RoadmapNode("roadmapNodeTitle", "roadmapNodeContent"); - roadmapContent.addNodes(new RoadmapNodes(List.of(roadmapNode))); - final Roadmap roadmap = new Roadmap(1L, "roadmapTitle", "introduction", 10, RoadmapDifficulty.DIFFICULT, memberId, new RoadmapCategory("category")); + final RoadmapContent roadmapContent = new RoadmapContent("roadmapContent", roadmap.getId()); + final RoadmapNode roadmapNode = new RoadmapNode("roadmapNodeTitle", "roadmapNodeContent"); + roadmapContent.addNodes(new RoadmapNodes(List.of(roadmapNode))); final MultipartFile imageFile = new MockMultipartFile(roadmapNode.getTitle(), "originalFileName.jpeg", "image/jpeg", "tempImage".getBytes()); @@ -69,8 +68,6 @@ class RoadmapCreateEventListenerTest { roadmapContent.getContent(), RoadmapDifficultyType.DIFFICULT, 10, List.of(roadmapNodeSaveDto), List.of(new RoadmapTagSaveDto("tag"))); - roadmap.addContent(roadmapContent); - final RoadmapCreateEvent roadmapCreateEvent = new RoadmapCreateEvent(roadmap.getId(), roadmapSaveDto); // When @@ -113,12 +110,11 @@ class RoadmapCreateEventListenerTest { @Test void 로드맵_노드_제목을_가진_노드가_로드맵에_존재하지_않을때_예외를_던진다() throws IOException { //given - final RoadmapContent roadmapContent = new RoadmapContent("roadmapContent"); - final RoadmapNode roadmapNode = new RoadmapNode("roadmapNodeTitle", "roadmapNodeContent"); - roadmapContent.addNodes(new RoadmapNodes(List.of(roadmapNode))); - final Roadmap roadmap = new Roadmap(1L, "roadmapTitle", "introduction", 10, RoadmapDifficulty.DIFFICULT, memberId, new RoadmapCategory("category")); + final RoadmapContent roadmapContent = new RoadmapContent("roadmapContent", roadmap.getId()); + final RoadmapNode roadmapNode = new RoadmapNode("roadmapNodeTitle", "roadmapNodeContent"); + roadmapContent.addNodes(new RoadmapNodes(List.of(roadmapNode))); final MultipartFile imageFile = new MockMultipartFile(roadmapNode.getTitle(), "originalFileName.jpeg", "image/jpeg", "tempImage".getBytes()); @@ -130,8 +126,6 @@ class RoadmapCreateEventListenerTest { roadmapContent.getContent(), RoadmapDifficultyType.DIFFICULT, 10, List.of(roadmapNodeSaveDto), List.of(new RoadmapTagSaveDto("tag"))); - roadmap.addContent(roadmapContent); - final RoadmapCreateEvent roadmapCreateEvent = new RoadmapCreateEvent(roadmap.getId(), roadmapSaveDto); //when @@ -147,12 +141,11 @@ class RoadmapCreateEventListenerTest { @Test void 로드맵_노드_이미지에_원본_파일_이름이_없을_경우_예외를_던진다() throws IOException { //given - final RoadmapContent roadmapContent = new RoadmapContent("roadmapContent"); - final RoadmapNode roadmapNode = new RoadmapNode("roadmapNodeTitle", "roadmapNodeContent"); - roadmapContent.addNodes(new RoadmapNodes(List.of(roadmapNode))); - final Roadmap roadmap = new Roadmap(1L, "roadmapTitle", "inroduction", 10, RoadmapDifficulty.DIFFICULT, memberId, new RoadmapCategory("category")); + final RoadmapContent roadmapContent = new RoadmapContent("roadmapContent", roadmap.getId()); + final RoadmapNode roadmapNode = new RoadmapNode("roadmapNodeTitle", "roadmapNodeContent"); + roadmapContent.addNodes(new RoadmapNodes(List.of(roadmapNode))); final MultipartFile imageFile = new MockMultipartFile(roadmapNode.getTitle(), null, "image/jpeg", "tempImage".getBytes()); @@ -164,8 +157,6 @@ class RoadmapCreateEventListenerTest { roadmapContent.getContent(), RoadmapDifficultyType.DIFFICULT, 10, List.of(roadmapNodeSaveDto), List.of(new RoadmapTagSaveDto("tag"))); - roadmap.addContent(roadmapContent); - final RoadmapCreateEvent roadmapCreateEvent = new RoadmapCreateEvent(roadmap.getId(), roadmapSaveDto); //when diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateServiceTest.java index 75541762d..d0ce0fd51 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateServiceTest.java @@ -11,10 +11,10 @@ import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; -import co.kirikiri.roadmap.domain.RoadmapContents; import co.kirikiri.roadmap.domain.RoadmapDifficulty; import co.kirikiri.roadmap.domain.RoadmapReview; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; +import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import co.kirikiri.roadmap.persistence.RoadmapReviewRepository; import co.kirikiri.roadmap.service.dto.request.RoadmapCategorySaveRequest; @@ -60,6 +60,9 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 @Mock private RoadmapRepository roadmapRepository; + @Mock + private RoadmapContentRepository roadmapContentRepository; + @Mock private RoadmapReviewRepository roadmapReviewRepository; @@ -91,13 +94,15 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 final RoadmapSaveRequest request = new RoadmapSaveRequest(1L, roadmapTitle, roadmapIntroduction, roadmapContent, difficulty, requiredPeriod, roadmapNodes, roadmapTags); + when(memberRepository.findByIdentifier(MEMBER.getIdentifier())) + .thenReturn(Optional.of(MEMBER)); given(roadmapCategoryRepository.findById(any())) .willReturn(Optional.of(category)); given(roadmapRepository.save(any())) .willReturn(new Roadmap(1L, roadmapTitle, roadmapIntroduction, requiredPeriod, RoadmapDifficulty.valueOf(difficulty.name()), MEMBER.getId(), category)); - when(memberRepository.findByIdentifier(MEMBER.getIdentifier())) - .thenReturn(Optional.of(MEMBER)); + given(roadmapContentRepository.save(any())) + .willReturn(new RoadmapContent(roadmapContent, 1L)); // expect assertDoesNotThrow(() -> roadmapCreateService.create(request, "identifier1")); @@ -146,16 +151,13 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 new MemberProfile(Gender.FEMALE, "kirikiri@email.com")); final RoadmapCategory category = new RoadmapCategory(1L, "운동"); - final Roadmap roadmap = 로드맵을_생성한다(MEMBER, category); - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); when(roadmapRepository.findById(anyLong())) .thenReturn(Optional.of(roadmap)); when(roadmapGoalRoomService.findCompletedGoalRoomMember(anyLong(), any())) .thenReturn(follower); - when(roadmapReviewRepository.findByRoadmapAndMemberId(any(), anyLong())) + when(roadmapReviewRepository.findByRoadmapIdAndMemberId(any(), anyLong())) .thenReturn(Optional.empty()); final RoadmapReviewSaveRequest roadmapReviewSaveRequest = new RoadmapReviewSaveRequest("최고의 로드맵이네요", 5.0); @@ -207,17 +209,14 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 new MemberProfile(Gender.FEMALE, "kirikiri@email.com")); final RoadmapCategory category = new RoadmapCategory(1L, "운동"); - final Roadmap roadmap = 로드맵을_생성한다(MEMBER, category); - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); when(roadmapRepository.findById(anyLong())) .thenReturn(Optional.of(roadmap)); when(roadmapGoalRoomService.findCompletedGoalRoomMember(anyLong(), any())) .thenReturn(follower); - when(roadmapReviewRepository.findByRoadmapAndMemberId(any(), anyLong())) - .thenReturn(Optional.of(new RoadmapReview("로드맵 짱!", 5.0, MEMBER.getId()))); + when(roadmapReviewRepository.findByRoadmapIdAndMemberId(any(), anyLong())) + .thenReturn(Optional.of(new RoadmapReview("로드맵 짱!", 5.0, MEMBER.getId(), roadmap.getId()))); final RoadmapReviewSaveRequest roadmapReviewSaveRequest = new RoadmapReviewSaveRequest("최고의 로드맵이네요", 5.0); @@ -236,7 +235,7 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 .thenReturn(Optional.of(roadmap)); when(roadmapRepository.findByIdAndMemberIdentifier(anyLong(), anyString())) .thenReturn(Optional.of(roadmap)); - when(roadmapGoalRoomService.hasGoalRooms(roadmap)) + when(roadmapGoalRoomService.hasGoalRooms(roadmap.getId())) .thenReturn(false); // when @@ -255,14 +254,11 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 final RoadmapCategory category = new RoadmapCategory(1L, "운동"); final Roadmap roadmap = 로드맵을_생성한다(MEMBER, category); - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - when(roadmapRepository.findById(anyLong())) .thenReturn(Optional.of(roadmap)); when(roadmapRepository.findByIdAndMemberIdentifier(anyLong(), anyString())) .thenReturn(Optional.of(roadmap)); - when(roadmapGoalRoomService.hasGoalRooms(roadmap)) + when(roadmapGoalRoomService.hasGoalRooms(roadmap.getId())) .thenReturn(true); // when @@ -291,9 +287,6 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 final RoadmapCategory category = new RoadmapCategory(1L, "운동"); final Roadmap roadmap = 로드맵을_생성한다(MEMBER, category); - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - when(roadmapRepository.findById(anyLong())) .thenReturn(Optional.of(roadmap)); when(roadmapRepository.findByIdAndMemberIdentifier(anyLong(), anyString())) @@ -334,9 +327,6 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 } private Roadmap 로드맵을_생성한다(final Member creator, final RoadmapCategory category) { - final RoadmapContent content = new RoadmapContent("콘텐츠 제목"); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.NORMAL, creator.getId(), category); - roadmap.addContent(content); - return roadmap; + return new Roadmap(1L, "로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.NORMAL, creator.getId(), category); } } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java index 1b151418d..d4ada9c20 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java @@ -104,15 +104,13 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 void 특정_아이디를_가지는_로드맵_단일_조회시_해당_로드맵의_정보를_반환한다() throws MalformedURLException { //given final RoadmapCategory category = 로드맵_카테고리를_생성한다(1L, "운동"); - final RoadmapContent content = 로드맵_컨텐츠를_생성한다(1L, "콘텐츠 내용"); final Roadmap roadmap = 로드맵을_생성한다("로드맵 제목", category); - roadmap.addContent(content); - final Long roadmapId = 1L; + final RoadmapContent roadmapContent = 로드맵_컨텐츠를_생성한다("로드맵 본문", roadmap.getId()); - when(roadmapRepository.findRoadmapById(anyLong())) + when(roadmapRepository.findById(anyLong())) .thenReturn(Optional.of(roadmap)); - when(roadmapContentRepository.findFirstByRoadmapOrderByCreatedAtDesc(any())) - .thenReturn(Optional.of(roadmap.getContents().getValues().get(0))); + when(roadmapContentRepository.findFirstByRoadmapIdOrderByCreatedAtDesc(anyLong())) + .thenReturn(Optional.of(roadmapContent)); when(roadmapGoalRoomService.findRoadmapGoalRoomsByRoadmap(any())) .thenReturn(new RoadmapGoalRoomNumberDto(2, 2, 2)); when(memberRepository.findWithMemberProfileAndImageById(anyLong())) @@ -121,11 +119,11 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 .thenReturn(new URL("http://example.com/serverFilePath")); //when - final RoadmapResponse roadmapResponse = roadmapService.findRoadmap(roadmapId); + final RoadmapResponse roadmapResponse = roadmapService.findRoadmap(roadmap.getId()); //then final RoadmapResponse expectedResponse = new RoadmapResponse( - roadmapId, new RoadmapCategoryResponse(1L, "운동"), "로드맵 제목", "로드맵 소개글", + roadmap.getId(), new RoadmapCategoryResponse(1L, "운동"), "로드맵 제목", "로드맵 소개글", new MemberResponse(1L, "닉네임", "http://example.com/serverFilePath"), new RoadmapContentResponse(1L, "로드맵 본문", List.of( new RoadmapNodeResponse(1L, "로드맵 노드1 제목", "로드맵 노드1 설명", Collections.emptyList()) @@ -144,7 +142,7 @@ roadmapId, new RoadmapCategoryResponse(1L, "운동"), "로드맵 제목", "로 @Test void 로드맵_단일_조회_시_로드맵_아이디가_존재하지_않는_아이디일_경우_예외를_반환한다() { //when - when(roadmapRepository.findRoadmapById(anyLong())) + when(roadmapRepository.findById(anyLong())) .thenReturn(Optional.empty()); //then @@ -461,19 +459,12 @@ roadmapId, new RoadmapCategoryResponse(1L, "운동"), "로드맵 제목", "로 void 로드맵의_골룸_목록을_최신순으로_조회한다() throws MalformedURLException { // given final Member member1 = 사용자를_생성한다(1L, "identifier1", "name1"); - final RoadmapNode roadmapNode1 = new RoadmapNode("로드맵 1주차", "로드맵 1주차 내용"); - final RoadmapNode roadmapNode2 = new RoadmapNode("로드맵 2주차", "로드맵 2주차 내용"); - final RoadmapNodes roadmapNodes = new RoadmapNodes(List.of(roadmapNode1, roadmapNode2)); - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); - roadmapContent.addNodes(roadmapNodes); final Roadmap roadmap = new Roadmap(1L, "로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.DIFFICULT, member1.getId(), new RoadmapCategory("it")); final Member member2 = 사용자를_생성한다(2L, "identifier2", "name2"); final Member member3 = 사용자를_생성한다(3L, "identifier2", "name3"); - given(roadmapRepository.findRoadmapById(anyLong())) - .willReturn(Optional.of(roadmap)); final RoadmapGoalRoomResponses expected = new RoadmapGoalRoomResponses(List.of( new RoadmapGoalRoomResponse(2L, "goalroom2", GoalRoomStatus.RECRUITING.name(), 1, 10, @@ -486,6 +477,9 @@ roadmapId, new RoadmapCategoryResponse(1L, "운동"), "로드맵 제목", "로 TODAY, TODAY.plusDays(20), new MemberResponse(member2.getId(), member2.getNickname().getValue(), "http://example.com/serverFilePath"))), false); + + given(roadmapRepository.findById(anyLong())) + .willReturn(Optional.of(roadmap)); given(roadmapGoalRoomService.makeRoadmapGoalRoomResponsesByOrderType(any(), any(), any())) .willReturn(expected); @@ -502,7 +496,7 @@ roadmapId, new RoadmapCategoryResponse(1L, "운동"), "로드맵 제목", "로 @Test void 로드맵의_골룸_목록을_조회할때_존재하지_않는_로드맵이면_예외가_발생한다() { // given - given(roadmapRepository.findRoadmapById(anyLong())) + given(roadmapRepository.findById(anyLong())) .willThrow(new NotFoundException("존재하지 않는 로드맵입니다. roadmapId = 1")); // when @@ -519,21 +513,14 @@ RoadmapGoalRoomsOrderTypeDto.LATEST, new CustomScrollRequest(null, 10))) // given final Member member1 = 사용자를_생성한다(1L, "identifier1", "리뷰어1"); final Member member2 = 사용자를_생성한다(2L, "identifier2", "리뷰어2"); - final RoadmapNode roadmapNode1 = new RoadmapNode("로드맵 1주차", "로드맵 1주차 내용"); - final RoadmapNode roadmapNode2 = new RoadmapNode("로드맵 2주차", "로드맵 2주차 내용"); - final RoadmapNodes roadmapNodes = new RoadmapNodes(List.of(roadmapNode1, roadmapNode2)); - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); - roadmapContent.addNodes(roadmapNodes); final Roadmap roadmap = new Roadmap(1L, "로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.DIFFICULT, member1.getId(), new RoadmapCategory("it")); - final RoadmapReview roadmapReview1 = new RoadmapReview("리뷰 내용", 5.0, member1.getId()); - final RoadmapReview roadmapReview2 = new RoadmapReview("리뷰 내용", 4.5, member2.getId()); - roadmapReview1.updateRoadmap(roadmap); - roadmapReview2.updateRoadmap(roadmap); + final RoadmapReview roadmapReview1 = new RoadmapReview("리뷰 내용", 5.0, member1.getId(), roadmap.getId()); + final RoadmapReview roadmapReview2 = new RoadmapReview("리뷰 내용", 4.5, member2.getId(), roadmap.getId()); - when(roadmapRepository.findRoadmapById(anyLong())).thenReturn(Optional.of(roadmap)); - when(roadmapReviewRepository.findRoadmapReviewByRoadmapOrderByLatest(any(), any(), anyInt())) + when(roadmapRepository.findById(anyLong())).thenReturn(Optional.of(roadmap)); + when(roadmapReviewRepository.findRoadmapReviewByRoadmapIdOrderByLatest(any(), any(), anyInt())) .thenReturn(List.of(roadmapReview2, roadmapReview1)); when(memberRepository.findWithMemberProfileAndImageById(anyLong())) .thenReturn(Optional.of(member2), Optional.of(member1)); @@ -560,7 +547,7 @@ RoadmapGoalRoomsOrderTypeDto.LATEST, new CustomScrollRequest(null, 10))) @Test void 로드맵_리뷰_조회_시_유효하지_않은_로드맵_아이디라면_예외를_반환한다() { // given - when(roadmapRepository.findRoadmapById(anyLong())) + when(roadmapRepository.findById(anyLong())) .thenThrow(new NotFoundException("존재하지 않는 로드맵입니다. roadmapId = 1")); // when, then @@ -586,12 +573,6 @@ null, new EncryptedPassword(new Password("password1!")), new RoadmapTag(2L, new RoadmapTagName("태그2")))); roadmap.addTags(roadmapTags); - final RoadmapContent roadmapContent = new RoadmapContent(1L, "로드맵 본문"); - final RoadmapNodes roadmapNodes = new RoadmapNodes( - List.of(new RoadmapNode(1L, "로드맵 노드1 제목", "로드맵 노드1 설명"))); - roadmapContent.addNodes(roadmapNodes); - roadmap.addContent(roadmapContent); - return roadmap; } @@ -599,8 +580,12 @@ null, new EncryptedPassword(new Password("password1!")), return new RoadmapCategory(id, title); } - private RoadmapContent 로드맵_컨텐츠를_생성한다(final Long id, final String content) { - return new RoadmapContent(id, content); + private RoadmapContent 로드맵_컨텐츠를_생성한다(final String content, final Long roadmapId) { + final RoadmapContent roadmapContent = new RoadmapContent(1L, content, roadmapId); + final RoadmapNodes roadmapNodes = new RoadmapNodes( + List.of(new RoadmapNode(1L, "로드맵 노드1 제목", "로드맵 노드1 설명"))); + roadmapContent.addNodes(roadmapNodes); + return roadmapContent; } private List 로드맵_카테고리_리스트를_반환한다() { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapSchedulerTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapSchedulerTest.java index b5506f538..c497ebd7c 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapSchedulerTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapSchedulerTest.java @@ -9,10 +9,7 @@ import co.kirikiri.domain.member.vo.Password; import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; -import co.kirikiri.roadmap.domain.RoadmapContent; import co.kirikiri.roadmap.domain.RoadmapDifficulty; -import co.kirikiri.roadmap.domain.RoadmapNode; -import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.roadmap.persistence.RoadmapRepository; import co.kirikiri.roadmap.service.scheduler.RoadmapScheduler; import org.junit.jupiter.api.Test; @@ -27,6 +24,7 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; @@ -49,28 +47,20 @@ class RoadmapSchedulerTest { @Test void 삭제된_상태의_로드맵_삭제시_종료되지_않은_골룸이_있으면_삭제되지_않는다() { // given - final Member member1 = new Member(new Identifier("identifier1"), + final Member member = new Member(new Identifier("identifier1"), new EncryptedPassword(new Password("password1!")), new Nickname("name1"), null, new MemberProfile(Gender.FEMALE, "kirikiri@email.com")); final RoadmapCategory category = new RoadmapCategory("여행"); - final RoadmapContent roadmapContent1_1 = new RoadmapContent("로드맵 본문2"); - final RoadmapContent roadmapContent1_2 = new RoadmapContent("로드맵 본문2 - 수정본"); - final RoadmapNode roadmapNode1 = new RoadmapNode("로드맵1 노드", "로드맵 노드 내용"); - roadmapContent1_1.addNodes(new RoadmapNodes(List.of(roadmapNode1))); - roadmapContent1_2.addNodes(new RoadmapNodes(List.of(roadmapNode1))); - - final Roadmap roadmap1 = new Roadmap("로드맵2", "로드맵 설명2", 30, RoadmapDifficulty.DIFFICULT, member1.getId(), category); - roadmap1.addContent(roadmapContent1_1); - roadmap1.addContent(roadmapContent1_2); - - given(roadmapRepository.findWithRoadmapContentByStatus(any())) - .willReturn(List.of(roadmap1)); - given(roadmapGoalRoomService.canDeleteGoalRoomsInRoadmap(any())) + final Roadmap roadmap = new Roadmap(1L, "로드맵2", "로드맵 설명2", 30, RoadmapDifficulty.DIFFICULT, member.getId(), category); + + given(roadmapRepository.findByStatus(any())) + .willReturn(List.of(roadmap)); + given(roadmapGoalRoomService.canDeleteGoalRoomsInRoadmap(anyLong())) .willReturn(false); // when - roadmap1.delete(); + roadmap.delete(); // then assertDoesNotThrow(() -> roadmapScheduler.deleteRoadmaps()); @@ -80,25 +70,20 @@ class RoadmapSchedulerTest { @Test void 삭제된_상태의_로드맵_삭제시_골룸이_종료된지_3개월이_지나지_않으면_삭제되지_않는다() { // given - final Member member1 = new Member(new Identifier("identifier1"), + final Member member = new Member(new Identifier("identifier1"), new EncryptedPassword(new Password("password1!")), new Nickname("name1"), null, new MemberProfile(Gender.FEMALE, "kirikiri@email.com")); final RoadmapCategory category = new RoadmapCategory("여행"); - final RoadmapContent roadmapContent1 = new RoadmapContent("로드맵 본문1"); - final RoadmapNode roadmapNode1 = new RoadmapNode("로드맵1 노드", "로드맵 노드 내용"); - roadmapContent1.addNodes(new RoadmapNodes(List.of(roadmapNode1))); - - final Roadmap roadmap1 = new Roadmap("로드맵1", "로드맵 설명1", 30, RoadmapDifficulty.DIFFICULT, member1.getId(), category); - roadmap1.addContent(roadmapContent1); + final Roadmap roadmap = new Roadmap("로드맵1", "로드맵 설명1", 30, RoadmapDifficulty.DIFFICULT, member.getId(), category); - given(roadmapRepository.findWithRoadmapContentByStatus(any())) - .willReturn(List.of(roadmap1)); + given(roadmapRepository.findByStatus(any())) + .willReturn(List.of(roadmap)); given(roadmapGoalRoomService.canDeleteGoalRoomsInRoadmap(any())) .willReturn(false); // when - roadmap1.delete(); + roadmap.delete(); // then assertDoesNotThrow(() -> roadmapScheduler.deleteRoadmaps()); @@ -108,19 +93,7 @@ class RoadmapSchedulerTest { @Test void 삭제된_상태의_로드맵이_없는_경우_삭제되지_않는다() { // given - final Member member1 = new Member(new Identifier("identifier1"), - new EncryptedPassword(new Password("password1!")), new Nickname("name1"), null, - new MemberProfile(Gender.FEMALE, "kirikiri@email.com")); - - final RoadmapCategory category = new RoadmapCategory("여행"); - final RoadmapContent roadmapContent1 = new RoadmapContent("로드맵 본문1"); - final RoadmapNode roadmapNode = new RoadmapNode("로드맵 노드", "로드맵 노드 내용"); - roadmapContent1.addNodes(new RoadmapNodes(List.of(roadmapNode))); - - final Roadmap roadmap1 = new Roadmap("로드맵1", "로드맵 설명1", 30, RoadmapDifficulty.DIFFICULT, member1.getId(), category); - roadmap1.addContent(roadmapContent1); - - given(roadmapRepository.findWithRoadmapContentByStatus(any())) + given(roadmapRepository.findByStatus(any())) .willReturn(Collections.emptyList()); // when diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomCreateServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomCreateServiceTest.java index 0a45fa803..bd9000e23 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomCreateServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomCreateServiceTest.java @@ -30,14 +30,12 @@ import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; -import co.kirikiri.roadmap.domain.RoadmapContents; import co.kirikiri.roadmap.domain.RoadmapDifficulty; import co.kirikiri.roadmap.domain.RoadmapNode; -import co.kirikiri.roadmap.domain.RoadmapNodeImage; -import co.kirikiri.roadmap.domain.RoadmapNodeImages; import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.roadmap.domain.RoadmapStatus; import co.kirikiri.roadmap.persistence.RoadmapContentRepository; +import co.kirikiri.roadmap.persistence.RoadmapRepository; import co.kirikiri.service.dto.goalroom.request.CheckFeedRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomCreateRequest; import co.kirikiri.service.dto.goalroom.request.GoalRoomRoadmapNodeRequest; @@ -78,23 +76,19 @@ class GoalRoomCreateServiceTest { private static final LocalDate TEN_DAY_LATER = TODAY.plusDays(10); private static final LocalDate TWENTY_DAY_LATER = TODAY.plusDays(20); - private static final RoadmapNode ROADMAP_NODE = new RoadmapNode(1L, "title", "content"); - private static final RoadmapContent ROADMAP_CONTENT = new RoadmapContent(1L, "content"); - private static final RoadmapContent DELETED_ROADMAP_CONTENT = new RoadmapContent(2L, "content2"); - private static final RoadmapNodes ROADMAP_CONTENTS = new RoadmapNodes(new ArrayList<>(List.of(ROADMAP_NODE))); - - private static final Member MEMBER = new Member(new Identifier("identifier2"), - new EncryptedPassword(new Password("password!2")), - new Nickname("name2"), null, + private static final Member MEMBER = new Member(new Identifier("identifier1"), + new EncryptedPassword(new Password("password1!")), + new Nickname("name1"), null, new MemberProfile(Gender.FEMALE, "kirikiri@email.com")); - private static final Roadmap ROADMAP = new Roadmap("roadmap", "introduction", 30, RoadmapDifficulty.DIFFICULT, + private static final Roadmap ROADMAP = new Roadmap(1L, "roadmap", "introduction", 30, RoadmapDifficulty.DIFFICULT, MEMBER.getId(), new RoadmapCategory("IT")); - private static final Roadmap DELETED_ROADMAP = new Roadmap("roadmap", "introduction", 30, + private static final Roadmap DELETED_ROADMAP = new Roadmap(2L, "roadmap", "introduction", 30, RoadmapDifficulty.DIFFICULT, RoadmapStatus.DELETED, MEMBER.getId(), new RoadmapCategory("IT")); - private static Member member; + private static final RoadmapContent ROADMAP_CONTENT = new RoadmapContent(1L, "content", ROADMAP.getId()); + private static final RoadmapContent DELETED_ROADMAP_CONTENT = new RoadmapContent(2L, "content2", DELETED_ROADMAP.getId()); @Mock private GoalRoomRepository goalRoomRepository; @@ -102,6 +96,9 @@ class GoalRoomCreateServiceTest { @Mock private GoalRoomMemberRepository goalRoomMemberRepository; + @Mock + private RoadmapRepository roadmapRepository; + @Mock private RoadmapContentRepository roadmapContentRepository; @@ -125,33 +122,29 @@ class GoalRoomCreateServiceTest { @BeforeAll static void setUp() { - ROADMAP_CONTENT.addNodes(ROADMAP_CONTENTS); - ROADMAP.addContent(ROADMAP_CONTENT); - DELETED_ROADMAP.addContent(DELETED_ROADMAP_CONTENT); - final Identifier identifier = new Identifier("identifier1"); - final Password password = new Password("password1!"); - final EncryptedPassword encryptedPassword = new EncryptedPassword(password); - final Nickname nickname = new Nickname("nickname"); - final String email = "kirikiri@email.com"; - final MemberProfile memberProfile = new MemberProfile(Gender.MALE, email); - member = new Member(identifier, encryptedPassword, nickname, null, memberProfile); + final RoadmapNode roadmapNode1 = new RoadmapNode(1L, "title1", "content1"); + final RoadmapNode roadmapNode2 = new RoadmapNode(2L, "title2", "content2"); + ROADMAP_CONTENT.addNodes(new RoadmapNodes(List.of(roadmapNode1, roadmapNode2))); } @Test void 정상적으로_골룸을_생성한다() { //given - final GoalRoomCreateRequest request = new GoalRoomCreateRequest(1L, "name", - 20, new ArrayList<>(List.of(new GoalRoomRoadmapNodeRequest(1L, 10, TODAY, TEN_DAY_LATER)))); + final GoalRoomCreateRequest request = new GoalRoomCreateRequest(1L, "name", 20, + List.of(new GoalRoomRoadmapNodeRequest(1L, 10, TODAY, TEN_DAY_LATER), + new GoalRoomRoadmapNodeRequest(2L, 5, TEN_DAY_LATER.plusDays(1), TWENTY_DAY_LATER))); - given(roadmapContentRepository.findByIdWithRoadmap(anyLong())) + given(roadmapContentRepository.findById(anyLong())) .willReturn(Optional.of(ROADMAP_CONTENT)); + given(roadmapRepository.findById(anyLong())) + .willReturn(Optional.of(ROADMAP)); given(memberRepository.findByIdentifier(any())) - .willReturn(Optional.of(member)); + .willReturn(Optional.of(MEMBER)); given(goalRoomRepository.save(any())) .willReturn(new GoalRoom(1L, null, null, null, null)); //when - assertDoesNotThrow(() -> goalRoomCreateService.create(request, member.getIdentifier().getValue())); + assertDoesNotThrow(() -> goalRoomCreateService.create(request, MEMBER.getIdentifier().getValue())); } @Test @@ -160,12 +153,14 @@ static void setUp() { final GoalRoomCreateRequest request = new GoalRoomCreateRequest(1L, "name", 20, new ArrayList<>(List.of(new GoalRoomRoadmapNodeRequest(1L, 10, TODAY, TEN_DAY_LATER)))); - given(roadmapContentRepository.findByIdWithRoadmap(anyLong())) + given(roadmapContentRepository.findById(anyLong())) .willReturn(Optional.of(DELETED_ROADMAP_CONTENT)); + given(roadmapRepository.findById(anyLong())) + .willReturn(Optional.of(DELETED_ROADMAP)); //when //then - assertThatThrownBy(() -> goalRoomCreateService.create(request, member.getIdentifier().getValue())) + assertThatThrownBy(() -> goalRoomCreateService.create(request, MEMBER.getIdentifier().getValue())) .isInstanceOf(BadRequestException.class); } @@ -175,77 +170,80 @@ static void setUp() { final GoalRoomCreateRequest request = new GoalRoomCreateRequest(1L, "name", 20, new ArrayList<>(List.of(new GoalRoomRoadmapNodeRequest(1L, 10, TODAY, TEN_DAY_LATER)))); - given(roadmapContentRepository.findByIdWithRoadmap(anyLong())) + given(roadmapContentRepository.findById(anyLong())) .willReturn(Optional.empty()); //when //then - assertThatThrownBy(() -> goalRoomCreateService.create(request, member.getIdentifier().getValue())) - .isInstanceOf(NotFoundException.class); + assertThatThrownBy(() -> goalRoomCreateService.create(request, MEMBER.getIdentifier().getValue())) + .isInstanceOf(NotFoundException.class) + .hasMessage("존재하지 않는 로드맵 컨텐츠입니다."); } @Test void 골룸_생성_시_로드맵_컨텐츠의_노드사이즈와_요청의_노드사이즈가_다를때_예외를_던진다() { //given - final List wrongSizeGoalRoomRoadmapNodeRequest = new ArrayList<>(List.of( - new GoalRoomRoadmapNodeRequest(1L, 10, TODAY, TEN_DAY_LATER), - new GoalRoomRoadmapNodeRequest(2L, 10, TODAY, TEN_DAY_LATER))); + final List wrongSizeGoalRoomRoadmapNodeRequest = List.of( + new GoalRoomRoadmapNodeRequest(1L, 10, TODAY, TEN_DAY_LATER)); final GoalRoomCreateRequest request = new GoalRoomCreateRequest(1L, "name", 20, wrongSizeGoalRoomRoadmapNodeRequest); - given(roadmapContentRepository.findByIdWithRoadmap(anyLong())) + given(roadmapContentRepository.findById(anyLong())) .willReturn(Optional.of(ROADMAP_CONTENT)); + given(roadmapRepository.findById(anyLong())) + .willReturn(Optional.of(ROADMAP)); //when //then - assertThatThrownBy(() -> goalRoomCreateService.create(request, member.getIdentifier().getValue())) + assertThatThrownBy(() -> goalRoomCreateService.create(request, MEMBER.getIdentifier().getValue())) .isInstanceOf(BadRequestException.class); } @Test void 골룸_생성_시_로드맵에_존재하지_않는_노드가_요청으로_들어올때_예외를_던진다() { //given - final long wrongRoadmapNodId = 2L; - final GoalRoomCreateRequest request = new GoalRoomCreateRequest(1L, "name", - 20, - new ArrayList<>(List.of(new GoalRoomRoadmapNodeRequest(wrongRoadmapNodId, 10, TODAY, TEN_DAY_LATER)))); + final long wrongRoadmapNodId = 3L; + final GoalRoomCreateRequest request = new GoalRoomCreateRequest(1L, "name", 20, + List.of(new GoalRoomRoadmapNodeRequest(1L, 10, TODAY, TEN_DAY_LATER), + new GoalRoomRoadmapNodeRequest(wrongRoadmapNodId, 5, TEN_DAY_LATER, TWENTY_DAY_LATER))); - given(roadmapContentRepository.findByIdWithRoadmap(anyLong())) + given(roadmapContentRepository.findById(anyLong())) .willReturn(Optional.of(ROADMAP_CONTENT)); + given(roadmapRepository.findById(anyLong())) + .willReturn(Optional.of(ROADMAP)); //when //then - assertThatThrownBy(() -> goalRoomCreateService.create(request, member.getIdentifier().getValue())) + assertThatThrownBy(() -> goalRoomCreateService.create(request, MEMBER.getIdentifier().getValue())) .isInstanceOf(NotFoundException.class); } @Test void 골룸_생성_시_존재하지_않은_회원의_Identifier가_들어올때_예외를_던진다() { //given - final GoalRoomCreateRequest request = new GoalRoomCreateRequest(1L, "name", - 20, new ArrayList<>(List.of(new GoalRoomRoadmapNodeRequest(1L, 10, TODAY, TEN_DAY_LATER)))); + final GoalRoomCreateRequest request = new GoalRoomCreateRequest(1L, "name", 20, + List.of(new GoalRoomRoadmapNodeRequest(1L, 10, TODAY, TEN_DAY_LATER), + new GoalRoomRoadmapNodeRequest(2L, 5, TEN_DAY_LATER.plusDays(1), TWENTY_DAY_LATER))); - given(roadmapContentRepository.findByIdWithRoadmap(anyLong())) + given(roadmapContentRepository.findById(anyLong())) .willReturn(Optional.of(ROADMAP_CONTENT)); + given(roadmapRepository.findById(anyLong())) + .willReturn(Optional.of(ROADMAP)); given(memberRepository.findByIdentifier(any())) .willReturn(Optional.empty()); //when //then - assertThatThrownBy(() -> goalRoomCreateService.create(request, member.getIdentifier().getValue())) + assertThatThrownBy(() -> goalRoomCreateService.create(request, "identifier")) .isInstanceOf(NotFoundException.class); } @Test void 골룸에_참가한다() { //given - final Member creator = 사용자를_생성한다(1L, "cokirikiri", "password1!", "시진이", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); final int limitedMemberCount = 20; - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, targetRoadmapContent, limitedMemberCount); - final Member follower = 사용자를_생성한다(2L, "identifier2", "password1!", "팔로워", "kirikiri1@email"); + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); + final Member follower = 사용자를_생성한다(2L, "identifier2", "password2@", "팔로워", "kirikiri1@email"); when(memberRepository.findByIdentifier(any())) .thenReturn(Optional.of(follower)); @@ -253,7 +251,7 @@ static void setUp() { .thenReturn(Optional.of(goalRoom)); //when - goalRoomCreateService.join("identifier2", 1L); + goalRoomCreateService.join(follower.getIdentifier().getValue(), goalRoom.getId()); //then assertThat(goalRoom.getCurrentMemberCount()) @@ -267,7 +265,7 @@ static void setUp() { .thenReturn(Optional.empty()); //when, then - assertThatThrownBy(() -> goalRoomCreateService.join("identifier2", 1L)) + assertThatThrownBy(() -> goalRoomCreateService.join("identifier", 1L)) .isInstanceOf(NotFoundException.class) .hasMessage("존재하지 않는 회원입니다."); } @@ -275,10 +273,8 @@ static void setUp() { @Test void 골룸_참가_요청시_유효한_골룸_아이디가_아니면_예외가_발생한다() { //given - final Member follower = 사용자를_생성한다(1L, "identifier1", "password1!", "팔로워", "kirikiri1@email"); - when(memberRepository.findByIdentifier(any())) - .thenReturn(Optional.of(follower)); + .thenReturn(Optional.of(MEMBER)); when(goalRoomRepository.findGoalRoomByIdWithPessimisticLock(anyLong())) .thenReturn(Optional.empty()); @@ -291,12 +287,8 @@ static void setUp() { @Test void 골룸_참가_요청시_제한_인원이_가득_찼을_경우_예외가_발생한다() { //given - final Member creator = 사용자를_생성한다(1L, "identifier1", "password1!", "시진이", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); final int limitedMemberCount = 1; - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, targetRoadmapContent, limitedMemberCount); + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); final Member follower = 사용자를_생성한다(1L, "identifier2", "password1!", "팔로워", "kirikiri1@email"); when(memberRepository.findByIdentifier(any())) @@ -305,29 +297,28 @@ static void setUp() { .thenReturn(Optional.of(goalRoom)); //when, then - assertThatThrownBy(() -> goalRoomCreateService.join("identifier2", 1L)) + assertThatThrownBy(() -> goalRoomCreateService.join(follower.getIdentifier().getValue(), goalRoom.getId())) .isInstanceOf(GoalRoomException.class) .hasMessage("제한 인원이 꽉 찬 골룸에는 참여할 수 없습니다."); } @Test void 골룸_참가_요청시_모집_중이_아닌_경우_예외가_발생한다() { - //given - final List roadmapNodes = 로드맵_노드들을_생성한다(); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmapNodes); - final Member creator = 사용자를_생성한다(1L, "identifier1", "password1!", "시진이", "kirikiri1@email"); + // given final int limitedMemberCount = 20; - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, roadmapContent, limitedMemberCount); - final Member follower = 사용자를_생성한다(2L, "identifier2", "password2!", "팔로워", "kirikiri1@email"); + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); goalRoom.start(); + final Member follower = 사용자를_생성한다(2L, "identifier2", "password2!", "팔로워", "kirikiri1@email"); + + // when when(memberRepository.findByIdentifier(any())) .thenReturn(Optional.of(follower)); when(goalRoomRepository.findGoalRoomByIdWithPessimisticLock(anyLong())) .thenReturn(Optional.of(goalRoom)); - //when, then - assertThatThrownBy(() -> goalRoomCreateService.join("identifier2", 1L)) + // then + assertThatThrownBy(() -> goalRoomCreateService.join(follower.getIdentifier().getValue(), 1L)) .isInstanceOf(GoalRoomException.class) .hasMessage("모집 중이지 않은 골룸에는 참여할 수 없습니다."); } @@ -335,18 +326,14 @@ static void setUp() { @Test void 정상적으로_골룸에_투두리스트를_추가한다() { //given - final Member creator = 사용자를_생성한다(1L, "identifier1", "password1!", "시진이", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); final int limitedMemberCount = 20; - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, targetRoadmapContent, limitedMemberCount); + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); goalRoom.addGoalRoomTodo( new GoalRoomToDo(new GoalRoomTodoContent("goalRoomTodoContent"), new Period(TODAY, TEN_DAY_LATER))); given(memberRepository.findByIdentifier(any())) - .willReturn(Optional.of(creator)); + .willReturn(Optional.of(MEMBER)); given(goalRoomRepository.findById(anyLong())) .willReturn(Optional.of(goalRoom)); @@ -355,7 +342,7 @@ static void setUp() { //when //then - assertDoesNotThrow(() -> goalRoomCreateService.addGoalRoomTodo(1L, "identifier1", goalRoomTodoRequest)); + assertDoesNotThrow(() -> goalRoomCreateService.addGoalRoomTodo(1L, MEMBER.getIdentifier().getValue(), goalRoomTodoRequest)); } @Test @@ -369,25 +356,21 @@ static void setUp() { //when //then - assertThatThrownBy(() -> goalRoomCreateService.addGoalRoomTodo(1L, "identifier1", goalRoomTodoRequest)) + assertThatThrownBy(() -> goalRoomCreateService.addGoalRoomTodo(1L, "identifier", goalRoomTodoRequest)) .isInstanceOf(NotFoundException.class); } @Test void 골룸에_투두리스트_추가시_골룸을_찾지_못할_경우_예외를_던진다() { //given - final Member creator = 사용자를_생성한다(1L, "identifier1", "password1!", "시진이", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); final int limitedMemberCount = 20; - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, targetRoadmapContent, limitedMemberCount); + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); goalRoom.addGoalRoomTodo( new GoalRoomToDo(new GoalRoomTodoContent("goalRoomTodoContent"), new Period(TODAY, TEN_DAY_LATER))); given(memberRepository.findByIdentifier(any())) - .willReturn(Optional.of(creator)); + .willReturn(Optional.of(MEMBER)); given(goalRoomRepository.findById(anyLong())) .willReturn(Optional.empty()); @@ -396,26 +379,22 @@ static void setUp() { //when //then - assertThatThrownBy(() -> goalRoomCreateService.addGoalRoomTodo(1L, "identifier1", goalRoomTodoRequest)) + assertThatThrownBy(() -> goalRoomCreateService.addGoalRoomTodo(2L, MEMBER.getIdentifier().getValue(), goalRoomTodoRequest)) .isInstanceOf(NotFoundException.class); } @Test void 골룸에_투두리스트_추가시_종료된_골룸일_경우_예외를_던진다() { //given - final Member creator = 사용자를_생성한다(1L, "identifier1", "password1!", "시진이", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); final int limitedMemberCount = 20; - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, targetRoadmapContent, limitedMemberCount); + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); goalRoom.addGoalRoomTodo( new GoalRoomToDo(new GoalRoomTodoContent("goalRoomTodoContent"), new Period(TODAY, TEN_DAY_LATER))); goalRoom.complete(); given(memberRepository.findByIdentifier(any())) - .willReturn(Optional.of(creator)); + .willReturn(Optional.of(MEMBER)); given(goalRoomRepository.findById(anyLong())) .willReturn(Optional.of(goalRoom)); @@ -424,25 +403,22 @@ static void setUp() { //when //then - assertThatThrownBy(() -> goalRoomCreateService.addGoalRoomTodo(1L, "identifier1", goalRoomTodoRequest)) + assertThatThrownBy(() -> goalRoomCreateService.addGoalRoomTodo(1L, MEMBER.getIdentifier().getValue(), goalRoomTodoRequest)) .isInstanceOf(BadRequestException.class); } @Test void 골룸에_투두리스트_추가시_리더가_아닐_경우_예외를_던진다() { //given - final Member creator = 사용자를_생성한다(1L, "identifier1", "password1!", "시진이", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); final int limitedMemberCount = 20; - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, targetRoadmapContent, limitedMemberCount); + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); + final Member follower = 사용자를_생성한다(2L, "identifier2", "password2@", "팔로워", "kirikiri1@email"); goalRoom.addGoalRoomTodo( new GoalRoomToDo(new GoalRoomTodoContent("goalRoomTodoContent"), new Period(TODAY, TEN_DAY_LATER))); given(memberRepository.findByIdentifier(any())) - .willReturn(Optional.of(member)); + .willReturn(Optional.of(follower)); given(goalRoomRepository.findById(anyLong())) .willReturn(Optional.of(goalRoom)); @@ -451,25 +427,21 @@ static void setUp() { //when //then - assertThatThrownBy(() -> goalRoomCreateService.addGoalRoomTodo(1L, "identifier2", goalRoomTodoRequest)) + assertThatThrownBy(() -> goalRoomCreateService.addGoalRoomTodo(1L, follower.getIdentifier().getValue(), goalRoomTodoRequest)) .isInstanceOf(BadRequestException.class); } @Test void 골룸에_투두리스트_추가시_골룸_컨텐츠가_250글자가_넘을때_예외를_던진다() { //given - final Member creator = 사용자를_생성한다(1L, "identifier1", "password1!", "시진이", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); final int limitedMemberCount = 20; - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, targetRoadmapContent, limitedMemberCount); + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); goalRoom.addGoalRoomTodo( new GoalRoomToDo(new GoalRoomTodoContent("goalRoomTodoContent"), new Period(TODAY, TEN_DAY_LATER))); given(memberRepository.findByIdentifier(any())) - .willReturn(Optional.of(creator)); + .willReturn(Optional.of(MEMBER)); given(goalRoomRepository.findById(anyLong())) .willReturn(Optional.of(goalRoom)); @@ -479,27 +451,23 @@ static void setUp() { //when //then - assertThatThrownBy(() -> goalRoomCreateService.addGoalRoomTodo(1L, "identifier1", goalRoomTodoRequest)) + assertThatThrownBy(() -> goalRoomCreateService.addGoalRoomTodo(1L, MEMBER.getIdentifier().getValue(), goalRoomTodoRequest)) .isInstanceOf(GoalRoomException.class); } @Test void 골룸을_시작한다() { // given - final Member creator = 사용자를_생성한다(1L, "cokirikiri", "password1!", "코끼리", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, targetRoadmapContent, 10); + final int limitedMemberCount = 10; + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); when(memberRepository.findByIdentifier(any())) - .thenReturn(Optional.of(creator)); + .thenReturn(Optional.of(MEMBER)); when(goalRoomRepository.findById(any())) .thenReturn(Optional.of(goalRoom)); // when - goalRoomCreateService.startGoalRoom("cokirikiri", 1L); + goalRoomCreateService.startGoalRoom(MEMBER.getIdentifier().getValue(), 1L); // then assertThat(goalRoom.getStatus()).isEqualTo(RUNNING); @@ -519,10 +487,8 @@ static void setUp() { @Test void 골룸_시작시_존재하지_않는_골룸이면_예외가_발생한다() { // given - final Member member = 사용자를_생성한다(1L, "cokirikiri", "password1!", "코끼리", "kirikiri1@email"); - when(memberRepository.findByIdentifier(any())) - .thenReturn(Optional.of(member)); + .thenReturn(Optional.of(MEMBER)); when(goalRoomRepository.findById(any())) .thenReturn(Optional.empty()); @@ -534,13 +500,9 @@ static void setUp() { @Test void 골룸을_시작하는_사용자가_골룸의_리더가_아니면_예외가_발생한다() { // given - final Member creator = 사용자를_생성한다(1L, "cokirikiri", "password1!", "코끼리", "kirikiri1@email"); + final int limitedMemberCount = 10; + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); final Member follower = 사용자를_생성한다(2L, "kirikirico", "password2!", "끼리코", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, targetRoadmapContent, 10); when(memberRepository.findByIdentifier(any())) .thenReturn(Optional.of(follower)); @@ -548,27 +510,23 @@ static void setUp() { .thenReturn(Optional.of(goalRoom)); // expected - assertThatThrownBy(() -> goalRoomCreateService.startGoalRoom("identifier", 1L)) + assertThatThrownBy(() -> goalRoomCreateService.startGoalRoom(follower.getIdentifier().getValue(), 1L)) .isInstanceOf(BadRequestException.class); } @Test void 골룸_시작시_시작날짜가_아직_지나지_않았으면_예외가_발생한다() { // given - final Member creator = 사용자를_생성한다(1L, "cokirikiri", "password1!", "코끼리", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 시작_날짜가_미래인_골룸을_생성한다(1L, creator, targetRoadmapContent, 10); + final int limitedMemberCount = 10; + final GoalRoom goalRoom = 시작_날짜가_미래인_골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); when(memberRepository.findByIdentifier(any())) - .thenReturn(Optional.of(creator)); + .thenReturn(Optional.of(MEMBER)); when(goalRoomRepository.findById(any())) .thenReturn(Optional.of(goalRoom)); // expected - assertThatThrownBy(() -> goalRoomCreateService.startGoalRoom("cokirikiri", 1L)) + assertThatThrownBy(() -> goalRoomCreateService.startGoalRoom(MEMBER.getIdentifier().getValue(), 1L)) .isInstanceOf(BadRequestException.class); } @@ -577,14 +535,9 @@ static void setUp() { // given final CheckFeedRequest request = 인증_피드_요청_DTO를_생성한다("image/jpeg"); - final Member creator = 사용자를_생성한다(1L, "cokirikiri", "password1!", "코끼리", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, targetRoadmapContent, 20); - final GoalRoomMember goalRoomLeader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, - creator); + final int limitedMemberCount = 10; + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); + final GoalRoomMember goalRoomLeader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, MEMBER); goalRoomMemberRepository.save(goalRoomLeader); final GoalRoomRoadmapNode goalRoomRoadmapNode = goalRoom.getGoalRoomRoadmapNodes().getValues().get(0); final CheckFeed checkFeed = 인증_피드를_생성한다(goalRoomRoadmapNode, goalRoomLeader); @@ -605,7 +558,7 @@ static void setUp() { .thenReturn(makeUrl("originalFileName.jpeg")); // when - final String response = goalRoomCreateService.createCheckFeed("identifier", 1L, request); + final String response = goalRoomCreateService.createCheckFeed(MEMBER.getIdentifier().getValue(), 1L, request); // then assertAll( @@ -617,16 +570,9 @@ static void setUp() { @Test void 인증_피드_등록시_노드_기간에_해당하지_않으면_예외가_발생한다() { // given - final CheckFeedRequest request = 인증_피드_요청_DTO를_생성한다("image/jpeg"); - - final Member creator = 사용자를_생성한다(1L, "cokirikiri", "password1!", "코끼리", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 시작_날짜가_미래인_골룸을_생성한다(1L, creator, targetRoadmapContent, 20); - final GoalRoomMember goalRoomLeader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, - creator); + final int limitedMemberCount = 20; + final GoalRoom goalRoom = 시작_날짜가_미래인_골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); + final GoalRoomMember goalRoomLeader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, MEMBER); goalRoomMemberRepository.save(goalRoomLeader); when(goalRoomRepository.findById(anyLong())) @@ -634,9 +580,12 @@ static void setUp() { when(goalRoomMemberRepository.findByGoalRoomAndMemberIdentifier(any(), any())) .thenReturn(Optional.of(goalRoomLeader)); - // expected + // when + final CheckFeedRequest request = 인증_피드_요청_DTO를_생성한다("image/jpeg"); + + // then assertThatThrownBy( - () -> goalRoomCreateService.createCheckFeed("identifier", 1L, request)) + () -> goalRoomCreateService.createCheckFeed(MEMBER.getIdentifier().getValue(), goalRoom.getId(), request)) .isInstanceOf(BadRequestException.class) .hasMessage("인증 피드는 노드 기간 내에만 작성할 수 있습니다."); } @@ -644,17 +593,11 @@ static void setUp() { @Test void 하루에_두_번_이상_인증_피드_등록_요청_시_예외를_반환한다() { // given - final CheckFeedRequest request = 인증_피드_요청_DTO를_생성한다("image/jpeg"); - - final Member creator = 사용자를_생성한다(1L, "cokirikiri", "password1!", "코끼리", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, targetRoadmapContent, 20); - final GoalRoomMember goalRoomLeader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, - creator); + final int limitedMemberCount = 20; + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); + final GoalRoomMember goalRoomLeader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, MEMBER); goalRoomMemberRepository.save(goalRoomLeader); + final GoalRoomRoadmapNode goalRoomRoadmapNode = goalRoom.getGoalRoomRoadmapNodes().getValues().get(0); final CheckFeed checkFeed = 인증_피드를_생성한다(goalRoomRoadmapNode, goalRoomLeader); @@ -665,9 +608,12 @@ static void setUp() { when(checkFeedRepository.findByGoalRoomMemberAndDateTime(any(), any(), any())) .thenReturn(Optional.of(checkFeed)); - //expect + // when + final CheckFeedRequest request = 인증_피드_요청_DTO를_생성한다("image/jpeg"); + + // then assertThatThrownBy( - () -> goalRoomCreateService.createCheckFeed("identifier", 1L, request)) + () -> goalRoomCreateService.createCheckFeed(MEMBER.getIdentifier().getValue(), goalRoom.getId(), request)) .isInstanceOf(BadRequestException.class) .hasMessage("이미 오늘 인증 피드를 등록하였습니다."); } @@ -675,16 +621,10 @@ static void setUp() { @Test void 골룸_노드에서_허가된_인증_횟수보다_많은_인증_피드_등록_요청_시_예외를_반환한다() { // given - final CheckFeedRequest request = 인증_피드_요청_DTO를_생성한다("image/jpeg"); - - final Member creator = 사용자를_생성한다(1L, "cokirikiri", "password1!", "코끼리", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); + final int limitedMemberCount = 20; + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); + final GoalRoomMember goalRoomLeader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, MEMBER); - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, targetRoadmapContent, 20); - final GoalRoomMember goalRoomLeader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, - creator); goalRoomMemberRepository.save(goalRoomLeader); final GoalRoomRoadmapNode goalRoomRoadmapNode = goalRoom.getGoalRoomRoadmapNodes().getValues().get(0); @@ -695,9 +635,12 @@ static void setUp() { when(checkFeedRepository.countByGoalRoomMemberAndGoalRoomRoadmapNode(any(), any())) .thenReturn(goalRoomRoadmapNode.getCheckCount()); - //expect + // when + final CheckFeedRequest request = 인증_피드_요청_DTO를_생성한다("image/jpeg"); + + // then assertThatThrownBy( - () -> goalRoomCreateService.createCheckFeed("identifier", 1L, request)) + () -> goalRoomCreateService.createCheckFeed(MEMBER.getIdentifier().getValue(), goalRoom.getId(), request)) .isInstanceOf(BadRequestException.class) .hasMessage("이번 노드에는 최대 " + goalRoomRoadmapNode.getCheckCount() + "번만 인증 피드를 등록할 수 있습니다."); } @@ -705,18 +648,10 @@ static void setUp() { @Test void 인증_피드_등록_요청_시_허용되지_않는_확장자_형식이라면_예외를_반환한다() { // given - final CheckFeedRequest request = 인증_피드_요청_DTO를_생성한다("image/gif"); - - final Member creator = 사용자를_생성한다(1L, "cokirikiri", "password1!", "코끼리", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, targetRoadmapContent, 20); - final GoalRoomMember goalRoomLeader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, - creator); + final int limitedMemberCount = 20; + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); + final GoalRoomMember goalRoomLeader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, MEMBER); goalRoomMemberRepository.save(goalRoomLeader); - final GoalRoomRoadmapNode goalRoomRoadmapNode = goalRoom.getGoalRoomRoadmapNodes().getValues().get(0); when(goalRoomRepository.findById(any())) .thenReturn(Optional.of(goalRoom)); @@ -724,8 +659,11 @@ static void setUp() { .thenReturn(Optional.of(goalRoomLeader)); // when + final CheckFeedRequest request = 인증_피드_요청_DTO를_생성한다("image/gif"); + + // then assertThatThrownBy( - () -> goalRoomCreateService.createCheckFeed("identifier", 1L, request)) + () -> goalRoomCreateService.createCheckFeed(MEMBER.getIdentifier().getValue(), goalRoom.getId(), request)) .isInstanceOf(ImageExtensionException.class) .hasMessage("허용되지 않는 확장자입니다."); } @@ -733,23 +671,20 @@ static void setUp() { @Test void 인증_피드_등록_요청_시_존재하지_않는_골룸이라면_예외를_반환한다() { // given - final CheckFeedRequest request = 인증_피드_요청_DTO를_생성한다("image/jpeg"); - - final Member creator = 사용자를_생성한다(1L, "cokirikiri", "password1!", "코끼리", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, targetRoadmapContent, 20); - final GoalRoomMember goalRoomLeader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, - creator); + final int limitedMemberCount = 20; + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); + final GoalRoomMember goalRoomLeader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, MEMBER); goalRoomMemberRepository.save(goalRoomLeader); when(goalRoomRepository.findById(any())) .thenReturn(Optional.empty()); - //expect + // when + final CheckFeedRequest request = 인증_피드_요청_DTO를_생성한다("image/jpeg"); + + // then assertThatThrownBy( - () -> goalRoomCreateService.createCheckFeed("identifier", 1L, request)) + () -> goalRoomCreateService.createCheckFeed(MEMBER.getIdentifier().getValue(), goalRoom.getId(), request)) .isInstanceOf(NotFoundException.class) .hasMessage("존재하지 않는 골룸입니다. goalRoomId = 1"); } @@ -757,16 +692,9 @@ static void setUp() { @Test void 인증_피드_등록_요청_시_사용자가_참여하지_않은_골룸이라면_예외를_반환한다() { // given - final CheckFeedRequest request = 인증_피드_요청_DTO를_생성한다("image/jpeg"); - - final Member creator = 사용자를_생성한다(1L, "cokirikiri", "password1!", "코끼리", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, targetRoadmapContent, 20); - - final GoalRoomMember goalRoomLeader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, - creator); + final int limitedMemberCount = 20; + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); + final GoalRoomMember goalRoomLeader = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, MEMBER); goalRoomMemberRepository.save(goalRoomLeader); when(goalRoomRepository.findById(any())) @@ -774,9 +702,12 @@ static void setUp() { when(goalRoomMemberRepository.findByGoalRoomAndMemberIdentifier(any(), any())) .thenReturn(Optional.empty()); - //expect + // when + final CheckFeedRequest request = 인증_피드_요청_DTO를_생성한다("image/jpeg"); + + // then assertThatThrownBy( - () -> goalRoomCreateService.createCheckFeed("identifier", 1L, request)) + () -> goalRoomCreateService.createCheckFeed("identifier", goalRoom.getId(), request)) .isInstanceOf(NotFoundException.class) .hasMessage("골룸에 해당 사용자가 존재하지 않습니다. 사용자 아이디 = " + "identifier"); } @@ -784,29 +715,21 @@ static void setUp() { @Test void 투두리스트를_체크한다() { // given - final Member creator = 사용자를_생성한다(1L, "cokirikiri", "password1!", "코끼리", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, targetRoadmapContent, 10); + final int limitedMemberCount = 10; + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); goalRoom.addGoalRoomTodo(new GoalRoomToDo( - 1L, new GoalRoomTodoContent("투두 1"), new Period(TODAY, TODAY.plusDays(3)) - )); - final GoalRoomMember goalRoomMember = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, - creator); + 1L, new GoalRoomTodoContent("투두 1"), new Period(TODAY, TODAY.plusDays(3)))); + final GoalRoomMember goalRoomMember = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, MEMBER); when(goalRoomRepository.findByIdWithTodos(anyLong())) .thenReturn(Optional.of(goalRoom)); - when(goalRoomMemberRepository.findByGoalRoomAndMemberIdentifier(any(), any())) .thenReturn(Optional.of(goalRoomMember)); - when(goalRoomToDoCheckRepository.findByGoalRoomIdAndTodoAndMemberIdentifier(any(), any(), any())) .thenReturn(Optional.empty()); // when - final GoalRoomToDoCheckResponse checkResponse = goalRoomCreateService.checkGoalRoomTodo(1L, 1L, "cokirikiri"); + final GoalRoomToDoCheckResponse checkResponse = goalRoomCreateService.checkGoalRoomTodo(goalRoom.getId(), 1L, MEMBER.getIdentifier().getValue()); // then assertThat(checkResponse) @@ -816,31 +739,24 @@ static void setUp() { @Test void 투두리스트_체크시_체크_이력이_있으면_제거한다() { // given - final Member creator = 사용자를_생성한다(1L, "cokirikiri", "password1!", "코끼리", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, targetRoadmapContent, 10); + final int limitedMemberCount = 10; + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); final GoalRoomToDo goalRoomToDo = new GoalRoomToDo( 1L, new GoalRoomTodoContent("투두 1"), new Period(TODAY, TODAY.plusDays(3))); goalRoom.addGoalRoomTodo(goalRoomToDo); - final GoalRoomMember goalRoomMember = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, - creator); + final GoalRoomMember goalRoomMember = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, MEMBER); final GoalRoomToDoCheck goalRoomToDoCheck = new GoalRoomToDoCheck(goalRoomMember, goalRoomToDo); when(goalRoomRepository.findByIdWithTodos(anyLong())) .thenReturn(Optional.of(goalRoom)); - when(goalRoomMemberRepository.findByGoalRoomAndMemberIdentifier(any(), any())) .thenReturn(Optional.of(goalRoomMember)); - when(goalRoomToDoCheckRepository.findByGoalRoomIdAndTodoAndMemberIdentifier(any(), any(), any())) .thenReturn(Optional.of(goalRoomToDoCheck)); // when - final GoalRoomToDoCheckResponse checkResponse = goalRoomCreateService.checkGoalRoomTodo(1L, 1L, "cokirikiri"); + final GoalRoomToDoCheckResponse checkResponse = goalRoomCreateService.checkGoalRoomTodo(goalRoom.getId(), 1L, MEMBER.getIdentifier().getValue()); // then assertThat(checkResponse) @@ -862,12 +778,8 @@ static void setUp() { @Test void 투두리스트_체크시_해당_투두가_존재하지_않으면_예외가_발생한다() { // given - final Member creator = 사용자를_생성한다(1L, "cokirikiri", "password1!", "코끼리", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, targetRoadmapContent, 10); + final int limitedMemberCount = 10; + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); goalRoom.addGoalRoomTodo(new GoalRoomToDo( 1L, new GoalRoomTodoContent("투두 1"), new Period(TODAY, TODAY.plusDays(3)))); @@ -875,7 +787,7 @@ static void setUp() { .thenReturn(Optional.of(goalRoom)); // expected - assertThatThrownBy(() -> goalRoomCreateService.checkGoalRoomTodo(1L, 2L, "cokirikiri")) + assertThatThrownBy(() -> goalRoomCreateService.checkGoalRoomTodo(goalRoom.getId(), 2L, MEMBER.getIdentifier().getValue())) .isInstanceOf(NotFoundException.class) .hasMessage("존재하지 않는 투두입니다. todoId = 2"); } @@ -883,23 +795,18 @@ static void setUp() { @Test void 투두리스트_체크시_골룸에_사용자가_없으면_예외가_발생한다() { // given - final Member creator = 사용자를_생성한다(1L, "cokirikiri", "password1!", "코끼리", "kirikiri1@email"); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(1L, creator, targetRoadmapContent, 10); + final int limitedMemberCount = 10; + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); goalRoom.addGoalRoomTodo(new GoalRoomToDo( 1L, new GoalRoomTodoContent("투두 1"), new Period(TODAY, TODAY.plusDays(3)))); when(goalRoomRepository.findByIdWithTodos(anyLong())) .thenReturn(Optional.of(goalRoom)); - when(goalRoomMemberRepository.findByGoalRoomAndMemberIdentifier(any(), any())) .thenReturn(Optional.empty()); // expected - assertThatThrownBy(() -> goalRoomCreateService.checkGoalRoomTodo(1L, 1L, "cokirikiri")) + assertThatThrownBy(() -> goalRoomCreateService.checkGoalRoomTodo(goalRoom.getId(), 1L, "cokirikiri")) .isInstanceOf(NotFoundException.class) .hasMessage("골룸에 사용자가 존재하지 않습니다. goalRoomId = 1 memberIdentifier = cokirikiri"); } @@ -907,8 +814,8 @@ static void setUp() { @Test void 골룸을_나간다() { // given - final GoalRoom goalRoom = new GoalRoom(1L, new GoalRoomName("골룸"), new LimitedMemberCount(3), - new RoadmapContent("content"), MEMBER); + final int limitedMemberCount = 20; + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); given(memberRepository.findByIdentifier(any())) .willReturn(Optional.of(MEMBER)); @@ -917,7 +824,7 @@ static void setUp() { // when // then - assertDoesNotThrow(() -> goalRoomCreateService.leave("identifier2", 1L)); + assertDoesNotThrow(() -> goalRoomCreateService.leave(MEMBER.getIdentifier().getValue(), goalRoom.getId())); } @@ -937,24 +844,24 @@ static void setUp() { void 골룸을_나갈때_존재하지_않는_골룸일_경우_예외가_발생한다() { // given given(memberRepository.findByIdentifier(any())) - .willReturn(Optional.of(member)); + .willReturn(Optional.of(MEMBER)); given(goalRoomRepository.findById(anyLong())) .willReturn(Optional.empty()); // when // then - assertThatThrownBy(() -> goalRoomCreateService.leave("identifier2", 1L)) + assertThatThrownBy(() -> goalRoomCreateService.leave(MEMBER.getIdentifier().getValue(), 1L)) .isInstanceOf(NotFoundException.class); } @Test void 골룸을_나갈때_골룸이_진행중이면_예외가_발생한다() { // given - final GoalRoom goalRoom = new GoalRoom(1L, new GoalRoomName("골룸"), new LimitedMemberCount(3), - new RoadmapContent("content"), MEMBER); + final int limitedMemberCount = 20; + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); given(memberRepository.findByIdentifier(any())) - .willReturn(Optional.of(member)); + .willReturn(Optional.of(MEMBER)); given(goalRoomRepository.findById(anyLong())) .willReturn(Optional.of(goalRoom)); @@ -962,23 +869,23 @@ static void setUp() { goalRoom.start(); // then - assertThatThrownBy(() -> goalRoomCreateService.leave("identifier2", 1L)) + assertThatThrownBy(() -> goalRoomCreateService.leave(MEMBER.getIdentifier().getValue(), goalRoom.getId())) .isInstanceOf(BadRequestException.class); } @Test void 골룸을_나갈때_골룸에_남아있는_사용자가_없으면_골룸이_삭제된다() { // given - final GoalRoom goalRoom = new GoalRoom(1L, new GoalRoomName("골룸"), new LimitedMemberCount(3), - new RoadmapContent("content"), MEMBER); + final int limitedMemberCount = 20; + final GoalRoom goalRoom = 골룸을_생성한다(1L, MEMBER, ROADMAP_CONTENT, limitedMemberCount); given(memberRepository.findByIdentifier(any())) - .willReturn(Optional.of(member)); + .willReturn(Optional.of(MEMBER)); given(goalRoomRepository.findById(anyLong())) .willReturn(Optional.of(goalRoom)); // when - goalRoomCreateService.leave("identifier2", 1L); + goalRoomCreateService.leave(MEMBER.getIdentifier().getValue(), goalRoom.getId()); // then verify(goalRoomRepository, times(1)).delete(goalRoom); @@ -987,40 +894,10 @@ static void setUp() { private Member 사용자를_생성한다(final Long memberId, final String identifier, final String password, final String nickname, final String email) { final MemberProfile memberProfile = new MemberProfile(Gender.MALE, email); - return new Member(memberId, new Identifier(identifier), null, new EncryptedPassword(new Password(password)), new Nickname(nickname), null, memberProfile); } - private Roadmap 로드맵을_생성한다(final Member creator) { - final RoadmapCategory category = new RoadmapCategory("게임"); - final List roadmapNodes = 로드맵_노드들을_생성한다(); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmapNodes); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); - roadmap.addContent(roadmapContent); - return roadmap; - } - - private List 로드맵_노드들을_생성한다() { - final RoadmapNode roadmapNode1 = new RoadmapNode("로드맵 1주차", "로드맵 1주차 내용"); - roadmapNode1.addImages(new RoadmapNodeImages(노드_이미지들을_생성한다())); - final RoadmapNode roadmapNode2 = new RoadmapNode("로드맵 2주차", "로드맵 2주차 내용"); - return List.of(roadmapNode1, roadmapNode2); - } - - private RoadmapContent 로드맵_본문을_생성한다(final List roadmapNodes) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); - roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); - return roadmapContent; - } - - private List 노드_이미지들을_생성한다() { - return List.of( - new RoadmapNodeImage("node-image1.png", "node-image1-save-path", ImageContentType.PNG), - new RoadmapNodeImage("node-image2.png", "node-image2-save-path", ImageContentType.PNG) - ); - } - private GoalRoom 골룸을_생성한다(final Long goalRoomId, final Member creator, final RoadmapContent roadmapContent, final Integer limitedMemberCount) { final GoalRoom goalRoom = new GoalRoom(goalRoomId, new GoalRoomName("골룸 이름"), diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomReadServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomReadServiceTest.java index 12d69ca0a..8a7e52db7 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomReadServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomReadServiceTest.java @@ -31,7 +31,6 @@ import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; -import co.kirikiri.roadmap.domain.RoadmapContents; import co.kirikiri.roadmap.domain.RoadmapDifficulty; import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodeImage; @@ -112,10 +111,8 @@ class GoalRoomReadServiceTest { // given final Member creator = 크리에이터를_생성한다(); final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(creator, targetRoadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmapContent); when(goalRoomRepository.findByIdWithRoadmapContent(any())) .thenReturn(Optional.of(goalRoom)); @@ -145,10 +142,8 @@ class GoalRoomReadServiceTest { // given final Member creator = 크리에이터를_생성한다(); final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(creator, targetRoadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmapContent); final GoalRoomPendingMember goalRoomPendingMember = new GoalRoomPendingMember(GoalRoomRole.LEADER, LocalDateTime.of(2023, 7, 19, 12, 0, 0), goalRoom, creator); @@ -173,10 +168,8 @@ class GoalRoomReadServiceTest { // given final Member creator = 크리에이터를_생성한다(); final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(creator, targetRoadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmapContent); when(goalRoomRepository.findByIdWithRoadmapContent(any())) .thenReturn(Optional.of(goalRoom)); @@ -198,10 +191,8 @@ class GoalRoomReadServiceTest { // given final Member creator = 크리에이터를_생성한다(); final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(creator, targetRoadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmapContent); goalRoom.start(); final GoalRoomMember goalRoomMember = new GoalRoomMember(GoalRoomRole.LEADER, @@ -227,10 +218,8 @@ class GoalRoomReadServiceTest { // given final Member creator = 크리에이터를_생성한다(); final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(creator, targetRoadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmapContent); goalRoom.start(); when(goalRoomRepository.findByIdWithRoadmapContent(any())) @@ -262,17 +251,16 @@ class GoalRoomReadServiceTest { @Test void 정상적으로_진행중인_골룸의_참여자를_조회한다() throws MalformedURLException { //given - final Member creator = 사용자를_생성한다(1L); + final Member creator = 크리에이터를_생성한다(); final Member follower = 사용자를_생성한다(2L); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmap.getContents().getValues().get(0)); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmapContent); goalRoom.start(); final GoalRoomMember goalRoomMemberCreator = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, creator); - final GoalRoomMember goalRoomMemberFollower = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), + final GoalRoomMember goalRoomMemberFollower = new GoalRoomMember(GoalRoomRole.FOLLOWER, LocalDateTime.now(), goalRoom, follower); given(goalRoomRepository.findById(anyLong())) @@ -287,7 +275,7 @@ class GoalRoomReadServiceTest { GoalRoomMemberSortTypeDto.ACCOMPLISHMENT_RATE); //then - final GoalRoomMemberResponse expectedGoalRoomMemberResponse1 = new GoalRoomMemberResponse(1L, "name1", + final GoalRoomMemberResponse expectedGoalRoomMemberResponse1 = new GoalRoomMemberResponse(1L, "코끼리", "http://example.com/serverFilePath", 0.0); final GoalRoomMemberResponse expectedGoalRoomMemberResponse2 = new GoalRoomMemberResponse(2L, "name1", "http://example.com/serverFilePath", 0.0); @@ -299,17 +287,16 @@ class GoalRoomReadServiceTest { @Test void 정상적으로_완료된_골룸의_참여자를_조회한다() throws MalformedURLException { //given - final Member creator = 사용자를_생성한다(1L); final Member follower = 사용자를_생성한다(2L); - + final Member creator = 크리에이터를_생성한다(); final Roadmap roadmap = 로드맵을_생성한다(creator); - - final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmap.getContents().getValues().get(0)); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmapContent); goalRoom.complete(); final GoalRoomMember goalRoomMemberCreator = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, creator); - final GoalRoomMember goalRoomMemberFollower = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), + final GoalRoomMember goalRoomMemberFollower = new GoalRoomMember(GoalRoomRole.FOLLOWER, LocalDateTime.now(), goalRoom, follower); given(goalRoomRepository.findById(anyLong())) @@ -324,7 +311,7 @@ class GoalRoomReadServiceTest { GoalRoomMemberSortTypeDto.ACCOMPLISHMENT_RATE); //then - final GoalRoomMemberResponse expectedGoalRoomMemberResponse1 = new GoalRoomMemberResponse(1L, "name1", + final GoalRoomMemberResponse expectedGoalRoomMemberResponse1 = new GoalRoomMemberResponse(1L, "코끼리", "http://example.com/serverFilePath", 0.0); final GoalRoomMemberResponse expectedGoalRoomMemberResponse2 = new GoalRoomMemberResponse(2L, "name1", "http://example.com/serverFilePath", 0.0); @@ -338,14 +325,13 @@ class GoalRoomReadServiceTest { //given final Member creator = 사용자를_생성한다(1L); final Member follower = 사용자를_생성한다(2L); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmap.getContents().getValues().get(0)); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmapContent); final GoalRoomPendingMember goalRoomMemberCreator = new GoalRoomPendingMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, creator); - final GoalRoomPendingMember goalRoomMemberFollower = new GoalRoomPendingMember(GoalRoomRole.LEADER, + final GoalRoomPendingMember goalRoomMemberFollower = new GoalRoomPendingMember(GoalRoomRole.FOLLOWER, LocalDateTime.now(), goalRoom, follower); given(goalRoomRepository.findById(anyLong())) @@ -385,9 +371,10 @@ class GoalRoomReadServiceTest { @Test void 골룸의_전체_투두리스트를_조회한다() { // given - final Member creator = 사용자를_생성한다(1L); + final Member creator = 크리에이터를_생성한다(); final Roadmap roadmap = 로드맵을_생성한다(creator); - final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmap.getContents().getValues().get(0)); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmapContent); final GoalRoomToDo firstGoalRoomTodo = new GoalRoomToDo(1L, new GoalRoomTodoContent("투두 1"), new Period(TODAY, TEN_DAY_LATER)); @@ -433,9 +420,10 @@ class GoalRoomReadServiceTest { @Test void 골룸의_투두리스트_조회시_골룸에_참여하지_않은_사용자면_예외가_발생한다() { // given - final Member creator = 사용자를_생성한다(1L); + final Member creator = 크리에이터를_생성한다(); final Roadmap roadmap = 로드맵을_생성한다(creator); - final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmap.getContents().getValues().get(0)); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmapContent); final GoalRoomToDo firstGoalRoomTodo = new GoalRoomToDo(1L, new GoalRoomTodoContent("투두 1"), new Period(TODAY, TEN_DAY_LATER)); @@ -457,13 +445,13 @@ class GoalRoomReadServiceTest { @Test void 진행중인_사용자_단일_골룸을_조회한다() throws MalformedURLException { // given + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", 1L); final RoadmapNode roadmapNode1 = new RoadmapNode("로드맵 1주차", "로드맵 1주차 내용"); final RoadmapNode roadmapNode2 = new RoadmapNode("로드맵 2주차", "로드맵 2주차 내용"); final RoadmapNode roadmapNode3 = new RoadmapNode("로드맵 3주차", "로드맵 3주차 내용"); final RoadmapNode roadmapNode4 = new RoadmapNode("로드맵 4주차", "로드맵 4주차 내용"); final RoadmapNodes roadmapNodes = new RoadmapNodes( List.of(roadmapNode1, roadmapNode2, roadmapNode3, roadmapNode4)); - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); roadmapContent.addNodes(roadmapNodes); final GoalRoomRoadmapNode goalRoomRoadmapNode1 = new GoalRoomRoadmapNode( @@ -523,13 +511,13 @@ class GoalRoomReadServiceTest { @Test void 모집중인_사용자_단일_골룸_조회시_인증피드가_빈_응답을_반환한다() { // given + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", 1L); final RoadmapNode roadmapNode1 = new RoadmapNode("로드맵 1주차", "로드맵 1주차 내용"); final RoadmapNode roadmapNode2 = new RoadmapNode("로드맵 2주차", "로드맵 2주차 내용"); final RoadmapNode roadmapNode3 = new RoadmapNode("로드맵 3주차", "로드맵 3주차 내용"); final RoadmapNode roadmapNode4 = new RoadmapNode("로드맵 4주차", "로드맵 4주차 내용"); final RoadmapNodes roadmapNodes = new RoadmapNodes( List.of(roadmapNode1, roadmapNode2, roadmapNode3, roadmapNode4)); - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); roadmapContent.addNodes(roadmapNodes); final GoalRoomRoadmapNode goalRoomRoadmapNode1 = new GoalRoomRoadmapNode( @@ -576,13 +564,13 @@ class GoalRoomReadServiceTest { @Test void 종료된_사용자_단일_골룸을_조회시_전체_인증피드를_대상으로_반환한다() throws MalformedURLException { // given + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", 1L); final RoadmapNode roadmapNode1 = new RoadmapNode("로드맵 1주차", "로드맵 1주차 내용"); final RoadmapNode roadmapNode2 = new RoadmapNode("로드맵 2주차", "로드맵 2주차 내용"); final RoadmapNode roadmapNode3 = new RoadmapNode("로드맵 3주차", "로드맵 3주차 내용"); final RoadmapNode roadmapNode4 = new RoadmapNode("로드맵 4주차", "로드맵 4주차 내용"); final RoadmapNodes roadmapNodes = new RoadmapNodes( List.of(roadmapNode1, roadmapNode2, roadmapNode3, roadmapNode4)); - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); roadmapContent.addNodes(roadmapNodes); final GoalRoomRoadmapNode goalRoomRoadmapNode1 = new GoalRoomRoadmapNode( @@ -661,10 +649,8 @@ class GoalRoomReadServiceTest { // given final Member creator = 크리에이터를_생성한다(); final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(creator, targetRoadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmapContent); when(goalRoomRepository.findByIdWithContentAndTodos(anyLong())) .thenReturn(Optional.of(goalRoom)); @@ -683,10 +669,8 @@ class GoalRoomReadServiceTest { final Member creator = 크리에이터를_생성한다(); final Member member = 사용자를_생성한다(2L); final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom = 골룸을_생성한다(creator, targetRoadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmapContent); when(goalRoomRepository.findByIdWithContentAndTodos(anyLong())) .thenReturn(Optional.of(goalRoom)); @@ -704,13 +688,12 @@ class GoalRoomReadServiceTest { // given final Member creator = 크리에이터를_생성한다(); final Roadmap roadmap = 로드맵을_생성한다(creator); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom1 = 골룸을_생성한다(creator, targetRoadmapContent); - 골룸을_생성한다(creator, targetRoadmapContent); - final GoalRoom goalRoom3 = 골룸을_생성한다(creator, targetRoadmapContent); - 골룸을_생성한다(creator, targetRoadmapContent); + final GoalRoom goalRoom1 = 골룸을_생성한다(creator, roadmapContent); + 골룸을_생성한다(creator, roadmapContent); + final GoalRoom goalRoom3 = 골룸을_생성한다(creator, roadmapContent); + 골룸을_생성한다(creator, roadmapContent); final Member member = 사용자를_생성한다(2L); goalRoom1.join(member); @@ -746,15 +729,15 @@ THIRTY_DAY_LATER, new MemberResponse(creator.getId(), creator.getNickname().getV @Test void 사용자_골룸_목룩_조회_중_참여한_골룸이없으면_빈_리스트를_반환한다() { // given - final Member creator = 크리에이터를_생성한다(); + final Member member = 사용자를_생성한다(1L); when(memberRepository.findByIdentifier(any())) - .thenReturn(Optional.of(creator)); + .thenReturn(Optional.of(member)); when(goalRoomRepository.findByMember(any())) .thenReturn(Collections.emptyList()); // when - final List response = goalRoomReadService.findMemberGoalRooms("identifier1"); + final List response = goalRoomReadService.findMemberGoalRooms(member.getIdentifier().getValue()); // then assertThat(response).isEmpty(); @@ -764,13 +747,11 @@ THIRTY_DAY_LATER, new MemberResponse(creator.getId(), creator.getNickname().getV void 사용자_골룸_목록_중_모집_중인_상태만_조회한다() throws MalformedURLException { final Member creator = 크리에이터를_생성한다(); final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom1 = 골룸을_생성한다(creator, targetRoadmapContent); - final GoalRoom goalRoom2 = 골룸을_생성한다(creator, targetRoadmapContent); - final GoalRoom goalRoom3 = 골룸을_생성한다(creator, targetRoadmapContent); - final GoalRoom goalRoom4 = 골룸을_생성한다(creator, targetRoadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom1 = 골룸을_생성한다(creator, roadmapContent); + final GoalRoom goalRoom2 = 골룸을_생성한다(creator, roadmapContent); + final GoalRoom goalRoom3 = 골룸을_생성한다(creator, roadmapContent); + final GoalRoom goalRoom4 = 골룸을_생성한다(creator, roadmapContent); final Member member = 사용자를_생성한다(2L); goalRoom1.join(member); @@ -814,13 +795,11 @@ THIRTY_DAY_LATER, new MemberResponse(creator.getId(), creator.getNickname().getV void 사용자_골룸_목록_중_진행_중인_상태만_조회한다() throws MalformedURLException { final Member creator = 크리에이터를_생성한다(); final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom1 = 골룸을_생성한다(creator, targetRoadmapContent); - final GoalRoom goalRoom2 = 골룸을_생성한다(creator, targetRoadmapContent); - final GoalRoom goalRoom3 = 골룸을_생성한다(creator, targetRoadmapContent); - final GoalRoom goalRoom4 = 골룸을_생성한다(creator, targetRoadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom1 = 골룸을_생성한다(creator, roadmapContent); + final GoalRoom goalRoom2 = 골룸을_생성한다(creator, roadmapContent); + final GoalRoom goalRoom3 = 골룸을_생성한다(creator, roadmapContent); + final GoalRoom goalRoom4 = 골룸을_생성한다(creator, roadmapContent); final Member member = 사용자를_생성한다(2L); goalRoom1.join(member); @@ -871,13 +850,11 @@ THIRTY_DAY_LATER, new MemberResponse(creator.getId(), creator.getNickname().getV void 사용자_골룸_목록_중_종료된_상태만_조회한다() throws MalformedURLException { final Member creator = 크리에이터를_생성한다(); final Roadmap roadmap = 로드맵을_생성한다(creator); - - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom1 = 골룸을_생성한다(creator, targetRoadmapContent); - final GoalRoom goalRoom2 = 골룸을_생성한다(creator, targetRoadmapContent); - final GoalRoom goalRoom3 = 골룸을_생성한다(creator, targetRoadmapContent); - final GoalRoom goalRoom4 = 골룸을_생성한다(creator, targetRoadmapContent); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom1 = 골룸을_생성한다(creator, roadmapContent); + final GoalRoom goalRoom2 = 골룸을_생성한다(creator, roadmapContent); + final GoalRoom goalRoom3 = 골룸을_생성한다(creator, roadmapContent); + final GoalRoom goalRoom4 = 골룸을_생성한다(creator, roadmapContent); final Member member = 사용자를_생성한다(2L); goalRoom1.join(member); @@ -927,9 +904,10 @@ THIRTY_DAY_LATER, new MemberResponse(creator.getId(), creator.getNickname().getV @Test void 골룸의_전체_노드를_조회한다() throws MalformedURLException { // given - final Member creator = 사용자를_생성한다(1L); + final Member creator = 크리에이터를_생성한다(); final Roadmap roadmap = 로드맵을_생성한다(creator); - final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmap.getContents().getValues().get(0)); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmapContent); final GoalRoomMember goalRoomMember = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, creator); @@ -959,9 +937,10 @@ THIRTY_DAY_LATER, new MemberResponse(creator.getId(), creator.getNickname().getV @Test void 골룸의_노드_조회시_골룸에_참여하지_않은_사용자면_예외가_발생한다() { // given - final Member creator = 사용자를_생성한다(1L); + final Member creator = 크리에이터를_생성한다(); final Roadmap roadmap = 로드맵을_생성한다(creator); - final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmap.getContents().getValues().get(0)); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmapContent); when(goalRoomRepository.findByIdWithNodes(1L)) .thenReturn(Optional.of(goalRoom)); @@ -987,12 +966,11 @@ THIRTY_DAY_LATER, new MemberResponse(creator.getId(), creator.getNickname().getV @Test void 진행중인_골룸의_인증피드를_전체_조회한다() throws MalformedURLException { // given - final Member creator = 사용자를_생성한다(1L); + final Member creator = 크리에이터를_생성한다(); final Member follower = 사용자를_생성한다(2L); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmap.getContents().getValues().get(0)); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmapContent); goalRoom.start(); final GoalRoomMember goalRoomMember1 = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, @@ -1022,10 +1000,10 @@ THIRTY_DAY_LATER, new MemberResponse(creator.getId(), creator.getNickname().getV // then final GoalRoomCheckFeedResponse goalRoomCheckFeedResponse1 = new GoalRoomCheckFeedResponse( - new MemberResponse(1L, "name1", "http://example.com/serverFilePath"), + new MemberResponse(1L, "코끼리", "http://example.com/serverFilePath"), new CheckFeedResponse(1L, "http://example.com/serverFilePath", "description1", LocalDate.now())); final GoalRoomCheckFeedResponse goalRoomCheckFeedResponse2 = new GoalRoomCheckFeedResponse( - new MemberResponse(1L, "name1", "http://example.com/serverFilePath"), + new MemberResponse(1L, "코끼리", "http://example.com/serverFilePath"), new CheckFeedResponse(2L, "http://example.com/serverFilePath", "description2", LocalDate.now())); final GoalRoomCheckFeedResponse goalRoomCheckFeedResponse3 = new GoalRoomCheckFeedResponse( new MemberResponse(2L, "name1", "http://example.com/serverFilePath"), @@ -1041,11 +1019,10 @@ THIRTY_DAY_LATER, new MemberResponse(creator.getId(), creator.getNickname().getV @Test void 모집중인_골룸의_인증피드를_조회시_빈_값을_반환한다() { // given - final Member creator = 사용자를_생성한다(1L); - + final Member creator = 크리에이터를_생성한다(); final Roadmap roadmap = 로드맵을_생성한다(creator); - - final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmap.getContents().getValues().get(0)); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmapContent); final GoalRoomMember goalRoomMember = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, creator); @@ -1066,13 +1043,13 @@ THIRTY_DAY_LATER, new MemberResponse(creator.getId(), creator.getNickname().getV @Test void 종료된_골룸의_인증피드를_전체_조회시_모든_기간의_인증피드를_대상으로_반환한다() throws MalformedURLException { // given - final Member creator = 사용자를_생성한다(1L); + final Member creator = 크리에이터를_생성한다(); final Member follower = 사용자를_생성한다(2L); - final Roadmap roadmap = 로드맵을_생성한다(creator); - - final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmap.getContents().getValues().get(0)); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmapContent); goalRoom.complete(); + final GoalRoomMember goalRoomMember1 = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, creator); final GoalRoomMember goalRoomMember2 = new GoalRoomMember(GoalRoomRole.FOLLOWER, LocalDateTime.now(), goalRoom, @@ -1100,10 +1077,10 @@ THIRTY_DAY_LATER, new MemberResponse(creator.getId(), creator.getNickname().getV // then final GoalRoomCheckFeedResponse goalRoomCheckFeedResponse1 = new GoalRoomCheckFeedResponse( - new MemberResponse(1L, "name1", "http://example.com/serverFilePath"), + new MemberResponse(1L, "코끼리", "http://example.com/serverFilePath"), new CheckFeedResponse(1L, "http://example.com/serverFilePath", "description1", LocalDate.now())); final GoalRoomCheckFeedResponse goalRoomCheckFeedResponse2 = new GoalRoomCheckFeedResponse( - new MemberResponse(1L, "name1", "http://example.com/serverFilePath"), + new MemberResponse(1L, "코끼리", "http://example.com/serverFilePath"), new CheckFeedResponse(2L, "http://example.com/serverFilePath", "description2", LocalDate.now())); final GoalRoomCheckFeedResponse goalRoomCheckFeedResponse3 = new GoalRoomCheckFeedResponse( new MemberResponse(2L, "name1", "http://example.com/serverFilePath"), @@ -1119,12 +1096,12 @@ THIRTY_DAY_LATER, new MemberResponse(creator.getId(), creator.getNickname().getV @Test void 골룸의_인증피드를_전체_조회시_현재_진행중인_노드가_없으면_빈_리스트를_반환한다() { // given - final Member creator = 사용자를_생성한다(1L); + final Member creator = 크리에이터를_생성한다(); final Member follower = 사용자를_생성한다(2L); - final Roadmap roadmap = 로드맵을_생성한다(creator); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom = 진행중인_노드가_없는_골룸을_생성한다(creator, roadmapContent); - final GoalRoom goalRoom = 진행중인_노드가_없는_골룸을_생성한다(creator, roadmap.getContents().getValues().get(0)); final GoalRoomMember goalRoomMember1 = new GoalRoomMember(GoalRoomRole.LEADER, LocalDateTime.now(), goalRoom, creator); final GoalRoomMember goalRoomMember2 = new GoalRoomMember(GoalRoomRole.FOLLOWER, LocalDateTime.now(), goalRoom, @@ -1162,11 +1139,10 @@ THIRTY_DAY_LATER, new MemberResponse(creator.getId(), creator.getNickname().getV @Test void 골룸의_인증피드를_전체_조회할_때_골룸에_참여하지_않은_회원이면_예외가_발생한다() { // given - final Member creator = 사용자를_생성한다(1L); - + final Member creator = 크리에이터를_생성한다(); final Roadmap roadmap = 로드맵을_생성한다(creator); - - final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmap.getContents().getValues().get(0)); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); + final GoalRoom goalRoom = 골룸을_생성한다(creator, roadmapContent); given(goalRoomRepository.findByIdWithNodes(anyLong())) .willReturn(Optional.of(goalRoom)); @@ -1196,11 +1172,14 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("name1"), private Roadmap 로드맵을_생성한다(final Member creator) { final RoadmapCategory category = new RoadmapCategory("게임"); + return new Roadmap(1L, "로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); + } + + private RoadmapContent 로드맵_본문을_생성한다(final Long roadmapId) { + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId); final List roadmapNodes = 로드맵_노드들을_생성한다(); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmapNodes); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); - roadmap.addContent(roadmapContent); - return roadmap; + roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); + return roadmapContent; } private List 로드맵_노드들을_생성한다() { @@ -1210,12 +1189,6 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("name1"), return List.of(roadmapNode1, roadmapNode2); } - private RoadmapContent 로드맵_본문을_생성한다(final List roadmapNodes) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); - roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); - return roadmapContent; - } - private List 노드_이미지들을_생성한다() { return List.of( new RoadmapNodeImage("node-image1.png", "node-image1-save-path", ImageContentType.PNG), diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomSchedulerTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomSchedulerTest.java index 7b1febac4..a2b1a4eb1 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomSchedulerTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomSchedulerTest.java @@ -22,7 +22,6 @@ import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; -import co.kirikiri.roadmap.domain.RoadmapContents; import co.kirikiri.roadmap.domain.RoadmapDifficulty; import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodeImage; @@ -58,10 +57,10 @@ class GoalRoomSchedulerTest { private GoalRoomRepository goalRoomRepository; @Mock - private GoalRoomPendingMemberRepository goalRoomPendingMemberRepository; + private GoalRoomMemberRepository goalRoomMemberRepository; @Mock - private GoalRoomMemberRepository goalRoomMemberRepository; + private GoalRoomPendingMemberRepository goalRoomPendingMemberRepository; @InjectMocks private GoalRoomScheduler goalRoomScheduler; @@ -71,11 +70,10 @@ class GoalRoomSchedulerTest { // given final Member creator = 사용자를_생성한다(1L, "cokirikiri", "password1!", "코끼리", "010-1234-5678"); final Roadmap roadmap = 로드맵을_생성한다(creator); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom1 = 골룸을_생성한다(1L, creator, targetRoadmapContent, 10); - final GoalRoom goalRoom2 = 골룸을_생성한다(2L, creator, targetRoadmapContent, 10); + final GoalRoom goalRoom1 = 골룸을_생성한다(1L, creator, roadmapContent, 10); + final GoalRoom goalRoom2 = 골룸을_생성한다(2L, creator, roadmapContent, 10); final Member follower1 = 사용자를_생성한다(2L, "identifier1", "password2!", "name1", "kirikiri@email.com"); final Member follower2 = 사용자를_생성한다(3L, "identifier2", "password3!", "name2", "kirikiri@email.com"); @@ -107,11 +105,10 @@ class GoalRoomSchedulerTest { // given final Member creator = 사용자를_생성한다(1L, "cokirikiri", "password1!", "코끼리", "kirikiri@email.com"); final Roadmap roadmap = 로드맵을_생성한다(creator); + final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmap.getId()); - final RoadmapContents roadmapContents = roadmap.getContents(); - final RoadmapContent targetRoadmapContent = roadmapContents.getValues().get(0); - final GoalRoom goalRoom1 = 골룸을_생성한다(1L, creator, targetRoadmapContent, 10); - final GoalRoom goalRoom2 = 골룸을_생성한다(2L, creator, targetRoadmapContent, 10); + final GoalRoom goalRoom1 = 골룸을_생성한다(1L, creator, roadmapContent, 10); + final GoalRoom goalRoom2 = 골룸을_생성한다(2L, creator, roadmapContent, 10); final Member follower1 = 사용자를_생성한다(2L, "identifier1", "password2!", "name1", "kirikiri@email.com"); final Member follower2 = 사용자를_생성한다(3L, "identifier2", "password3!", "name2", "kirikiri@email.com"); @@ -146,11 +143,14 @@ class GoalRoomSchedulerTest { private Roadmap 로드맵을_생성한다(final Member creator) { final RoadmapCategory category = new RoadmapCategory("게임"); + return new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); + } + + private RoadmapContent 로드맵_본문을_생성한다(final Long roadmapId) { + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId); final List roadmapNodes = 로드맵_노드들을_생성한다(); - final RoadmapContent roadmapContent = 로드맵_본문을_생성한다(roadmapNodes); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); - roadmap.addContent(roadmapContent); - return roadmap; + roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); + return roadmapContent; } private List 로드맵_노드들을_생성한다() { @@ -160,12 +160,6 @@ class GoalRoomSchedulerTest { return List.of(roadmapNode1, roadmapNode2); } - private RoadmapContent 로드맵_본문을_생성한다(final List roadmapNodes) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); - roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); - return roadmapContent; - } - private List 노드_이미지들을_생성한다() { return List.of( new RoadmapNodeImage("node-image1.png", "node-image1-save-path", ImageContentType.PNG), From bdccbbcc546d1e8d68996fca4a76998f8c9a2dd6 Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Sun, 21 Jan 2024 16:24:15 +0900 Subject: [PATCH 17/22] =?UTF-8?q?refactor:=20Roadmap=20=EC=83=9D=EC=84=B1?= =?UTF-8?q?=20=EC=8B=9C=20=ED=83=9C=EA=B7=B8,=20RoadmapContent=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EC=8B=9C=20=EB=85=B8=EB=93=9C=EB=93=A4=EC=9D=84=20?= =?UTF-8?q?=ED=95=84=EC=88=98=EB=A1=9C=20=EB=84=A3=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../co/kirikiri/roadmap/domain/Roadmap.java | 26 +++---------- .../roadmap/domain/RoadmapContent.java | 13 +++---- .../roadmap/service/RoadmapCreateService.java | 30 ++++++-------- .../goalroom/GoalRoomPendingMemberTest.java | 4 +- .../goalroom/GoalRoomPendingMembersTest.java | 4 +- .../domain/goalroom/GoalRoomTest.java | 17 ++++---- .../goalroom/CheckFeedRepositoryTest.java | 7 ++-- .../GoalRoomMemberRepositoryTest.java | 7 ++-- .../GoalRoomPendingMemberRepositoryTest.java | 7 ++-- .../goalroom/GoalRoomRepositoryTest.java | 7 ++-- .../GoalRoomToDoCheckRepositoryTest.java | 7 ++-- .../roadmap/domain/RoadmapContentTest.java | 39 +------------------ .../roadmap/domain/RoadmapNodesTest.java | 35 ++++++++--------- .../kirikiri/roadmap/domain/RoadmapTest.java | 11 ++++-- .../RoadmapContentRepositoryTest.java | 6 ++- .../persistence/RoadmapRepositoryTest.java | 13 +++---- .../RoadmapCreateEventListenerTest.java | 26 ++++++------- .../service/RoadmapCreateServiceTest.java | 14 +++++-- .../service/RoadmapReadServiceTest.java | 23 +++++------ .../roadmap/service/RoadmapSchedulerTest.java | 8 +++- .../service/GoalRoomCreateServiceTest.java | 21 ++++------ .../service/GoalRoomReadServiceTest.java | 19 +++++---- .../service/GoalRoomSchedulerTest.java | 9 +++-- 23 files changed, 150 insertions(+), 203 deletions(-) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/Roadmap.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/Roadmap.java index 832bbd2a1..f9804fb79 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/Roadmap.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/Roadmap.java @@ -11,14 +11,12 @@ import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; import lombok.AccessLevel; -import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; import java.util.Objects; @Entity @NoArgsConstructor(access = AccessLevel.PROTECTED) -@AllArgsConstructor public class Roadmap extends BaseCreatedTimeEntity { private static final int TITLE_MIN_LENGTH = 1; @@ -54,25 +52,14 @@ public class Roadmap extends BaseCreatedTimeEntity { @Embedded private RoadmapTags tags = new RoadmapTags(); - public Roadmap(final String title, final String introduction, final int requiredPeriod, - final RoadmapDifficulty difficulty, final Long creatorId, final RoadmapCategory category) { - this(null, title, introduction, requiredPeriod, difficulty, RoadmapStatus.CREATED, creatorId, category); - } - - public Roadmap(final String title, final String introduction, final Integer requiredPeriod, - final RoadmapDifficulty difficulty, final RoadmapStatus status, final Long creatorId, - final RoadmapCategory category) { - this(null, title, introduction, requiredPeriod, difficulty, status, creatorId, category); - } - - public Roadmap(final Long id, final String title, final String introduction, final Integer requiredPeriod, - final RoadmapDifficulty difficulty, final Long creatorId, final RoadmapCategory category) { - this(id, title, introduction, requiredPeriod, difficulty, RoadmapStatus.CREATED, creatorId, category); + public Roadmap(final String title, final String introduction, final int requiredPeriod, final RoadmapDifficulty difficulty, + final Long creatorId, final RoadmapCategory category, final RoadmapTags tags) { + this(null, title, introduction, requiredPeriod, difficulty, RoadmapStatus.CREATED, creatorId, category, tags); } public Roadmap(final Long id, final String title, final String introduction, final Integer requiredPeriod, final RoadmapDifficulty difficulty, final RoadmapStatus status, final Long creatorId, - final RoadmapCategory category) { + final RoadmapCategory category, final RoadmapTags tags) { validate(title, introduction, requiredPeriod); this.id = id; this.title = title; @@ -82,6 +69,7 @@ public Roadmap(final Long id, final String title, final String introduction, fin this.status = status; this.creatorId = creatorId; this.category = category; + this.tags = tags; } private void validate(final String title, final String introduction, final int requiredPeriod) { @@ -116,10 +104,6 @@ private void validateRequiredPeriod(final int requiredPeriod) { } } - public void addTags(final RoadmapTags tags) { - this.tags.addAll(tags); - } - public boolean isCreator(final Long memberId) { return Objects.equals(creatorId, memberId); } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContent.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContent.java index c381c3f6f..4e58be027 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContent.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContent.java @@ -24,17 +24,18 @@ public class RoadmapContent extends BaseUpdatedTimeEntity { private Long roadmapId; @Embedded - private final RoadmapNodes nodes = new RoadmapNodes(); + private RoadmapNodes nodes; - public RoadmapContent(final String content, final Long roadmapId) { - this(null, content, roadmapId); + public RoadmapContent(final String content, final Long roadmapId, final RoadmapNodes nodes) { + this(null, content, roadmapId, nodes); } - public RoadmapContent(final Long id, final String content, final Long roadmapId) { + public RoadmapContent(final Long id, final String content, final Long roadmapId, final RoadmapNodes nodes) { validate(content); this.id = id; this.content = content; this.roadmapId = roadmapId; + this.nodes = nodes; } private void validate(final String content) { @@ -50,10 +51,6 @@ private void validateContentLength(final String content) { } } - public void addNodes(final RoadmapNodes nodes) { - this.nodes.addAll(nodes); - } - public int nodesSize() { return nodes.size(); } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java index 78ac48564..5b6df89b2 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java @@ -58,16 +58,16 @@ public Long create(final RoadmapSaveRequest request, final String identifier) { final Member member = findMemberByIdentifier(identifier); final RoadmapCategory roadmapCategory = findRoadmapCategoryById(request.categoryId()); final RoadmapSaveDto roadmapSaveDto = RoadmapMapper.convertToRoadmapSaveDto(request); - final Roadmap roadmap = createRoadmap(member.getId(), roadmapSaveDto, roadmapCategory); + + final Roadmap roadmap = makeRoadmap(member.getId(), roadmapSaveDto, roadmapCategory); final Roadmap savedRoadmap = roadmapRepository.save(roadmap); - final RoadmapNodes roadmapNodes = makeRoadmapNodes(roadmapSaveDto.roadmapNodes()); - final RoadmapContent roadmapContent = makeRoadmapContent(roadmapSaveDto, savedRoadmap.getId(), roadmapNodes); + final RoadmapContent roadmapContent = makeRoadmapContent(roadmapSaveDto, savedRoadmap.getId()); roadmapContentRepository.save(roadmapContent); applicationEventPublisher.publishEvent(new RoadmapCreateEvent(savedRoadmap.getId(), roadmapSaveDto)); - return roadmap.getId(); + return savedRoadmap.getId(); } private Member findMemberByIdentifier(final String identifier) { @@ -80,19 +80,12 @@ private RoadmapCategory findRoadmapCategoryById(final Long categoryId) { .orElseThrow(() -> new NotFoundException("존재하지 않는 카테고리입니다. categoryId = " + categoryId)); } - private Roadmap createRoadmap(final Long memberId, final RoadmapSaveDto roadmapSaveDto, - final RoadmapCategory roadmapCategory) { - final Roadmap roadmap = makeRoadmap(memberId, roadmapSaveDto, roadmapCategory); - final RoadmapTags roadmapTags = makeRoadmapTags(roadmapSaveDto.tags()); - roadmap.addTags(roadmapTags); - return roadmap; - } - private Roadmap makeRoadmap(final Long memberId, final RoadmapSaveDto roadmapSaveDto, final RoadmapCategory roadmapCategory) { + final RoadmapTags roadmapTags = makeRoadmapTags(roadmapSaveDto.tags()); return new Roadmap(roadmapSaveDto.title(), roadmapSaveDto.introduction(), roadmapSaveDto.requiredPeriod(), RoadmapDifficulty.valueOf(roadmapSaveDto.difficulty().name()), memberId, - roadmapCategory); + roadmapCategory, roadmapTags); } private RoadmapTags makeRoadmapTags(final List roadmapTagSaveDto) { @@ -103,6 +96,11 @@ private RoadmapTags makeRoadmapTags(final List roadmapTagSave ); } + private RoadmapContent makeRoadmapContent(final RoadmapSaveDto roadmapSaveDto, final Long roadmapId) { + final RoadmapNodes nodes = makeRoadmapNodes(roadmapSaveDto.roadmapNodes()); + return new RoadmapContent(roadmapSaveDto.content(), roadmapId, nodes); + } + private RoadmapNodes makeRoadmapNodes(final List roadmapNodeSaveDtos) { return new RoadmapNodes( roadmapNodeSaveDtos.stream() @@ -111,12 +109,6 @@ private RoadmapNodes makeRoadmapNodes(final List roadmapNode ); } - private RoadmapContent makeRoadmapContent(final RoadmapSaveDto roadmapSaveDto, final Long roadmapId, final RoadmapNodes roadmapNodes) { - final RoadmapContent roadmapContent = new RoadmapContent(roadmapSaveDto.content(), roadmapId); - roadmapContent.addNodes(roadmapNodes); - return roadmapContent; - } - public void createReview(final Long roadmapId, final String identifier, final RoadmapReviewSaveRequest request) { final Roadmap roadmap = findRoadmapById(roadmapId); final Long memberId = roadmapGoalRoomService.findCompletedGoalRoomMember(roadmapId, identifier) diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMemberTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMemberTest.java index 51247c0b8..e9860a32f 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMemberTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMemberTest.java @@ -25,7 +25,7 @@ class GoalRoomPendingMemberTest { new Nickname("nickname"), null, new MemberProfile(Gender.FEMALE, "kirikiri1@email.com")); final GoalRoom goalRoom = new GoalRoom(new GoalRoomName("goalroom"), new LimitedMemberCount(10), - new RoadmapContent("content", null), member); + new RoadmapContent("content", null, null), member); // when final GoalRoomPendingMember goalRoomPendingMember = new GoalRoomPendingMember(GoalRoomRole.LEADER, goalRoom, @@ -42,7 +42,7 @@ class GoalRoomPendingMemberTest { new Nickname("nickname"), null, new MemberProfile(Gender.FEMALE, "kirikiri1@email.com")); final GoalRoom goalRoom = new GoalRoom(new GoalRoomName("goalroom"), new LimitedMemberCount(10), - new RoadmapContent("content", 1L), member); + new RoadmapContent("content", 1L, null), member); // when final GoalRoomPendingMember goalRoomPendingMember = new GoalRoomPendingMember(GoalRoomRole.FOLLOWER, goalRoom, diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembersTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembersTest.java index b72775bbd..284568f18 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembersTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomPendingMembersTest.java @@ -30,7 +30,7 @@ null, new EncryptedPassword(new Password("password2!")), void 골룸의_리더를_찾는다() { // given final GoalRoom goalRoom = new GoalRoom(new GoalRoomName("goalroom"), new LimitedMemberCount(10), - new RoadmapContent("content", 1L), MEMBER1); + new RoadmapContent("content", 1L, null), MEMBER1); // when final GoalRoomPendingMembers goalRoomPendingMembers = new GoalRoomPendingMembers(List.of( @@ -46,7 +46,7 @@ null, new EncryptedPassword(new Password("password2!")), void 골룸의_리더가_없으면_예외가_발생한다() { // given final GoalRoom goalRoom = new GoalRoom(new GoalRoomName("goalroom"), new LimitedMemberCount(10), - new RoadmapContent("content", 1L), MEMBER1); + new RoadmapContent("content", 1L, null), MEMBER1); // when final GoalRoomPendingMembers goalRoomPendingMembers = new GoalRoomPendingMembers(List.of( diff --git a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomTest.java b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomTest.java index 2c0a9f16c..8d1754935 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/domain/goalroom/GoalRoomTest.java @@ -65,7 +65,7 @@ static void setUp() { void 골룸에_대기중인_인원수를_계산한다() { // given final GoalRoom goalRoom = new GoalRoom(new GoalRoomName("goalroom"), new LimitedMemberCount(10), - new RoadmapContent("content", 1L), member); + new RoadmapContent("content", 1L, null), member); final Member member1 = new Member(2L, new Identifier("identifier2"), null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임2"), null, @@ -87,7 +87,7 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 void 골룸에_사용자를_추가한다() { //given final GoalRoom goalRoom = new GoalRoom(GOAL_ROOM_NAME, new LimitedMemberCount(10), - new RoadmapContent("로드맵 내용", 1L), member); + new RoadmapContent("로드맵 내용", 1L, null), member); final Member follower = 사용자를_생성한다(2L, "identifier12", "시진이"); //when @@ -102,7 +102,7 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 @Test void 모집중이_아닌_골룸에_사용자를_추가하면_예외가_발생한다() { //given - final GoalRoom goalRoom = new GoalRoom(GOAL_ROOM_NAME, new LimitedMemberCount(10), new RoadmapContent("로드맵 내용", 1L), + final GoalRoom goalRoom = new GoalRoom(GOAL_ROOM_NAME, new LimitedMemberCount(10), new RoadmapContent("로드맵 내용", 1L, null), 사용자를_생성한다(2L, "identifier1", "시진이")); goalRoom.start(); @@ -115,7 +115,7 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 @Test void 제한_인원이_가득_찬_골룸에_사용자를_추가하면_예외가_발생한다() { //given - final GoalRoom goalRoom = new GoalRoom(GOAL_ROOM_NAME, new LimitedMemberCount(1), new RoadmapContent("로드맵 내용", 1L), + final GoalRoom goalRoom = new GoalRoom(GOAL_ROOM_NAME, new LimitedMemberCount(1), new RoadmapContent("로드맵 내용", 1L, null), 사용자를_생성한다(2L, "identifier1", "시진이")); //when,then @@ -128,7 +128,7 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 void 이미_참여_중인_사용자를_골룸에_추가하면_예외가_발생한다() { //given final GoalRoom goalRoom = new GoalRoom(GOAL_ROOM_NAME, new LimitedMemberCount(2), - new RoadmapContent("로드맵 내용", 1L), member); + new RoadmapContent("로드맵 내용", 1L, null), member); //when,then assertThatThrownBy(() -> goalRoom.join(member)) @@ -186,7 +186,7 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 void 골룸을_나간다() { //given final GoalRoom goalRoom = new GoalRoom(GOAL_ROOM_NAME, new LimitedMemberCount(2), - new RoadmapContent("로드맵 내용", 1L), member); + new RoadmapContent("로드맵 내용", 1L, null), member); // when goalRoom.leave(member); @@ -199,7 +199,7 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 void 골룸에_참여하지_않은_멤버가_나가면_예외가_발생한다() { //given final GoalRoom goalRoom = new GoalRoom(GOAL_ROOM_NAME, new LimitedMemberCount(2), - new RoadmapContent("로드맵 내용", 1L), member); + new RoadmapContent("로드맵 내용", 1L, null), member); final Member notJoinMember = new Member(new Identifier("identifier2"), new EncryptedPassword(new Password("password2!")), @@ -250,8 +250,7 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("닉네임3 } private RoadmapContent 로드맵_본문을_생성한다(final List roadmapNodes) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", 1L); - roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", 1L, new RoadmapNodes(roadmapNodes)); return roadmapContent; } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/CheckFeedRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/CheckFeedRepositoryTest.java index 4c5e4b7f9..677f22963 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/CheckFeedRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/CheckFeedRepositoryTest.java @@ -28,6 +28,7 @@ import co.kirikiri.roadmap.domain.RoadmapNodeImage; import co.kirikiri.roadmap.domain.RoadmapNodeImages; import co.kirikiri.roadmap.domain.RoadmapNodes; +import co.kirikiri.roadmap.domain.RoadmapTags; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; @@ -35,6 +36,7 @@ import java.time.LocalDate; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; @@ -434,14 +436,13 @@ public CheckFeedRepositoryTest(final MemberRepository memberRepository, } private Roadmap 로드맵을_저장한다(final String title, final Member creator, final RoadmapCategory category) { - final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); + final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category, new RoadmapTags(new ArrayList<>())); return roadmapRepository.save(roadmap); } private RoadmapContent 로드맵_본문을_저장한다(final Long roadmapId) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId); final List roadmapNodes = 로드맵_노드들을_생성한다(); - roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId, new RoadmapNodes(roadmapNodes)); return roadmapContentRepository.save(roadmapContent); } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepositoryTest.java index d940c48a4..bfc0535f7 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomMemberRepositoryTest.java @@ -28,6 +28,7 @@ import co.kirikiri.roadmap.domain.RoadmapNodeImage; import co.kirikiri.roadmap.domain.RoadmapNodeImages; import co.kirikiri.roadmap.domain.RoadmapNodes; +import co.kirikiri.roadmap.domain.RoadmapTags; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; @@ -36,6 +37,7 @@ import java.time.LocalDate; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -292,14 +294,13 @@ public GoalRoomMemberRepositoryTest(final MemberRepository memberRepository, } private Roadmap 로드맵을_저장한다(final String title, final Member creator, final RoadmapCategory category) { - final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); + final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category, new RoadmapTags(new ArrayList<>())); return roadmapRepository.save(roadmap); } private RoadmapContent 로드맵_본문을_저장한다(final Long roadmapId) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId); final List roadmapNodes = 로드맵_노드들을_생성한다(); - roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId, new RoadmapNodes(roadmapNodes)); return roadmapContentRepository.save(roadmapContent); } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepositoryTest.java index e5e721bdf..d2e63640d 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomPendingMemberRepositoryTest.java @@ -28,6 +28,7 @@ import co.kirikiri.roadmap.domain.RoadmapNodeImage; import co.kirikiri.roadmap.domain.RoadmapNodeImages; import co.kirikiri.roadmap.domain.RoadmapNodes; +import co.kirikiri.roadmap.domain.RoadmapTags; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; @@ -36,6 +37,7 @@ import java.time.LocalDate; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -310,14 +312,13 @@ public GoalRoomPendingMemberRepositoryTest(final MemberRepository memberReposito } private Roadmap 로드맵을_저장한다(final String title, final Member creator, final RoadmapCategory category) { - final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); + final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category, new RoadmapTags(new ArrayList<>())); return roadmapRepository.save(roadmap); } private RoadmapContent 로드맵_본문을_저장한다(final Long roadmapId) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId); final List roadmapNodes = 로드맵_노드들을_생성한다(); - roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId, new RoadmapNodes(roadmapNodes)); return roadmapContentRepository.save(roadmapContent); } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomRepositoryTest.java index 541c82644..15af5a685 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomRepositoryTest.java @@ -25,12 +25,14 @@ import co.kirikiri.roadmap.domain.RoadmapDifficulty; import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodes; +import co.kirikiri.roadmap.domain.RoadmapTags; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import org.junit.jupiter.api.Test; import java.time.LocalDate; +import java.util.ArrayList; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; @@ -572,14 +574,13 @@ public GoalRoomRepositoryTest(final MemberRepository memberRepository, } private RoadmapContent 로드맵_본문을_저장한다(final List roadmapNodes, final Long roadmapId) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId); - roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId, new RoadmapNodes(roadmapNodes)); return roadmapContentRepository.save(roadmapContent); } private Roadmap 로드맵을_저장한다(final Member creator, final RoadmapCategory category) { final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 30, RoadmapDifficulty.DIFFICULT, - creator.getId(), category); + creator.getId(), category, new RoadmapTags(new ArrayList<>())); return roadmapRepository.save(roadmap); } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepositoryTest.java index 39e2867db..f6af23f8d 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/persistence/goalroom/GoalRoomToDoCheckRepositoryTest.java @@ -26,6 +26,7 @@ import co.kirikiri.roadmap.domain.RoadmapDifficulty; import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodes; +import co.kirikiri.roadmap.domain.RoadmapTags; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; @@ -33,6 +34,7 @@ import java.time.LocalDate; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; @@ -178,14 +180,13 @@ public GoalRoomToDoCheckRepositoryTest(final MemberRepository memberRepository, } private RoadmapContent 로드맵_본문을_저장한다(final List roadmapNodes, final Long roadmapId) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId); - roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId, new RoadmapNodes(roadmapNodes)); return roadmapContentRepository.save(roadmapContent); } private Roadmap 로드맵을_저장한다(final Member creator, final RoadmapCategory category) { final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 30, RoadmapDifficulty.DIFFICULT, - creator.getId(), category); + creator.getId(), category, new RoadmapTags(new ArrayList<>())); return roadmapRepository.save(roadmap); } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentTest.java index 1f448fc7b..e1b804f0f 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapContentTest.java @@ -3,11 +3,7 @@ import co.kirikiri.roadmap.domain.exception.RoadmapException; import org.junit.jupiter.api.Test; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; class RoadmapContentTest { @@ -18,7 +14,7 @@ class RoadmapContentTest { final String content = "a".repeat(2001); // expect - assertThatThrownBy(() -> new RoadmapContent(content, 1L)) + assertThatThrownBy(() -> new RoadmapContent(content, 1L, null)) .isInstanceOf(RoadmapException.class); } @@ -28,37 +24,6 @@ class RoadmapContentTest { final String content = null; // expect - assertDoesNotThrow(() -> new RoadmapContent(content, 1L)); - } - - @Test - void 로드맵_본문에_노드들을_추가한다() { - // given - final RoadmapContent content = new RoadmapContent("content", 1L); - final RoadmapNodes roadmapNodes = new RoadmapNodes( - List.of(new RoadmapNode("title1", "content1"), new RoadmapNode("title2", "content1"))); - - // when - content.addNodes(roadmapNodes); - - // then - final RoadmapNodes nodes = content.getNodes(); - assertAll( - () -> assertThat(nodes.getValues()).hasSize(2), - () -> assertThat(nodes.getValues().get(0).getTitle()).isEqualTo("title1"), - () -> assertThat(nodes.getValues().get(1).getTitle()).isEqualTo("title2") - ); - } - - @Test - void 로드맵_본문에_노드를_추가할때_이름이_겹치면_예외를_던진다() { - // given - final RoadmapContent content = new RoadmapContent("content", 1L); - - // when - // then - final String title = "title"; - assertThatThrownBy(() -> content.addNodes( - new RoadmapNodes(List.of(new RoadmapNode(title, "content1"), new RoadmapNode(title, "content1"))))); + assertDoesNotThrow(() -> new RoadmapContent(content, 1L, null)); } } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodesTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodesTest.java index 46503d56f..4d65f7508 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodesTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodesTest.java @@ -1,13 +1,30 @@ package co.kirikiri.roadmap.domain; +import co.kirikiri.roadmap.domain.exception.RoadmapException; import org.junit.jupiter.api.Test; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; class RoadmapNodesTest { + @Test + void 로드맵_본문의_노드의_이름이_겹치면_예외를_던진다() { + // given + final String title = "title"; + final RoadmapNode node1 = new RoadmapNode(title, "content1"); + final RoadmapNode node2 = new RoadmapNode(title, "content1"); + + // when,then + assertThatThrownBy(() -> new RoadmapNodes(List.of(node1, node2))) + .isInstanceOf(RoadmapException.class) + .hasMessage("한 로드맵에 같은 이름의 노드가 존재할 수 없습니다."); + } + + // todo: RoadmapNodes 도메인 테스트 추가하기 + @Test void 로드맵_노드를_추가한다() { // given @@ -19,22 +36,4 @@ class RoadmapNodesTest { // then assertThat(roadmapNodes.getValues()).hasSize(2); } - -// @Test -// void 로드맵_노드들의_로드맵_본문을_업데이트한다() { -// // given -// final RoadmapNodes roadmapNodes = new RoadmapNodes( -// List.of(new RoadmapNode("로드맵 노드 제목1", "로드맵 노드 내용1"), new RoadmapNode("로드맵 노드 제목2", "로드맵 노드 내용2"))); -// final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문"); -// -// // when -// roadmapNodes.updateAllRoadmapContent(roadmapContent); -// -// // then -// final List nodes = roadmapNodes.getValues(); -// assertAll( -// () -> assertThat(nodes.get(0).getRoadmapContentId()).isEqualTo(roadmapContent.getId()), -// () -> assertThat(nodes.get(1).getRoadmapContentId()).isEqualTo(roadmapContent.getId()) -// ); -// } } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTest.java index b420856ed..ef889d1d7 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapTest.java @@ -5,6 +5,8 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import java.util.ArrayList; + import static co.kirikiri.roadmap.domain.RoadmapDifficulty.DIFFICULT; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; @@ -13,12 +15,13 @@ class RoadmapTest { private final Long creatorId = 1L; private final RoadmapCategory category = 카테고리를_생성한다(); + private final RoadmapTags emptyTags = new RoadmapTags(new ArrayList<>()); @Test void 로드맵이_성공적으로_생성된다() { // expect assertDoesNotThrow(() -> new Roadmap("로드맵 제목", "로드맵 소개글", 30, DIFFICULT, - creatorId, category)); + creatorId, category, null)); } @ParameterizedTest @@ -28,7 +31,7 @@ class RoadmapTest { final String title = "a".repeat(titleLength); // expect - assertThatThrownBy(() -> new Roadmap(title, "로드맵 소개글", 30, DIFFICULT, creatorId, category)) + assertThatThrownBy(() -> new Roadmap(title, "로드맵 소개글", 30, DIFFICULT, creatorId, category, emptyTags)) .isInstanceOf(RoadmapException.class); } @@ -39,7 +42,7 @@ class RoadmapTest { final String introduction = "a".repeat(introductionLength); // expect - assertThatThrownBy(() -> new Roadmap("로드맵 제목", introduction, 30, DIFFICULT, creatorId, category)) + assertThatThrownBy(() -> new Roadmap("로드맵 제목", introduction, 30, DIFFICULT, creatorId, category, emptyTags)) .isInstanceOf(RoadmapException.class); } @@ -47,7 +50,7 @@ class RoadmapTest { @ValueSource(ints = {-1, 1001}) void 로드맵_추천_소요_기간이_0보다_작고_1000보다_크면_예외가_발생한다(final int requiredPeriod) { // expect - assertThatThrownBy(() -> new Roadmap("로드맵 제목", "로드맵 소개글", requiredPeriod, DIFFICULT, creatorId, category)) + assertThatThrownBy(() -> new Roadmap("로드맵 제목", "로드맵 소개글", requiredPeriod, DIFFICULT, creatorId, category, emptyTags)) .isInstanceOf(RoadmapException.class); } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapContentRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapContentRepositoryTest.java index c8374e369..6e26a1cfc 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapContentRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapContentRepositoryTest.java @@ -13,8 +13,10 @@ import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapContent; import co.kirikiri.roadmap.domain.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.RoadmapTags; import org.junit.jupiter.api.Test; +import java.util.ArrayList; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; @@ -81,7 +83,7 @@ public RoadmapContentRepositoryTest(final MemberRepository memberRepository, private Roadmap 로드맵을_저장한다() { final Member creator = 사용자를_생성한다(); final RoadmapCategory category = 로드맵_카테고리를_생성한다(); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.NORMAL, creator.getId(), category); + final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.NORMAL, creator.getId(), category, new RoadmapTags(new ArrayList<>())); return roadmapRepository.save(roadmap); } @@ -100,6 +102,6 @@ public RoadmapContentRepositoryTest(final MemberRepository memberRepository, } private RoadmapContent 로드맵_컨텐츠를_저장한다(final Long roadmapId) { - return roadmapContentRepository.save(new RoadmapContent("content", roadmapId)); + return roadmapContentRepository.save(new RoadmapContent("content", roadmapId, null)); } } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapRepositoryTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapRepositoryTest.java index 27bb5e0d4..3dc5fce2c 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapRepositoryTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/persistence/RoadmapRepositoryTest.java @@ -38,6 +38,7 @@ import java.time.LocalDate; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -76,7 +77,7 @@ public RoadmapRepositoryTest(final MemberRepository memberRepository, // given final Member creator = 사용자를_생성한다("cokirikiri", "코끼리"); final RoadmapCategory category = 카테고리를_생성한다("여가"); - final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); + final Roadmap roadmap = new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category, new RoadmapTags(new ArrayList<>())); // when final Roadmap savedRoadmap = roadmapRepository.save(roadmap); @@ -573,12 +574,12 @@ public RoadmapRepositoryTest(final MemberRepository memberRepository, } private Roadmap 로드맵을_저장한다(final String title, final Member creator, final RoadmapCategory category) { - final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); + final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category, new RoadmapTags(new ArrayList<>())); return roadmapRepository.save(roadmap); } private Roadmap 삭제된_로드맵을_저장한다(final String title, final Member creator, final RoadmapCategory category) { - final Roadmap roadmap = new Roadmap(title, "로드맵 소개글2", 7, RoadmapDifficulty.DIFFICULT, creator.getId(), category); + final Roadmap roadmap = new Roadmap(title, "로드맵 소개글2", 7, RoadmapDifficulty.DIFFICULT, creator.getId(), category, new RoadmapTags(new ArrayList<>())); roadmap.delete(); return roadmapRepository.save(roadmap); } @@ -586,15 +587,13 @@ public RoadmapRepositoryTest(final MemberRepository memberRepository, private RoadmapContent 로드맵_컨텐츠를_저장한다(final Long roadmapId) { final RoadmapNode roadmapNode1 = 로드맵_노드를_생성한다("로드맵 1주차", "로드맵 1주차 내용"); final RoadmapNode roadmapNode2 = 로드맵_노드를_생성한다("로드맵 2주차", "로드맵 2주차 내용"); - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId); - roadmapContent.addNodes(new RoadmapNodes(List.of(roadmapNode1, roadmapNode2))); + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId, new RoadmapNodes(List.of(roadmapNode1, roadmapNode2))); return roadmapContentRepository.save(roadmapContent); } private Roadmap 로드맵을_태그와_저장한다(final String title, final Member creator, final RoadmapCategory category, final RoadmapTags roadmapTags) { - final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); - roadmap.addTags(roadmapTags); + final Roadmap roadmap = new Roadmap(title, "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category, roadmapTags); return roadmapRepository.save(roadmap); } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java index 6e9eb38b0..273b8f80d 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateEventListenerTest.java @@ -7,6 +7,8 @@ import co.kirikiri.roadmap.domain.RoadmapDifficulty; import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodes; +import co.kirikiri.roadmap.domain.RoadmapStatus; +import co.kirikiri.roadmap.domain.RoadmapTags; import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.service.dto.RoadmapNodeSaveDto; import co.kirikiri.roadmap.service.dto.RoadmapSaveDto; @@ -26,6 +28,7 @@ import org.springframework.web.multipart.MultipartFile; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -53,10 +56,9 @@ class RoadmapCreateEventListenerTest { @Test void 정상적으로_로드맵_노드_이미지를_저장한다() throws IOException { final Roadmap roadmap = new Roadmap(1L, "roadmapTitle", "introduction", 10, - RoadmapDifficulty.DIFFICULT, memberId, new RoadmapCategory("category")); - final RoadmapContent roadmapContent = new RoadmapContent("roadmapContent", roadmap.getId()); + RoadmapDifficulty.DIFFICULT, RoadmapStatus.CREATED, memberId, new RoadmapCategory("category"), new RoadmapTags(new ArrayList<>())); final RoadmapNode roadmapNode = new RoadmapNode("roadmapNodeTitle", "roadmapNodeContent"); - roadmapContent.addNodes(new RoadmapNodes(List.of(roadmapNode))); + final RoadmapContent roadmapContent = new RoadmapContent("roadmapContent", roadmap.getId(), new RoadmapNodes(List.of(roadmapNode))); final MultipartFile imageFile = new MockMultipartFile(roadmapNode.getTitle(), "originalFileName.jpeg", "image/jpeg", "tempImage".getBytes()); @@ -82,8 +84,8 @@ class RoadmapCreateEventListenerTest { @Test void 로드맵에_컨텐츠가_존재하지_않을_경우_예외를_던진다() throws IOException { //given - final Roadmap roadmap = new Roadmap(1L, "roadmapTitle", "inroduction", 10, - RoadmapDifficulty.DIFFICULT, memberId, new RoadmapCategory("category")); + final Roadmap roadmap = new Roadmap(1L, "roadmapTitle", "inroduction", 10, RoadmapDifficulty.DIFFICULT, + RoadmapStatus.CREATED, memberId, new RoadmapCategory("category"), new RoadmapTags(new ArrayList<>())); final MultipartFile imageFile = new MockMultipartFile("roadmapNodeTitle", "originalFileName.jpeg", "image/jpeg", "tempImage".getBytes()); @@ -110,11 +112,10 @@ class RoadmapCreateEventListenerTest { @Test void 로드맵_노드_제목을_가진_노드가_로드맵에_존재하지_않을때_예외를_던진다() throws IOException { //given - final Roadmap roadmap = new Roadmap(1L, "roadmapTitle", "introduction", 10, - RoadmapDifficulty.DIFFICULT, memberId, new RoadmapCategory("category")); - final RoadmapContent roadmapContent = new RoadmapContent("roadmapContent", roadmap.getId()); + final Roadmap roadmap = new Roadmap(1L, "roadmapTitle", "introduction", 10, RoadmapDifficulty.DIFFICULT, + RoadmapStatus.CREATED, memberId, new RoadmapCategory("category"), new RoadmapTags(new ArrayList<>())); final RoadmapNode roadmapNode = new RoadmapNode("roadmapNodeTitle", "roadmapNodeContent"); - roadmapContent.addNodes(new RoadmapNodes(List.of(roadmapNode))); + final RoadmapContent roadmapContent = new RoadmapContent("roadmapContent", roadmap.getId(), new RoadmapNodes(List.of(roadmapNode))); final MultipartFile imageFile = new MockMultipartFile(roadmapNode.getTitle(), "originalFileName.jpeg", "image/jpeg", "tempImage".getBytes()); @@ -141,11 +142,10 @@ class RoadmapCreateEventListenerTest { @Test void 로드맵_노드_이미지에_원본_파일_이름이_없을_경우_예외를_던진다() throws IOException { //given - final Roadmap roadmap = new Roadmap(1L, "roadmapTitle", "inroduction", 10, - RoadmapDifficulty.DIFFICULT, memberId, new RoadmapCategory("category")); - final RoadmapContent roadmapContent = new RoadmapContent("roadmapContent", roadmap.getId()); + final Roadmap roadmap = new Roadmap(1L, "roadmapTitle", "inroduction", 10, RoadmapDifficulty.DIFFICULT, + RoadmapStatus.CREATED, memberId, new RoadmapCategory("category"), new RoadmapTags(new ArrayList<>())); final RoadmapNode roadmapNode = new RoadmapNode("roadmapNodeTitle", "roadmapNodeContent"); - roadmapContent.addNodes(new RoadmapNodes(List.of(roadmapNode))); + final RoadmapContent roadmapContent = new RoadmapContent("roadmapContent", roadmap.getId(), new RoadmapNodes(List.of(roadmapNode))); final MultipartFile imageFile = new MockMultipartFile(roadmapNode.getTitle(), null, "image/jpeg", "tempImage".getBytes()); diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateServiceTest.java index d0ce0fd51..3e22f3801 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapCreateServiceTest.java @@ -13,6 +13,10 @@ import co.kirikiri.roadmap.domain.RoadmapContent; import co.kirikiri.roadmap.domain.RoadmapDifficulty; import co.kirikiri.roadmap.domain.RoadmapReview; +import co.kirikiri.roadmap.domain.RoadmapStatus; +import co.kirikiri.roadmap.domain.RoadmapTag; +import co.kirikiri.roadmap.domain.RoadmapTags; +import co.kirikiri.roadmap.domain.vo.RoadmapTagName; import co.kirikiri.roadmap.persistence.RoadmapCategoryRepository; import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; @@ -35,6 +39,7 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.context.ApplicationEventPublisher; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Optional; @@ -99,10 +104,10 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 given(roadmapCategoryRepository.findById(any())) .willReturn(Optional.of(category)); given(roadmapRepository.save(any())) - .willReturn(new Roadmap(1L, roadmapTitle, roadmapIntroduction, requiredPeriod, - RoadmapDifficulty.valueOf(difficulty.name()), MEMBER.getId(), category)); + .willReturn(new Roadmap(1L, roadmapTitle, roadmapIntroduction, requiredPeriod, RoadmapDifficulty.valueOf(difficulty.name()), + RoadmapStatus.CREATED, MEMBER.getId(), category, new RoadmapTags(List.of(new RoadmapTag(new RoadmapTagName("태그 1")))))); given(roadmapContentRepository.save(any())) - .willReturn(new RoadmapContent(roadmapContent, 1L)); + .willReturn(new RoadmapContent(roadmapContent, 1L, null)); // expect assertDoesNotThrow(() -> roadmapCreateService.create(request, "identifier1")); @@ -327,6 +332,7 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 } private Roadmap 로드맵을_생성한다(final Member creator, final RoadmapCategory category) { - return new Roadmap(1L, "로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.NORMAL, creator.getId(), category); + return new Roadmap(1L, "로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.NORMAL, + RoadmapStatus.CREATED, creator.getId(), category, new RoadmapTags(new ArrayList<>())); } } diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java index d4ada9c20..0c0adeef2 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapReadServiceTest.java @@ -19,6 +19,7 @@ import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.roadmap.domain.RoadmapReview; +import co.kirikiri.roadmap.domain.RoadmapStatus; import co.kirikiri.roadmap.domain.RoadmapTag; import co.kirikiri.roadmap.domain.RoadmapTags; import co.kirikiri.roadmap.domain.vo.RoadmapTagName; @@ -55,6 +56,7 @@ import java.net.URL; import java.time.LocalDate; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Optional; @@ -456,11 +458,11 @@ null, new EncryptedPassword(new Password("password1!")), new Nickname("닉네임 } @Test - void 로드맵의_골룸_목록을_최신순으로_조회한다() throws MalformedURLException { + void 로드맵의_골룸_목록을_최신순으로_조회한다() { // given final Member member1 = 사용자를_생성한다(1L, "identifier1", "name1"); - final Roadmap roadmap = new Roadmap(1L, "로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.DIFFICULT, member1.getId(), - new RoadmapCategory("it")); + final Roadmap roadmap = new Roadmap(1L, "로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.DIFFICULT, RoadmapStatus.CREATED, + member1.getId(), new RoadmapCategory("it"), new RoadmapTags(new ArrayList<>())); final Member member2 = 사용자를_생성한다(2L, "identifier2", "name2"); final Member member3 = 사용자를_생성한다(3L, "identifier2", "name3"); @@ -513,8 +515,8 @@ RoadmapGoalRoomsOrderTypeDto.LATEST, new CustomScrollRequest(null, 10))) // given final Member member1 = 사용자를_생성한다(1L, "identifier1", "리뷰어1"); final Member member2 = 사용자를_생성한다(2L, "identifier2", "리뷰어2"); - final Roadmap roadmap = new Roadmap(1L, "로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.DIFFICULT, member1.getId(), - new RoadmapCategory("it")); + final Roadmap roadmap = new Roadmap(1L, "로드맵 제목", "로드맵 설명", 100, RoadmapDifficulty.DIFFICULT, RoadmapStatus.CREATED, + member1.getId(), new RoadmapCategory("it"), new RoadmapTags(new ArrayList<>())); final RoadmapReview roadmapReview1 = new RoadmapReview("리뷰 내용", 5.0, member1.getId(), roadmap.getId()); final RoadmapReview roadmapReview2 = new RoadmapReview("리뷰 내용", 4.5, member2.getId(), roadmap.getId()); @@ -565,15 +567,12 @@ null, new EncryptedPassword(new Password("password1!")), } private Roadmap 로드맵을_생성한다(final String roadmapTitle, final RoadmapCategory category) { - final Roadmap roadmap = new Roadmap(1L, roadmapTitle, "로드맵 소개글", 30, - RoadmapDifficulty.valueOf("DIFFICULT"), member.getId(), category); - final RoadmapTags roadmapTags = new RoadmapTags( List.of(new RoadmapTag(1L, new RoadmapTagName("태그1")), new RoadmapTag(2L, new RoadmapTagName("태그2")))); - roadmap.addTags(roadmapTags); - return roadmap; + return new Roadmap(1L, roadmapTitle, "로드맵 소개글", 30, + RoadmapDifficulty.valueOf("DIFFICULT"), RoadmapStatus.CREATED, member.getId(), category, roadmapTags); } private RoadmapCategory 로드맵_카테고리를_생성한다(final Long id, final String title) { @@ -581,11 +580,9 @@ null, new EncryptedPassword(new Password("password1!")), } private RoadmapContent 로드맵_컨텐츠를_생성한다(final String content, final Long roadmapId) { - final RoadmapContent roadmapContent = new RoadmapContent(1L, content, roadmapId); final RoadmapNodes roadmapNodes = new RoadmapNodes( List.of(new RoadmapNode(1L, "로드맵 노드1 제목", "로드맵 노드1 설명"))); - roadmapContent.addNodes(roadmapNodes); - return roadmapContent; + return new RoadmapContent(1L, content, roadmapId, roadmapNodes); } private List 로드맵_카테고리_리스트를_반환한다() { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapSchedulerTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapSchedulerTest.java index c497ebd7c..e7facd12f 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapSchedulerTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/service/RoadmapSchedulerTest.java @@ -10,6 +10,8 @@ import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapCategory; import co.kirikiri.roadmap.domain.RoadmapDifficulty; +import co.kirikiri.roadmap.domain.RoadmapStatus; +import co.kirikiri.roadmap.domain.RoadmapTags; import co.kirikiri.roadmap.persistence.RoadmapRepository; import co.kirikiri.roadmap.service.scheduler.RoadmapScheduler; import org.junit.jupiter.api.Test; @@ -19,6 +21,7 @@ import org.mockito.junit.jupiter.MockitoExtension; import java.time.LocalDate; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -52,7 +55,8 @@ class RoadmapSchedulerTest { new MemberProfile(Gender.FEMALE, "kirikiri@email.com")); final RoadmapCategory category = new RoadmapCategory("여행"); - final Roadmap roadmap = new Roadmap(1L, "로드맵2", "로드맵 설명2", 30, RoadmapDifficulty.DIFFICULT, member.getId(), category); + final Roadmap roadmap = new Roadmap(1L, "로드맵2", "로드맵 설명2", 30, RoadmapDifficulty.DIFFICULT, + RoadmapStatus.CREATED, member.getId(), category, new RoadmapTags(new ArrayList<>())); given(roadmapRepository.findByStatus(any())) .willReturn(List.of(roadmap)); @@ -75,7 +79,7 @@ class RoadmapSchedulerTest { new MemberProfile(Gender.FEMALE, "kirikiri@email.com")); final RoadmapCategory category = new RoadmapCategory("여행"); - final Roadmap roadmap = new Roadmap("로드맵1", "로드맵 설명1", 30, RoadmapDifficulty.DIFFICULT, member.getId(), category); + final Roadmap roadmap = new Roadmap("로드맵1", "로드맵 설명1", 30, RoadmapDifficulty.DIFFICULT, member.getId(), category, new RoadmapTags(new ArrayList<>())); given(roadmapRepository.findByStatus(any())) .willReturn(List.of(roadmap)); diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomCreateServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomCreateServiceTest.java index bd9000e23..1812e0198 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomCreateServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomCreateServiceTest.java @@ -34,6 +34,7 @@ import co.kirikiri.roadmap.domain.RoadmapNode; import co.kirikiri.roadmap.domain.RoadmapNodes; import co.kirikiri.roadmap.domain.RoadmapStatus; +import co.kirikiri.roadmap.domain.RoadmapTags; import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import co.kirikiri.service.dto.goalroom.request.CheckFeedRequest; @@ -44,7 +45,6 @@ import co.kirikiri.service.exception.BadRequestException; import co.kirikiri.service.exception.NotFoundException; import co.kirikiri.service.goalroom.GoalRoomCreateService; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; @@ -82,13 +82,15 @@ class GoalRoomCreateServiceTest { new MemberProfile(Gender.FEMALE, "kirikiri@email.com")); private static final Roadmap ROADMAP = new Roadmap(1L, "roadmap", "introduction", 30, RoadmapDifficulty.DIFFICULT, - MEMBER.getId(), new RoadmapCategory("IT")); + RoadmapStatus.CREATED, MEMBER.getId(), new RoadmapCategory("IT"), new RoadmapTags(new ArrayList<>())); - private static final Roadmap DELETED_ROADMAP = new Roadmap(2L, "roadmap", "introduction", 30, - RoadmapDifficulty.DIFFICULT, RoadmapStatus.DELETED, MEMBER.getId(), new RoadmapCategory("IT")); + private static final Roadmap DELETED_ROADMAP = new Roadmap(2L, "roadmap", "introduction", 30, RoadmapDifficulty.DIFFICULT, + RoadmapStatus.DELETED, MEMBER.getId(), new RoadmapCategory("IT"), new RoadmapTags(new ArrayList<>())); - private static final RoadmapContent ROADMAP_CONTENT = new RoadmapContent(1L, "content", ROADMAP.getId()); - private static final RoadmapContent DELETED_ROADMAP_CONTENT = new RoadmapContent(2L, "content2", DELETED_ROADMAP.getId()); + private static final RoadmapNode roadmapNode1 = new RoadmapNode(1L, "title1", "content1"); + private static final RoadmapNode roadmapNode2 = new RoadmapNode(2L, "title2", "content2"); + private static final RoadmapContent ROADMAP_CONTENT = new RoadmapContent(1L, "content", ROADMAP.getId(), new RoadmapNodes(List.of(roadmapNode1, roadmapNode2))); + private static final RoadmapContent DELETED_ROADMAP_CONTENT = new RoadmapContent(2L, "content2", DELETED_ROADMAP.getId(), null); @Mock private GoalRoomRepository goalRoomRepository; @@ -120,13 +122,6 @@ class GoalRoomCreateServiceTest { @InjectMocks private GoalRoomCreateService goalRoomCreateService; - @BeforeAll - static void setUp() { - final RoadmapNode roadmapNode1 = new RoadmapNode(1L, "title1", "content1"); - final RoadmapNode roadmapNode2 = new RoadmapNode(2L, "title2", "content2"); - ROADMAP_CONTENT.addNodes(new RoadmapNodes(List.of(roadmapNode1, roadmapNode2))); - } - @Test void 정상적으로_골룸을_생성한다() { //given diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomReadServiceTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomReadServiceTest.java index 8a7e52db7..8aab6c778 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomReadServiceTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomReadServiceTest.java @@ -36,6 +36,8 @@ import co.kirikiri.roadmap.domain.RoadmapNodeImage; import co.kirikiri.roadmap.domain.RoadmapNodeImages; import co.kirikiri.roadmap.domain.RoadmapNodes; +import co.kirikiri.roadmap.domain.RoadmapStatus; +import co.kirikiri.roadmap.domain.RoadmapTags; import co.kirikiri.service.dto.goalroom.GoalRoomMemberSortTypeDto; import co.kirikiri.service.dto.goalroom.request.GoalRoomStatusTypeRequest; import co.kirikiri.service.dto.goalroom.response.CheckFeedResponse; @@ -64,6 +66,7 @@ import java.net.URL; import java.time.LocalDate; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Optional; @@ -445,14 +448,13 @@ class GoalRoomReadServiceTest { @Test void 진행중인_사용자_단일_골룸을_조회한다() throws MalformedURLException { // given - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", 1L); final RoadmapNode roadmapNode1 = new RoadmapNode("로드맵 1주차", "로드맵 1주차 내용"); final RoadmapNode roadmapNode2 = new RoadmapNode("로드맵 2주차", "로드맵 2주차 내용"); final RoadmapNode roadmapNode3 = new RoadmapNode("로드맵 3주차", "로드맵 3주차 내용"); final RoadmapNode roadmapNode4 = new RoadmapNode("로드맵 4주차", "로드맵 4주차 내용"); final RoadmapNodes roadmapNodes = new RoadmapNodes( List.of(roadmapNode1, roadmapNode2, roadmapNode3, roadmapNode4)); - roadmapContent.addNodes(roadmapNodes); + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", 1L, roadmapNodes); final GoalRoomRoadmapNode goalRoomRoadmapNode1 = new GoalRoomRoadmapNode( new Period(TODAY, TODAY.plusDays(10)), 5, roadmapNode1); @@ -511,14 +513,13 @@ class GoalRoomReadServiceTest { @Test void 모집중인_사용자_단일_골룸_조회시_인증피드가_빈_응답을_반환한다() { // given - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", 1L); final RoadmapNode roadmapNode1 = new RoadmapNode("로드맵 1주차", "로드맵 1주차 내용"); final RoadmapNode roadmapNode2 = new RoadmapNode("로드맵 2주차", "로드맵 2주차 내용"); final RoadmapNode roadmapNode3 = new RoadmapNode("로드맵 3주차", "로드맵 3주차 내용"); final RoadmapNode roadmapNode4 = new RoadmapNode("로드맵 4주차", "로드맵 4주차 내용"); final RoadmapNodes roadmapNodes = new RoadmapNodes( List.of(roadmapNode1, roadmapNode2, roadmapNode3, roadmapNode4)); - roadmapContent.addNodes(roadmapNodes); + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", 1L, roadmapNodes); final GoalRoomRoadmapNode goalRoomRoadmapNode1 = new GoalRoomRoadmapNode( new Period(TODAY, TODAY.plusDays(10)), 5, roadmapNode1); @@ -564,14 +565,13 @@ class GoalRoomReadServiceTest { @Test void 종료된_사용자_단일_골룸을_조회시_전체_인증피드를_대상으로_반환한다() throws MalformedURLException { // given - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", 1L); final RoadmapNode roadmapNode1 = new RoadmapNode("로드맵 1주차", "로드맵 1주차 내용"); final RoadmapNode roadmapNode2 = new RoadmapNode("로드맵 2주차", "로드맵 2주차 내용"); final RoadmapNode roadmapNode3 = new RoadmapNode("로드맵 3주차", "로드맵 3주차 내용"); final RoadmapNode roadmapNode4 = new RoadmapNode("로드맵 4주차", "로드맵 4주차 내용"); final RoadmapNodes roadmapNodes = new RoadmapNodes( List.of(roadmapNode1, roadmapNode2, roadmapNode3, roadmapNode4)); - roadmapContent.addNodes(roadmapNodes); + final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", 1L, roadmapNodes); final GoalRoomRoadmapNode goalRoomRoadmapNode1 = new GoalRoomRoadmapNode( new Period(TODAY, TODAY.plusDays(10)), 5, roadmapNode1); @@ -1172,14 +1172,13 @@ null, new EncryptedPassword(new Password("password1")), new Nickname("name1"), private Roadmap 로드맵을_생성한다(final Member creator) { final RoadmapCategory category = new RoadmapCategory("게임"); - return new Roadmap(1L, "로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); + return new Roadmap(1L, "로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, + RoadmapStatus.CREATED, creator.getId(), category, new RoadmapTags(new ArrayList<>())); } private RoadmapContent 로드맵_본문을_생성한다(final Long roadmapId) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId); final List roadmapNodes = 로드맵_노드들을_생성한다(); - roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); - return roadmapContent; + return new RoadmapContent("로드맵 본문", roadmapId, new RoadmapNodes(roadmapNodes)); } private List 로드맵_노드들을_생성한다() { diff --git a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomSchedulerTest.java b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomSchedulerTest.java index a2b1a4eb1..11aac5d4a 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomSchedulerTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/service/GoalRoomSchedulerTest.java @@ -27,6 +27,7 @@ import co.kirikiri.roadmap.domain.RoadmapNodeImage; import co.kirikiri.roadmap.domain.RoadmapNodeImages; import co.kirikiri.roadmap.domain.RoadmapNodes; +import co.kirikiri.roadmap.domain.RoadmapTags; import co.kirikiri.service.scheduler.GoalRoomScheduler; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -36,6 +37,7 @@ import java.time.LocalDate; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -143,14 +145,13 @@ class GoalRoomSchedulerTest { private Roadmap 로드맵을_생성한다(final Member creator) { final RoadmapCategory category = new RoadmapCategory("게임"); - return new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, creator.getId(), category); + return new Roadmap("로드맵 제목", "로드맵 소개글", 10, RoadmapDifficulty.NORMAL, + creator.getId(), category, new RoadmapTags(new ArrayList<>())); } private RoadmapContent 로드맵_본문을_생성한다(final Long roadmapId) { - final RoadmapContent roadmapContent = new RoadmapContent("로드맵 본문", roadmapId); final List roadmapNodes = 로드맵_노드들을_생성한다(); - roadmapContent.addNodes(new RoadmapNodes(roadmapNodes)); - return roadmapContent; + return new RoadmapContent("로드맵 본문", roadmapId, new RoadmapNodes(roadmapNodes)); } private List 로드맵_노드들을_생성한다() { From 5cf81139eb7cda3a2795a9a94a5416f334a8e475 Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Sun, 21 Jan 2024 19:04:54 +0900 Subject: [PATCH 18/22] =?UTF-8?q?test:=20RoadmapNodes=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../roadmap/domain/RoadmapNodesTest.java | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodesTest.java b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodesTest.java index 4d65f7508..c16f642de 100644 --- a/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodesTest.java +++ b/backend/kirikiri/src/test/java/co/kirikiri/roadmap/domain/RoadmapNodesTest.java @@ -4,9 +4,11 @@ import org.junit.jupiter.api.Test; import java.util.List; +import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertAll; class RoadmapNodesTest { @@ -23,7 +25,45 @@ class RoadmapNodesTest { .hasMessage("한 로드맵에 같은 이름의 노드가 존재할 수 없습니다."); } - // todo: RoadmapNodes 도메인 테스트 추가하기 + @Test + void 로드맵_노드_아이디로_노드를_반환한다() { + // given + final RoadmapNode node1 = new RoadmapNode(1L, "title1", "content1"); + final RoadmapNode node2 = new RoadmapNode(2L, "title2", "content2"); + final RoadmapNodes roadmapNodes = new RoadmapNodes(List.of(node1, node2)); + + // when + final long findNodeId = 1; + final long notExistId = 3; + final Optional foundNode1 = roadmapNodes.findById(findNodeId); + final Optional foundNode2 = roadmapNodes.findById(notExistId); + + // then + assertAll( + () -> assertThat(node1).isEqualTo(foundNode1.get()), + () -> assertThat(foundNode2).isEmpty() + ); + } + + @Test + void 로드맵_노드_제목으로_노드를_반환한다() { + // given + final RoadmapNode node1 = new RoadmapNode(1L, "title1", "content1"); + final RoadmapNode node2 = new RoadmapNode(2L, "title2", "content2"); + final RoadmapNodes roadmapNodes = new RoadmapNodes(List.of(node1, node2)); + + // when + final String findNodeTitle = "title1"; + final String notExistTitle = "nothing"; + final Optional foundNode1 = roadmapNodes.findByTitle(findNodeTitle); + final Optional foundNode2 = roadmapNodes.findByTitle(notExistTitle); + + // then + assertAll( + () -> assertThat(node1).isEqualTo(foundNode1.get()), + () -> assertThat(foundNode2).isEmpty() + ); + } @Test void 로드맵_노드를_추가한다() { From a0472bc084cc96972f99a3873393758d2bdb0504 Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Thu, 15 Feb 2024 22:45:42 +0900 Subject: [PATCH 19/22] =?UTF-8?q?refactor:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=ED=81=B4=EB=9E=98=EC=8A=A4=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../roadmap/domain/RoadmapContents.java | 33 ------------------- .../roadmap/domain/RoadmapReviews.java | 22 ------------- 2 files changed, 55 deletions(-) delete mode 100644 backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContents.java delete mode 100644 backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReviews.java diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContents.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContents.java deleted file mode 100644 index 25d70fafd..000000000 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapContents.java +++ /dev/null @@ -1,33 +0,0 @@ -package co.kirikiri.roadmap.domain; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - -@NoArgsConstructor(access = AccessLevel.PROTECTED) -public class RoadmapContents { - - private final List values = new ArrayList<>(); - - public RoadmapContents(final List contents) { - this.values.addAll(contents); - } - - public void add(final RoadmapContent content) { - this.values.add(content); - } - - public Optional findLastRoadmapContent() { - if (values.isEmpty()) { - return Optional.empty(); - } - return Optional.of(values.get(values.size() - 1)); - } - - public List getValues() { - return values; - } -} diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReviews.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReviews.java deleted file mode 100644 index 2e360e084..000000000 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/domain/RoadmapReviews.java +++ /dev/null @@ -1,22 +0,0 @@ -package co.kirikiri.roadmap.domain; - -import jakarta.persistence.Embeddable; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; - -import java.util.ArrayList; -import java.util.List; - -@Embeddable -@NoArgsConstructor(access = AccessLevel.PROTECTED) -public class RoadmapReviews { - - // @OneToMany(fetch = FetchType.LAZY, -// cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE}, -// orphanRemoval = true, mappedBy = "roadmap") - private List values = new ArrayList<>(); - - public void add(final RoadmapReview review) { - this.values.add(review); - } -} From 732673f36df7bf8bf0a7c57b714e113e44a4f858 Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Thu, 15 Feb 2024 22:46:12 +0900 Subject: [PATCH 20/22] =?UTF-8?q?fix:=20=EB=8D=B0=EC=9D=B4=ED=84=B0?= =?UTF-8?q?=EB=B2=A0=EC=9D=B4=EC=8A=A4=20=EB=AC=B4=EA=B2=B0=EC=84=B1=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/co/kirikiri/roadmap/service/RoadmapCreateService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java index 5b6df89b2..80afe90fb 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java @@ -145,9 +145,9 @@ public void deleteRoadmap(final String identifier, final Long roadmapId) { final Roadmap roadmap = findRoadmapById(roadmapId); validateRoadmapCreator(roadmapId, identifier); if (!roadmapGoalRoomService.hasGoalRooms(roadmapId)) { - roadmapRepository.delete(roadmap); roadmapContentRepository.deleteAllByRoadmapId(roadmapId); roadmapReviewRepository.deleteAllByRoadmapId(roadmapId); + roadmapRepository.delete(roadmap); return; } roadmap.delete(); From fc761d529ad19a3482b6c473907359bec365995d Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Fri, 16 Feb 2024 22:22:50 +0900 Subject: [PATCH 21/22] =?UTF-8?q?refactor:=20=EB=A1=9C=EB=93=9C=EB=A7=B5?= =?UTF-8?q?=20=EC=82=AD=EC=A0=9C=20=EC=8B=9C=20=EC=97=B0=EA=B4=80=EB=90=9C?= =?UTF-8?q?=20=EB=A6=AC=EB=B7=B0=20=EC=82=AD=EC=A0=9C=EB=A5=BC=20=EC=9D=B4?= =?UTF-8?q?=EB=B2=A4=ED=8A=B8=EB=A1=9C=20=EB=B0=9C=ED=96=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../roadmap/service/RoadmapCreateService.java | 3 ++- .../RoadmapReviewDeleteEventListener.java | 26 +++++++++++++++++++ .../service/event/RoadmapDeleteEvent.java | 7 +++++ .../service/scheduler/RoadmapScheduler.java | 7 +++++ 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReviewDeleteEventListener.java create mode 100644 backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/event/RoadmapDeleteEvent.java diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java index 80afe90fb..a33065755 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapCreateService.java @@ -25,6 +25,7 @@ import co.kirikiri.roadmap.service.dto.request.RoadmapReviewSaveRequest; import co.kirikiri.roadmap.service.dto.request.RoadmapSaveRequest; import co.kirikiri.roadmap.service.event.RoadmapCreateEvent; +import co.kirikiri.roadmap.service.event.RoadmapDeleteEvent; import co.kirikiri.roadmap.service.mapper.RoadmapMapper; import co.kirikiri.service.aop.ExceptionConvert; import co.kirikiri.service.exception.AuthenticationException; @@ -145,8 +146,8 @@ public void deleteRoadmap(final String identifier, final Long roadmapId) { final Roadmap roadmap = findRoadmapById(roadmapId); validateRoadmapCreator(roadmapId, identifier); if (!roadmapGoalRoomService.hasGoalRooms(roadmapId)) { + applicationEventPublisher.publishEvent(new RoadmapDeleteEvent(roadmap.getId(), "Review")); roadmapContentRepository.deleteAllByRoadmapId(roadmapId); - roadmapReviewRepository.deleteAllByRoadmapId(roadmapId); roadmapRepository.delete(roadmap); return; } diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReviewDeleteEventListener.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReviewDeleteEventListener.java new file mode 100644 index 000000000..046fdd173 --- /dev/null +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReviewDeleteEventListener.java @@ -0,0 +1,26 @@ +package co.kirikiri.roadmap.service; + +import co.kirikiri.roadmap.persistence.RoadmapReviewRepository; +import co.kirikiri.roadmap.service.event.RoadmapDeleteEvent; +import lombok.RequiredArgsConstructor; +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.context.event.EventListener; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class RoadmapReviewDeleteEventListener { + + private final RoadmapReviewRepository roadmapReviewRepository; + private final ApplicationEventPublisher applicationEventPublisher; + + @EventListener(condition = "#roadmapDeleteEvent.target == 'Review'") + public void handleRoadmapReviewDelete(final RoadmapDeleteEvent roadmapDeleteEvent) { + deleteRoadmapReviews(roadmapDeleteEvent.roadmapId()); + } + + private void deleteRoadmapReviews(final Long roadmapId) { + roadmapReviewRepository.deleteAllByRoadmapId(roadmapId); + applicationEventPublisher.publishEvent(new RoadmapDeleteEvent(roadmapId, "Roadmap")); + } +} diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/event/RoadmapDeleteEvent.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/event/RoadmapDeleteEvent.java new file mode 100644 index 000000000..a2a7f35b0 --- /dev/null +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/event/RoadmapDeleteEvent.java @@ -0,0 +1,7 @@ +package co.kirikiri.roadmap.service.event; + +public record RoadmapDeleteEvent( + Long roadmapId, + String target +) { +} diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java index 7bc0cf623..2b383664d 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/scheduler/RoadmapScheduler.java @@ -2,10 +2,13 @@ import co.kirikiri.roadmap.domain.Roadmap; import co.kirikiri.roadmap.domain.RoadmapStatus; +import co.kirikiri.roadmap.persistence.RoadmapContentRepository; import co.kirikiri.roadmap.persistence.RoadmapRepository; import co.kirikiri.roadmap.service.RoadmapGoalRoomService; +import co.kirikiri.roadmap.service.event.RoadmapDeleteEvent; import co.kirikiri.service.aop.ExceptionConvert; import lombok.RequiredArgsConstructor; +import org.springframework.context.ApplicationEventPublisher; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -19,7 +22,9 @@ public class RoadmapScheduler { private final RoadmapRepository roadmapRepository; + private final RoadmapContentRepository roadmapContentRepository; private final RoadmapGoalRoomService roadmapGoalRoomService; + private final ApplicationEventPublisher applicationEventPublisher; @Scheduled(cron = "0 0 4 * * *") public void deleteRoadmaps() { @@ -34,6 +39,8 @@ private void delete(final Roadmap roadmap) { final boolean canDelete = roadmapGoalRoomService.canDeleteGoalRoomsInRoadmap(roadmap.getId()); // TODO : GoalRoom 내부의 Roadmap 직접 의존 제거 시 로드맵에 포함된 GoalRoom 따로 제거해주기 (이벤트 활용) if (canDelete) { + applicationEventPublisher.publishEvent(new RoadmapDeleteEvent(roadmap.getId(), "Review")); + roadmapContentRepository.deleteAllByRoadmapId(roadmap.getId()); roadmapRepository.delete(roadmap); } } From 3a7e610cc3104d5a8b95ff4e08c43d2e319024cd Mon Sep 17 00:00:00 2001 From: Ohjintaek Date: Wed, 27 Mar 2024 23:41:13 +0900 Subject: [PATCH 22/22] =?UTF-8?q?refactor:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=ED=98=B8=EC=B6=9C=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/RoadmapReviewDeleteEventListener.java | 9 +-------- backend/kirikiri/src/main/resources/properties | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReviewDeleteEventListener.java b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReviewDeleteEventListener.java index 046fdd173..803f51a28 100644 --- a/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReviewDeleteEventListener.java +++ b/backend/kirikiri/src/main/java/co/kirikiri/roadmap/service/RoadmapReviewDeleteEventListener.java @@ -3,7 +3,6 @@ import co.kirikiri.roadmap.persistence.RoadmapReviewRepository; import co.kirikiri.roadmap.service.event.RoadmapDeleteEvent; import lombok.RequiredArgsConstructor; -import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.event.EventListener; import org.springframework.stereotype.Service; @@ -12,15 +11,9 @@ public class RoadmapReviewDeleteEventListener { private final RoadmapReviewRepository roadmapReviewRepository; - private final ApplicationEventPublisher applicationEventPublisher; @EventListener(condition = "#roadmapDeleteEvent.target == 'Review'") public void handleRoadmapReviewDelete(final RoadmapDeleteEvent roadmapDeleteEvent) { - deleteRoadmapReviews(roadmapDeleteEvent.roadmapId()); - } - - private void deleteRoadmapReviews(final Long roadmapId) { - roadmapReviewRepository.deleteAllByRoadmapId(roadmapId); - applicationEventPublisher.publishEvent(new RoadmapDeleteEvent(roadmapId, "Roadmap")); + roadmapReviewRepository.deleteAllByRoadmapId(roadmapDeleteEvent.roadmapId()); } } diff --git a/backend/kirikiri/src/main/resources/properties b/backend/kirikiri/src/main/resources/properties index 2a724a7f4..c5f41e5e1 160000 --- a/backend/kirikiri/src/main/resources/properties +++ b/backend/kirikiri/src/main/resources/properties @@ -1 +1 @@ -Subproject commit 2a724a7f4b45163a35cf72ab579444baa063316f +Subproject commit c5f41e5e110dcb998446e18a52b31f6f4cc33d6f