From cda09de79688ea315dceaab42fdeb3cf2faa85e7 Mon Sep 17 00:00:00 2001 From: kokodak Date: Sun, 15 Oct 2023 19:20:22 +0900 Subject: [PATCH 1/9] =?UTF-8?q?feat:=20=EC=9E=A5=EC=86=8C=ED=86=B5?= =?UTF-8?q?=EA=B3=84=20=EC=83=9D=EC=84=B1=20Command=20DTO=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/dto/CreatePlaceStatisticsCommand.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 backend/src/main/java/com/now/naaga/placestatistics/application/dto/CreatePlaceStatisticsCommand.java diff --git a/backend/src/main/java/com/now/naaga/placestatistics/application/dto/CreatePlaceStatisticsCommand.java b/backend/src/main/java/com/now/naaga/placestatistics/application/dto/CreatePlaceStatisticsCommand.java new file mode 100644 index 000000000..3f441531c --- /dev/null +++ b/backend/src/main/java/com/now/naaga/placestatistics/application/dto/CreatePlaceStatisticsCommand.java @@ -0,0 +1,4 @@ +package com.now.naaga.placestatistics.application.dto; + +public record CreatePlaceStatisticsCommand(Long placeId) { +} From 2d0d015a081af6149b75e70b639af7f7f5803d94 Mon Sep 17 00:00:00 2001 From: kokodak Date: Sun, 15 Oct 2023 19:21:06 +0900 Subject: [PATCH 2/9] =?UTF-8?q?feat:=20=EC=9E=A5=EC=86=8C=20=ED=86=B5?= =?UTF-8?q?=EA=B3=84=20=EC=83=9D=EC=84=B1=20=EC=84=9C=EB=B9=84=EC=8A=A4=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/PlaceStatisticsService.java | 26 ++++++++-- .../PlaceStatisticsServiceTest.java | 49 +++++++++++++------ 2 files changed, 56 insertions(+), 19 deletions(-) diff --git a/backend/src/main/java/com/now/naaga/placestatistics/application/PlaceStatisticsService.java b/backend/src/main/java/com/now/naaga/placestatistics/application/PlaceStatisticsService.java index 9564025f9..23fbb80bb 100644 --- a/backend/src/main/java/com/now/naaga/placestatistics/application/PlaceStatisticsService.java +++ b/backend/src/main/java/com/now/naaga/placestatistics/application/PlaceStatisticsService.java @@ -1,10 +1,16 @@ package com.now.naaga.placestatistics.application; -import com.now.naaga.placestatistics.domain.PlaceStatistics; +import static com.now.naaga.placestatistics.domain.PlaceStatistics.LIKE_COUNT_DEFAULT_VALUE; + +import com.now.naaga.place.application.PlaceService; +import com.now.naaga.place.application.dto.FindPlaceByIdCommand; +import com.now.naaga.place.domain.Place; +import com.now.naaga.placestatistics.application.dto.CreatePlaceStatisticsCommand; import com.now.naaga.placestatistics.application.dto.SubtractLikeCommand; +import com.now.naaga.placestatistics.domain.PlaceStatistics; +import com.now.naaga.placestatistics.exception.PlaceStatisticsException; import com.now.naaga.placestatistics.exception.PlaceStatisticsExceptionType; import com.now.naaga.placestatistics.repository.PlaceStatisticsRepository; -import com.now.naaga.placestatistics.exception.PlaceStatisticsException; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -14,15 +20,27 @@ public class PlaceStatisticsService { private final PlaceStatisticsRepository placeStatisticsRepository; - public PlaceStatisticsService(final PlaceStatisticsRepository placeStatisticsRepository) { + private final PlaceService placeService; + + public PlaceStatisticsService(final PlaceStatisticsRepository placeStatisticsRepository, + final PlaceService placeService) { this.placeStatisticsRepository = placeStatisticsRepository; + this.placeService = placeService; + } + + public PlaceStatistics createPlaceStatistics(final CreatePlaceStatisticsCommand createPlaceStatisticsCommand) { + final Long placeId = createPlaceStatisticsCommand.placeId(); + final Place place = placeService.findPlaceById(new FindPlaceByIdCommand(placeId)); + + final PlaceStatistics placeStatistics = new PlaceStatistics(place, LIKE_COUNT_DEFAULT_VALUE); + return placeStatisticsRepository.save(placeStatistics); } public void subtractLike(final SubtractLikeCommand subtractLikeCommand) { final Long placeId = subtractLikeCommand.placeId(); final PlaceStatistics placeStatistics = placeStatisticsRepository.findByPlaceId(placeId) - .orElseThrow(() -> new PlaceStatisticsException(PlaceStatisticsExceptionType.NOT_FOUND)); + .orElseThrow(() -> new PlaceStatisticsException(PlaceStatisticsExceptionType.NOT_FOUND)); placeStatistics.subtractLike(); } diff --git a/backend/src/test/java/com/now/naaga/placestatistics/application/PlaceStatisticsServiceTest.java b/backend/src/test/java/com/now/naaga/placestatistics/application/PlaceStatisticsServiceTest.java index 81c77cfb5..45dc29af7 100644 --- a/backend/src/test/java/com/now/naaga/placestatistics/application/PlaceStatisticsServiceTest.java +++ b/backend/src/test/java/com/now/naaga/placestatistics/application/PlaceStatisticsServiceTest.java @@ -1,39 +1,58 @@ package com.now.naaga.placestatistics.application; +import static org.assertj.core.api.Assertions.assertThat; + +import com.now.naaga.common.builder.PlaceBuilder; import com.now.naaga.common.builder.PlaceStatisticsBuilder; import com.now.naaga.place.domain.Place; +import com.now.naaga.placestatistics.application.dto.CreatePlaceStatisticsCommand; import com.now.naaga.placestatistics.application.dto.SubtractLikeCommand; import com.now.naaga.placestatistics.domain.PlaceStatistics; import com.now.naaga.placestatistics.repository.PlaceStatisticsRepository; import org.junit.jupiter.api.DisplayNameGeneration; -import org.junit.jupiter.api.DisplayNameGenerator; +import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.jdbc.Sql; +import org.springframework.transaction.annotation.Transactional; -import static org.assertj.core.api.Assertions.assertThat; - -@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) +@SuppressWarnings("NonAsciiCharacters") +@DisplayNameGeneration(ReplaceUnderscores.class) @Sql("/truncate.sql") @ActiveProfiles("test") @SpringBootTest class PlaceStatisticsServiceTest { - PlaceStatisticsService placeStatisticsService; + @Autowired + private PlaceStatisticsRepository placeStatisticsRepository; - PlaceStatisticsBuilder placeStatisticsBuilder; + @Autowired + private PlaceStatisticsService placeStatisticsService; - PlaceStatisticsRepository placeStatisticsRepository; + @Autowired + private PlaceStatisticsBuilder placeStatisticsBuilder; @Autowired - public PlaceStatisticsServiceTest(final PlaceStatisticsService placeStatisticsService, - final PlaceStatisticsBuilder placeStatisticsBuilder, - final PlaceStatisticsRepository placeStatisticsRepository) { - this.placeStatisticsService = placeStatisticsService; - this.placeStatisticsBuilder = placeStatisticsBuilder; - this.placeStatisticsRepository = placeStatisticsRepository; + private PlaceBuilder placeBuilder; + + @Transactional + @Test + void 장소통계를_생성한다() { + // given + final Place place = placeBuilder.init() + .build(); + + // when + final CreatePlaceStatisticsCommand command = new CreatePlaceStatisticsCommand(place.getId()); + final PlaceStatistics actual = placeStatisticsService.createPlaceStatistics(command); + + // then + final PlaceStatistics expected = new PlaceStatistics(place, PlaceStatistics.LIKE_COUNT_DEFAULT_VALUE); + assertThat(actual).usingRecursiveComparison() + .ignoringExpectedNullFields() + .isEqualTo(expected); } @Test @@ -41,8 +60,8 @@ public PlaceStatisticsServiceTest(final PlaceStatisticsService placeStatisticsSe //given final long beforeLikeCount = 10L; final PlaceStatistics placeStatistics = placeStatisticsBuilder.init() - .likeCount(beforeLikeCount) - .build(); + .likeCount(beforeLikeCount) + .build(); final Place place = placeStatistics.getPlace(); //when From 94c533dd8acd5fd4bfae6601382b427c1dfb1471 Mon Sep 17 00:00:00 2001 From: kokodak Date: Sun, 15 Oct 2023 20:55:52 +0900 Subject: [PATCH 3/9] =?UTF-8?q?feat:=20=EC=9E=A5=EC=86=8C=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=EC=97=90=20=EB=8C=80=ED=95=9C=20=EC=9D=B4=EB=B2=A4?= =?UTF-8?q?=ED=8A=B8=20=EA=B0=9D=EC=B2=B4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/now/naaga/place/domain/PlaceCreateEvent.java | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 backend/src/main/java/com/now/naaga/place/domain/PlaceCreateEvent.java diff --git a/backend/src/main/java/com/now/naaga/place/domain/PlaceCreateEvent.java b/backend/src/main/java/com/now/naaga/place/domain/PlaceCreateEvent.java new file mode 100644 index 000000000..93f2548a2 --- /dev/null +++ b/backend/src/main/java/com/now/naaga/place/domain/PlaceCreateEvent.java @@ -0,0 +1,5 @@ +package com.now.naaga.place.domain; + +public record PlaceCreateEvent(Long temporaryPlaceId, + Long placeId) { +} From 186ae3286d3880634c69f9ed81b3e53c74590463 Mon Sep 17 00:00:00 2001 From: kokodak Date: Sun, 15 Oct 2023 20:57:08 +0900 Subject: [PATCH 4/9] =?UTF-8?q?feat:=20=EC=9E=A5=EC=86=8C=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=EC=97=90=20=EB=8C=80=ED=95=9C=20=ED=9B=84=EC=86=8D=20?= =?UTF-8?q?=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=ED=95=B8=EB=93=A4=EB=9F=AC=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - feat: 장소 통계 생성 이벤트 핸들러 구현 - feat: 임시 장소 삭제 이벤트 핸들러 구현 --- ...StatisticsWithPlaceCreateEventHandler.java | 23 +++++++++++++++++++ ...oraryPlaceWithPlaceCreateEventHandler.java | 21 +++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 backend/src/main/java/com/now/naaga/placestatistics/application/CreatePlaceStatisticsWithPlaceCreateEventHandler.java create mode 100644 backend/src/main/java/com/now/naaga/temporaryplace/application/DeleteTemporaryPlaceWithPlaceCreateEventHandler.java diff --git a/backend/src/main/java/com/now/naaga/placestatistics/application/CreatePlaceStatisticsWithPlaceCreateEventHandler.java b/backend/src/main/java/com/now/naaga/placestatistics/application/CreatePlaceStatisticsWithPlaceCreateEventHandler.java new file mode 100644 index 000000000..f0743ab2b --- /dev/null +++ b/backend/src/main/java/com/now/naaga/placestatistics/application/CreatePlaceStatisticsWithPlaceCreateEventHandler.java @@ -0,0 +1,23 @@ +package com.now.naaga.placestatistics.application; + +import com.now.naaga.place.domain.PlaceCreateEvent; +import com.now.naaga.placestatistics.application.dto.CreatePlaceStatisticsCommand; +import org.springframework.context.event.EventListener; +import org.springframework.stereotype.Component; + +@Component +public class CreatePlaceStatisticsWithPlaceCreateEventHandler { + + private final PlaceStatisticsService placeStatisticsService; + + public CreatePlaceStatisticsWithPlaceCreateEventHandler(final PlaceStatisticsService placeStatisticsService) { + this.placeStatisticsService = placeStatisticsService; + } + + @EventListener + public void handle(final PlaceCreateEvent placeCreateEvent) { + final Long placeId = placeCreateEvent.placeId(); + final CreatePlaceStatisticsCommand command = new CreatePlaceStatisticsCommand(placeId); + placeStatisticsService.createPlaceStatistics(command); + } +} diff --git a/backend/src/main/java/com/now/naaga/temporaryplace/application/DeleteTemporaryPlaceWithPlaceCreateEventHandler.java b/backend/src/main/java/com/now/naaga/temporaryplace/application/DeleteTemporaryPlaceWithPlaceCreateEventHandler.java new file mode 100644 index 000000000..9bc160130 --- /dev/null +++ b/backend/src/main/java/com/now/naaga/temporaryplace/application/DeleteTemporaryPlaceWithPlaceCreateEventHandler.java @@ -0,0 +1,21 @@ +package com.now.naaga.temporaryplace.application; + +import com.now.naaga.place.domain.PlaceCreateEvent; +import org.springframework.context.event.EventListener; +import org.springframework.stereotype.Component; + +@Component +public class DeleteTemporaryPlaceWithPlaceCreateEventHandler { + + private final TemporaryPlaceService temporaryPlaceService; + + public DeleteTemporaryPlaceWithPlaceCreateEventHandler(final TemporaryPlaceService temporaryPlaceService) { + this.temporaryPlaceService = temporaryPlaceService; + } + + @EventListener + public void handle(final PlaceCreateEvent placeCreateEvent) { + final Long temporaryPlaceId = placeCreateEvent.temporaryPlaceId(); + temporaryPlaceService.deleteById(temporaryPlaceId); + } +} From b6d16aa8bd4a7799b2017c39b9a247cd1d89052a Mon Sep 17 00:00:00 2001 From: kokodak Date: Sun, 15 Oct 2023 20:57:52 +0900 Subject: [PATCH 5/9] =?UTF-8?q?feat:=20=EC=9E=A5=EC=86=8C=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=20=EB=A9=94=EC=84=9C=EB=93=9C=EC=97=90=20=EC=8A=A4?= =?UTF-8?q?=ED=94=84=EB=A7=81=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../now/naaga/place/application/PlaceService.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/backend/src/main/java/com/now/naaga/place/application/PlaceService.java b/backend/src/main/java/com/now/naaga/place/application/PlaceService.java index d27464e1a..3206897c8 100644 --- a/backend/src/main/java/com/now/naaga/place/application/PlaceService.java +++ b/backend/src/main/java/com/now/naaga/place/application/PlaceService.java @@ -9,6 +9,7 @@ import com.now.naaga.place.application.dto.RecommendPlaceCommand; import com.now.naaga.place.domain.Place; import com.now.naaga.place.domain.PlaceCheckService; +import com.now.naaga.place.domain.PlaceCreateEvent; import com.now.naaga.place.domain.PlaceRecommendService; import com.now.naaga.place.domain.Position; import com.now.naaga.place.domain.SortType; @@ -16,8 +17,8 @@ import com.now.naaga.place.persistence.repository.PlaceRepository; import com.now.naaga.player.application.PlayerService; import com.now.naaga.player.domain.Player; -import com.now.naaga.temporaryplace.application.TemporaryPlaceService; import java.util.List; +import org.springframework.context.ApplicationEventPublisher; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -29,22 +30,22 @@ public class PlaceService { private final PlayerService playerService; - private final TemporaryPlaceService temporaryPlaceService; - private final PlaceCheckService placeCheckService; private final PlaceRecommendService placeRecommendService; + private final ApplicationEventPublisher applicationEventPublisher; + public PlaceService(final PlaceRepository placeRepository, final PlayerService playerService, - final TemporaryPlaceService temporaryPlaceService, final PlaceCheckService placeCheckService, - final PlaceRecommendService placeRecommendService) { + final PlaceRecommendService placeRecommendService, + final ApplicationEventPublisher applicationEventPublisher) { this.placeRepository = placeRepository; this.playerService = playerService; - this.temporaryPlaceService = temporaryPlaceService; this.placeCheckService = placeCheckService; this.placeRecommendService = placeRecommendService; + this.applicationEventPublisher = applicationEventPublisher; } @Transactional(readOnly = true) @@ -80,7 +81,7 @@ public Place createPlace(final CreatePlaceCommand createPlaceCommand) { registeredPlayer); placeRepository.save(place); - temporaryPlaceService.deleteById(createPlaceCommand.temporaryPlaceId()); + applicationEventPublisher.publishEvent(new PlaceCreateEvent(createPlaceCommand.temporaryPlaceId(), place.getId())); return place; } } From 015f83d3188e8ae377b8f23233fb38be15078b44 Mon Sep 17 00:00:00 2001 From: kokodak Date: Sun, 15 Oct 2023 20:59:20 +0900 Subject: [PATCH 6/9] =?UTF-8?q?test:=20=EC=9E=A5=EC=86=8C=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=20=EC=8B=9C,=20=EC=9E=A5=EC=86=8C=20=ED=86=B5?= =?UTF-8?q?=EA=B3=84=20=EB=93=B1=EB=A1=9D=20=EA=B2=80=EC=A6=9D=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../place/application/PlaceServiceTest.java | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/backend/src/test/java/com/now/naaga/place/application/PlaceServiceTest.java b/backend/src/test/java/com/now/naaga/place/application/PlaceServiceTest.java index c1543b507..de4023bea 100644 --- a/backend/src/test/java/com/now/naaga/place/application/PlaceServiceTest.java +++ b/backend/src/test/java/com/now/naaga/place/application/PlaceServiceTest.java @@ -13,9 +13,12 @@ import com.now.naaga.place.domain.Position; import com.now.naaga.place.exception.PlaceException; import com.now.naaga.place.exception.PlaceExceptionType; +import com.now.naaga.placestatistics.domain.PlaceStatistics; +import com.now.naaga.placestatistics.repository.PlaceStatisticsRepository; import com.now.naaga.player.domain.Player; import com.now.naaga.temporaryplace.domain.TemporaryPlace; import com.now.naaga.temporaryplace.repository.TemporaryPlaceRepository; +import java.util.Optional; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores; import org.junit.jupiter.api.Test; @@ -35,6 +38,9 @@ class PlaceServiceTest { @Autowired private TemporaryPlaceRepository temporaryPlaceRepository; + @Autowired + private PlaceStatisticsRepository placeStatisticsRepository; + @Autowired private PlaceService placeService; @@ -87,6 +93,32 @@ class PlaceServiceTest { }); } + @Test + void 장소_등록_시_장소_통계도_함께_등록된다() { + // given + final Player player = playerBuilder.init() + .build(); + + final TemporaryPlace temporaryPlace = temporaryPlaceBuilder.init() + .build(); + + final Long temporaryPlaceId = temporaryPlace.getId(); + + final CreatePlaceCommand createPlaceCommand = new CreatePlaceCommand("루터회관", + "이곳은 루터회관이다 알겠냐", + Position.of(1.23, 4.56), + "image/url", + player.getId(), + temporaryPlaceId); + + // when + final Place place = placeService.createPlace(createPlaceCommand); + + // then + final Optional placeStatistics = placeStatisticsRepository.findByPlaceId(place.getId()); + assertThat(placeStatistics).isNotEmpty(); + } + @Test void 장소_등록_시_주변_반경_20M_내에_등록된_장소가_존재한다면_예외가_발생한다() { // given @@ -112,4 +144,4 @@ class PlaceServiceTest { // then assertThat(baseExceptionType).isEqualTo(PlaceExceptionType.ALREADY_EXIST_NEARBY); } -} \ No newline at end of file +} From 5e8a0abf08918a0a322b56f91aeb5ef018919a02 Mon Sep 17 00:00:00 2001 From: kokodak Date: Sun, 15 Oct 2023 21:11:04 +0900 Subject: [PATCH 7/9] =?UTF-8?q?chore:=20place=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=EC=99=80=20placestatistics=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=20=ED=86=B5=ED=95=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../like/application/PlaceLikeService.java | 8 ++------ ...ceStatisticsWithPlaceCreateEventHandler.java | 4 ++-- .../naaga/place/application/PlaceService.java | 2 +- .../application/PlaceStatisticsService.java | 17 ++++++++--------- .../dto/CreatePlaceStatisticsCommand.java | 2 +- .../application/dto/SubtractLikeCommand.java | 4 ++++ .../java/com/now/naaga/place/domain/Place.java | 10 ++++++++-- .../naaga/place/domain/PlaceCheckService.java | 5 ++--- .../place/domain/PlaceRecommendService.java | 10 ++++------ .../domain/PlaceStatistics.java | 13 ++++++++----- .../exception/PlaceStatisticsException.java | 2 +- .../exception/PlaceStatisticsExceptionType.java | 2 +- .../repository/PlaceRepository.java | 2 +- .../repository/PlaceStatisticsRepository.java | 7 +++---- .../application/dto/SubtractLikeCommand.java | 4 ---- .../now/naaga/common/builder/PlaceBuilder.java | 2 +- .../common/builder/PlaceStatisticsBuilder.java | 4 ++-- .../common/fixture/PlaceStatisticsFixture.java | 2 +- .../like/application/PlaceLikeServiceTest.java | 8 ++------ .../presentation/PlaceLikeControllerTest.java | 6 ------ .../place/application/PlaceServiceTest.java | 4 ++-- .../application/PlaceStatisticsServiceTest.java | 10 +++++----- .../domain/PlaceStatisticsTest.java | 7 +++---- .../naaga/place/service/PlaceServiceTest.java | 11 ++++------- 24 files changed, 66 insertions(+), 80 deletions(-) rename backend/src/main/java/com/now/naaga/{placestatistics => place}/application/CreatePlaceStatisticsWithPlaceCreateEventHandler.java (85%) rename backend/src/main/java/com/now/naaga/{placestatistics => place}/application/PlaceStatisticsService.java (71%) rename backend/src/main/java/com/now/naaga/{placestatistics => place}/application/dto/CreatePlaceStatisticsCommand.java (52%) create mode 100644 backend/src/main/java/com/now/naaga/place/application/dto/SubtractLikeCommand.java rename backend/src/main/java/com/now/naaga/{placestatistics => place}/domain/PlaceStatistics.java (86%) rename backend/src/main/java/com/now/naaga/{placestatistics => place}/exception/PlaceStatisticsException.java (91%) rename backend/src/main/java/com/now/naaga/{placestatistics => place}/exception/PlaceStatisticsExceptionType.java (95%) rename backend/src/main/java/com/now/naaga/place/{persistence => }/repository/PlaceRepository.java (95%) rename backend/src/main/java/com/now/naaga/{placestatistics => place}/repository/PlaceStatisticsRepository.java (68%) delete mode 100644 backend/src/main/java/com/now/naaga/placestatistics/application/dto/SubtractLikeCommand.java rename backend/src/test/java/com/now/naaga/{placestatistics => place}/application/PlaceStatisticsServiceTest.java (88%) rename backend/src/test/java/com/now/naaga/{placestatistics => place}/domain/PlaceStatisticsTest.java (93%) diff --git a/backend/src/main/java/com/now/naaga/like/application/PlaceLikeService.java b/backend/src/main/java/com/now/naaga/like/application/PlaceLikeService.java index d5848c5f5..499ffb6f8 100644 --- a/backend/src/main/java/com/now/naaga/like/application/PlaceLikeService.java +++ b/backend/src/main/java/com/now/naaga/like/application/PlaceLikeService.java @@ -2,13 +2,9 @@ import com.now.naaga.like.application.dto.CancelLikeCommand; import com.now.naaga.like.domain.PlaceLike; -import com.now.naaga.like.exception.PlaceLikeException; -import com.now.naaga.like.exception.PlaceLikeExceptionType; import com.now.naaga.like.repository.PlaceLikeRepository; -import com.now.naaga.player.application.PlayerService; -import com.now.naaga.player.domain.Player; -import com.now.naaga.placestatistics.application.PlaceStatisticsService; -import com.now.naaga.placestatistics.application.dto.SubtractLikeCommand; +import com.now.naaga.place.application.PlaceStatisticsService; +import com.now.naaga.place.application.dto.SubtractLikeCommand; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/backend/src/main/java/com/now/naaga/placestatistics/application/CreatePlaceStatisticsWithPlaceCreateEventHandler.java b/backend/src/main/java/com/now/naaga/place/application/CreatePlaceStatisticsWithPlaceCreateEventHandler.java similarity index 85% rename from backend/src/main/java/com/now/naaga/placestatistics/application/CreatePlaceStatisticsWithPlaceCreateEventHandler.java rename to backend/src/main/java/com/now/naaga/place/application/CreatePlaceStatisticsWithPlaceCreateEventHandler.java index f0743ab2b..5ce1db3e3 100644 --- a/backend/src/main/java/com/now/naaga/placestatistics/application/CreatePlaceStatisticsWithPlaceCreateEventHandler.java +++ b/backend/src/main/java/com/now/naaga/place/application/CreatePlaceStatisticsWithPlaceCreateEventHandler.java @@ -1,7 +1,7 @@ -package com.now.naaga.placestatistics.application; +package com.now.naaga.place.application; +import com.now.naaga.place.application.dto.CreatePlaceStatisticsCommand; import com.now.naaga.place.domain.PlaceCreateEvent; -import com.now.naaga.placestatistics.application.dto.CreatePlaceStatisticsCommand; import org.springframework.context.event.EventListener; import org.springframework.stereotype.Component; diff --git a/backend/src/main/java/com/now/naaga/place/application/PlaceService.java b/backend/src/main/java/com/now/naaga/place/application/PlaceService.java index 3206897c8..e7ecba0b5 100644 --- a/backend/src/main/java/com/now/naaga/place/application/PlaceService.java +++ b/backend/src/main/java/com/now/naaga/place/application/PlaceService.java @@ -14,7 +14,7 @@ import com.now.naaga.place.domain.Position; import com.now.naaga.place.domain.SortType; import com.now.naaga.place.exception.PlaceException; -import com.now.naaga.place.persistence.repository.PlaceRepository; +import com.now.naaga.place.repository.PlaceRepository; import com.now.naaga.player.application.PlayerService; import com.now.naaga.player.domain.Player; import java.util.List; diff --git a/backend/src/main/java/com/now/naaga/placestatistics/application/PlaceStatisticsService.java b/backend/src/main/java/com/now/naaga/place/application/PlaceStatisticsService.java similarity index 71% rename from backend/src/main/java/com/now/naaga/placestatistics/application/PlaceStatisticsService.java rename to backend/src/main/java/com/now/naaga/place/application/PlaceStatisticsService.java index 23fbb80bb..e49fff6f4 100644 --- a/backend/src/main/java/com/now/naaga/placestatistics/application/PlaceStatisticsService.java +++ b/backend/src/main/java/com/now/naaga/place/application/PlaceStatisticsService.java @@ -1,16 +1,15 @@ -package com.now.naaga.placestatistics.application; +package com.now.naaga.place.application; -import static com.now.naaga.placestatistics.domain.PlaceStatistics.LIKE_COUNT_DEFAULT_VALUE; +import static com.now.naaga.place.domain.PlaceStatistics.LIKE_COUNT_DEFAULT_VALUE; -import com.now.naaga.place.application.PlaceService; +import com.now.naaga.place.application.dto.CreatePlaceStatisticsCommand; import com.now.naaga.place.application.dto.FindPlaceByIdCommand; +import com.now.naaga.place.application.dto.SubtractLikeCommand; import com.now.naaga.place.domain.Place; -import com.now.naaga.placestatistics.application.dto.CreatePlaceStatisticsCommand; -import com.now.naaga.placestatistics.application.dto.SubtractLikeCommand; -import com.now.naaga.placestatistics.domain.PlaceStatistics; -import com.now.naaga.placestatistics.exception.PlaceStatisticsException; -import com.now.naaga.placestatistics.exception.PlaceStatisticsExceptionType; -import com.now.naaga.placestatistics.repository.PlaceStatisticsRepository; +import com.now.naaga.place.domain.PlaceStatistics; +import com.now.naaga.place.exception.PlaceStatisticsException; +import com.now.naaga.place.exception.PlaceStatisticsExceptionType; +import com.now.naaga.place.repository.PlaceStatisticsRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/backend/src/main/java/com/now/naaga/placestatistics/application/dto/CreatePlaceStatisticsCommand.java b/backend/src/main/java/com/now/naaga/place/application/dto/CreatePlaceStatisticsCommand.java similarity index 52% rename from backend/src/main/java/com/now/naaga/placestatistics/application/dto/CreatePlaceStatisticsCommand.java rename to backend/src/main/java/com/now/naaga/place/application/dto/CreatePlaceStatisticsCommand.java index 3f441531c..5366c66e5 100644 --- a/backend/src/main/java/com/now/naaga/placestatistics/application/dto/CreatePlaceStatisticsCommand.java +++ b/backend/src/main/java/com/now/naaga/place/application/dto/CreatePlaceStatisticsCommand.java @@ -1,4 +1,4 @@ -package com.now.naaga.placestatistics.application.dto; +package com.now.naaga.place.application.dto; public record CreatePlaceStatisticsCommand(Long placeId) { } diff --git a/backend/src/main/java/com/now/naaga/place/application/dto/SubtractLikeCommand.java b/backend/src/main/java/com/now/naaga/place/application/dto/SubtractLikeCommand.java new file mode 100644 index 000000000..149043c94 --- /dev/null +++ b/backend/src/main/java/com/now/naaga/place/application/dto/SubtractLikeCommand.java @@ -0,0 +1,4 @@ +package com.now.naaga.place.application.dto; + +public record SubtractLikeCommand(Long placeId) { +} diff --git a/backend/src/main/java/com/now/naaga/place/domain/Place.java b/backend/src/main/java/com/now/naaga/place/domain/Place.java index 6b2682faa..2d8b9882c 100644 --- a/backend/src/main/java/com/now/naaga/place/domain/Place.java +++ b/backend/src/main/java/com/now/naaga/place/domain/Place.java @@ -6,8 +6,14 @@ import com.now.naaga.place.exception.PlaceException; import com.now.naaga.place.exception.PlaceExceptionType; import com.now.naaga.player.domain.Player; -import jakarta.persistence.*; - +import jakarta.persistence.Embedded; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; import java.util.Objects; @Entity diff --git a/backend/src/main/java/com/now/naaga/place/domain/PlaceCheckService.java b/backend/src/main/java/com/now/naaga/place/domain/PlaceCheckService.java index b44b9ac6e..a42c0053d 100644 --- a/backend/src/main/java/com/now/naaga/place/domain/PlaceCheckService.java +++ b/backend/src/main/java/com/now/naaga/place/domain/PlaceCheckService.java @@ -2,12 +2,11 @@ import com.now.naaga.place.exception.PlaceException; import com.now.naaga.place.exception.PlaceExceptionType; -import com.now.naaga.place.persistence.repository.PlaceRepository; +import com.now.naaga.place.repository.PlaceRepository; +import java.util.List; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.List; - @Transactional @Service public class PlaceCheckService { diff --git a/backend/src/main/java/com/now/naaga/place/domain/PlaceRecommendService.java b/backend/src/main/java/com/now/naaga/place/domain/PlaceRecommendService.java index 93060f064..63adfa6a8 100644 --- a/backend/src/main/java/com/now/naaga/place/domain/PlaceRecommendService.java +++ b/backend/src/main/java/com/now/naaga/place/domain/PlaceRecommendService.java @@ -1,14 +1,12 @@ package com.now.naaga.place.domain; -import com.now.naaga.place.exception.PlaceException; -import com.now.naaga.place.persistence.repository.PlaceRepository; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; +import static com.now.naaga.place.exception.PlaceExceptionType.NO_EXIST; +import com.now.naaga.place.exception.PlaceException; +import com.now.naaga.place.repository.PlaceRepository; import java.util.List; import java.util.Random; - -import static com.now.naaga.place.exception.PlaceExceptionType.NO_EXIST; +import org.springframework.stereotype.Service; @Service public class PlaceRecommendService { diff --git a/backend/src/main/java/com/now/naaga/placestatistics/domain/PlaceStatistics.java b/backend/src/main/java/com/now/naaga/place/domain/PlaceStatistics.java similarity index 86% rename from backend/src/main/java/com/now/naaga/placestatistics/domain/PlaceStatistics.java rename to backend/src/main/java/com/now/naaga/place/domain/PlaceStatistics.java index a230a0360..56e92bb99 100644 --- a/backend/src/main/java/com/now/naaga/placestatistics/domain/PlaceStatistics.java +++ b/backend/src/main/java/com/now/naaga/place/domain/PlaceStatistics.java @@ -1,10 +1,13 @@ -package com.now.naaga.placestatistics.domain; +package com.now.naaga.place.domain; import com.now.naaga.common.domain.BaseEntity; -import com.now.naaga.place.domain.Place; -import jakarta.persistence.*; -import org.hibernate.annotations.DialectOverride; - +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.OneToOne; import java.util.Objects; @Entity diff --git a/backend/src/main/java/com/now/naaga/placestatistics/exception/PlaceStatisticsException.java b/backend/src/main/java/com/now/naaga/place/exception/PlaceStatisticsException.java similarity index 91% rename from backend/src/main/java/com/now/naaga/placestatistics/exception/PlaceStatisticsException.java rename to backend/src/main/java/com/now/naaga/place/exception/PlaceStatisticsException.java index 42c1b185e..11991da1a 100644 --- a/backend/src/main/java/com/now/naaga/placestatistics/exception/PlaceStatisticsException.java +++ b/backend/src/main/java/com/now/naaga/place/exception/PlaceStatisticsException.java @@ -1,4 +1,4 @@ -package com.now.naaga.placestatistics.exception; +package com.now.naaga.place.exception; import com.now.naaga.common.exception.BaseException; import com.now.naaga.common.exception.BaseExceptionType; diff --git a/backend/src/main/java/com/now/naaga/placestatistics/exception/PlaceStatisticsExceptionType.java b/backend/src/main/java/com/now/naaga/place/exception/PlaceStatisticsExceptionType.java similarity index 95% rename from backend/src/main/java/com/now/naaga/placestatistics/exception/PlaceStatisticsExceptionType.java rename to backend/src/main/java/com/now/naaga/place/exception/PlaceStatisticsExceptionType.java index 57a009d9b..421f03a32 100644 --- a/backend/src/main/java/com/now/naaga/placestatistics/exception/PlaceStatisticsExceptionType.java +++ b/backend/src/main/java/com/now/naaga/place/exception/PlaceStatisticsExceptionType.java @@ -1,4 +1,4 @@ -package com.now.naaga.placestatistics.exception; +package com.now.naaga.place.exception; import com.now.naaga.common.exception.BaseExceptionType; import org.springframework.http.HttpStatus; diff --git a/backend/src/main/java/com/now/naaga/place/persistence/repository/PlaceRepository.java b/backend/src/main/java/com/now/naaga/place/repository/PlaceRepository.java similarity index 95% rename from backend/src/main/java/com/now/naaga/place/persistence/repository/PlaceRepository.java rename to backend/src/main/java/com/now/naaga/place/repository/PlaceRepository.java index 60198adf9..acc420dcd 100644 --- a/backend/src/main/java/com/now/naaga/place/persistence/repository/PlaceRepository.java +++ b/backend/src/main/java/com/now/naaga/place/repository/PlaceRepository.java @@ -1,4 +1,4 @@ -package com.now.naaga.place.persistence.repository; +package com.now.naaga.place.repository; import com.now.naaga.place.domain.Place; import com.now.naaga.place.domain.Position; diff --git a/backend/src/main/java/com/now/naaga/placestatistics/repository/PlaceStatisticsRepository.java b/backend/src/main/java/com/now/naaga/place/repository/PlaceStatisticsRepository.java similarity index 68% rename from backend/src/main/java/com/now/naaga/placestatistics/repository/PlaceStatisticsRepository.java rename to backend/src/main/java/com/now/naaga/place/repository/PlaceStatisticsRepository.java index 20df04940..01c07d853 100644 --- a/backend/src/main/java/com/now/naaga/placestatistics/repository/PlaceStatisticsRepository.java +++ b/backend/src/main/java/com/now/naaga/place/repository/PlaceStatisticsRepository.java @@ -1,9 +1,8 @@ -package com.now.naaga.placestatistics.repository; - -import com.now.naaga.placestatistics.domain.PlaceStatistics; -import org.springframework.data.jpa.repository.JpaRepository; +package com.now.naaga.place.repository; +import com.now.naaga.place.domain.PlaceStatistics; import java.util.Optional; +import org.springframework.data.jpa.repository.JpaRepository; public interface PlaceStatisticsRepository extends JpaRepository { diff --git a/backend/src/main/java/com/now/naaga/placestatistics/application/dto/SubtractLikeCommand.java b/backend/src/main/java/com/now/naaga/placestatistics/application/dto/SubtractLikeCommand.java deleted file mode 100644 index f20511111..000000000 --- a/backend/src/main/java/com/now/naaga/placestatistics/application/dto/SubtractLikeCommand.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.now.naaga.placestatistics.application.dto; - -public record SubtractLikeCommand(Long placeId) { -} diff --git a/backend/src/test/java/com/now/naaga/common/builder/PlaceBuilder.java b/backend/src/test/java/com/now/naaga/common/builder/PlaceBuilder.java index bfca3974d..d716e2b98 100644 --- a/backend/src/test/java/com/now/naaga/common/builder/PlaceBuilder.java +++ b/backend/src/test/java/com/now/naaga/common/builder/PlaceBuilder.java @@ -7,7 +7,7 @@ import com.now.naaga.place.domain.Place; import com.now.naaga.place.domain.Position; -import com.now.naaga.place.persistence.repository.PlaceRepository; +import com.now.naaga.place.repository.PlaceRepository; import com.now.naaga.player.domain.Player; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; diff --git a/backend/src/test/java/com/now/naaga/common/builder/PlaceStatisticsBuilder.java b/backend/src/test/java/com/now/naaga/common/builder/PlaceStatisticsBuilder.java index 6ca0293f8..e0211024b 100644 --- a/backend/src/test/java/com/now/naaga/common/builder/PlaceStatisticsBuilder.java +++ b/backend/src/test/java/com/now/naaga/common/builder/PlaceStatisticsBuilder.java @@ -1,8 +1,8 @@ package com.now.naaga.common.builder; import com.now.naaga.place.domain.Place; -import com.now.naaga.placestatistics.domain.PlaceStatistics; -import com.now.naaga.placestatistics.repository.PlaceStatisticsRepository; +import com.now.naaga.place.domain.PlaceStatistics; +import com.now.naaga.place.repository.PlaceStatisticsRepository; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/backend/src/test/java/com/now/naaga/common/fixture/PlaceStatisticsFixture.java b/backend/src/test/java/com/now/naaga/common/fixture/PlaceStatisticsFixture.java index 996de531b..0f35c6bd2 100644 --- a/backend/src/test/java/com/now/naaga/common/fixture/PlaceStatisticsFixture.java +++ b/backend/src/test/java/com/now/naaga/common/fixture/PlaceStatisticsFixture.java @@ -1,6 +1,6 @@ package com.now.naaga.common.fixture; -import com.now.naaga.placestatistics.domain.PlaceStatistics; +import com.now.naaga.place.domain.PlaceStatistics; public class PlaceStatisticsFixture { diff --git a/backend/src/test/java/com/now/naaga/like/application/PlaceLikeServiceTest.java b/backend/src/test/java/com/now/naaga/like/application/PlaceLikeServiceTest.java index a379df90a..7eb8bc7b7 100644 --- a/backend/src/test/java/com/now/naaga/like/application/PlaceLikeServiceTest.java +++ b/backend/src/test/java/com/now/naaga/like/application/PlaceLikeServiceTest.java @@ -4,16 +4,13 @@ import com.now.naaga.common.builder.PlaceLikeBuilder; import com.now.naaga.common.builder.PlaceStatisticsBuilder; import com.now.naaga.common.builder.PlayerBuilder; -import com.now.naaga.common.exception.BaseExceptionType; import com.now.naaga.like.application.dto.CancelLikeCommand; import com.now.naaga.like.domain.PlaceLike; -import com.now.naaga.like.exception.PlaceLikeException; import com.now.naaga.like.repository.PlaceLikeRepository; import com.now.naaga.place.domain.Place; -import com.now.naaga.placestatistics.domain.PlaceStatistics; -import com.now.naaga.placestatistics.repository.PlaceStatisticsRepository; +import com.now.naaga.place.domain.PlaceStatistics; +import com.now.naaga.place.repository.PlaceStatisticsRepository; import com.now.naaga.player.domain.Player; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; import org.junit.jupiter.api.Test; @@ -24,7 +21,6 @@ import java.util.Optional; -import static com.now.naaga.like.exception.PlaceLikeExceptionType.NOT_EXIST; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.SoftAssertions.assertSoftly; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; diff --git a/backend/src/test/java/com/now/naaga/like/presentation/PlaceLikeControllerTest.java b/backend/src/test/java/com/now/naaga/like/presentation/PlaceLikeControllerTest.java index c0261d2ed..609b7b220 100644 --- a/backend/src/test/java/com/now/naaga/like/presentation/PlaceLikeControllerTest.java +++ b/backend/src/test/java/com/now/naaga/like/presentation/PlaceLikeControllerTest.java @@ -8,25 +8,19 @@ import com.now.naaga.common.builder.PlaceLikeBuilder; import com.now.naaga.common.builder.PlaceStatisticsBuilder; import com.now.naaga.common.builder.PlayerBuilder; -import com.now.naaga.common.exception.ExceptionResponse; import com.now.naaga.like.domain.PlaceLike; import com.now.naaga.member.domain.Member; import com.now.naaga.place.domain.Place; -import com.now.naaga.placestatistics.domain.PlaceStatistics; -import com.now.naaga.player.domain.Player; import io.restassured.RestAssured; import io.restassured.http.ContentType; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; -import org.assertj.core.api.SoftAssertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import static com.now.naaga.like.exception.PlaceLikeExceptionType.NOT_EXIST; import static org.assertj.core.api.Assertions.assertThat; import static org.springframework.http.HttpStatus.NO_CONTENT; diff --git a/backend/src/test/java/com/now/naaga/place/application/PlaceServiceTest.java b/backend/src/test/java/com/now/naaga/place/application/PlaceServiceTest.java index de4023bea..95dc0a129 100644 --- a/backend/src/test/java/com/now/naaga/place/application/PlaceServiceTest.java +++ b/backend/src/test/java/com/now/naaga/place/application/PlaceServiceTest.java @@ -10,11 +10,11 @@ import com.now.naaga.common.exception.BaseExceptionType; import com.now.naaga.place.application.dto.CreatePlaceCommand; import com.now.naaga.place.domain.Place; +import com.now.naaga.place.domain.PlaceStatistics; import com.now.naaga.place.domain.Position; import com.now.naaga.place.exception.PlaceException; import com.now.naaga.place.exception.PlaceExceptionType; -import com.now.naaga.placestatistics.domain.PlaceStatistics; -import com.now.naaga.placestatistics.repository.PlaceStatisticsRepository; +import com.now.naaga.place.repository.PlaceStatisticsRepository; import com.now.naaga.player.domain.Player; import com.now.naaga.temporaryplace.domain.TemporaryPlace; import com.now.naaga.temporaryplace.repository.TemporaryPlaceRepository; diff --git a/backend/src/test/java/com/now/naaga/placestatistics/application/PlaceStatisticsServiceTest.java b/backend/src/test/java/com/now/naaga/place/application/PlaceStatisticsServiceTest.java similarity index 88% rename from backend/src/test/java/com/now/naaga/placestatistics/application/PlaceStatisticsServiceTest.java rename to backend/src/test/java/com/now/naaga/place/application/PlaceStatisticsServiceTest.java index 45dc29af7..3647fe672 100644 --- a/backend/src/test/java/com/now/naaga/placestatistics/application/PlaceStatisticsServiceTest.java +++ b/backend/src/test/java/com/now/naaga/place/application/PlaceStatisticsServiceTest.java @@ -1,14 +1,14 @@ -package com.now.naaga.placestatistics.application; +package com.now.naaga.place.application; import static org.assertj.core.api.Assertions.assertThat; import com.now.naaga.common.builder.PlaceBuilder; import com.now.naaga.common.builder.PlaceStatisticsBuilder; +import com.now.naaga.place.application.dto.CreatePlaceStatisticsCommand; +import com.now.naaga.place.application.dto.SubtractLikeCommand; import com.now.naaga.place.domain.Place; -import com.now.naaga.placestatistics.application.dto.CreatePlaceStatisticsCommand; -import com.now.naaga.placestatistics.application.dto.SubtractLikeCommand; -import com.now.naaga.placestatistics.domain.PlaceStatistics; -import com.now.naaga.placestatistics.repository.PlaceStatisticsRepository; +import com.now.naaga.place.domain.PlaceStatistics; +import com.now.naaga.place.repository.PlaceStatisticsRepository; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores; import org.junit.jupiter.api.Test; diff --git a/backend/src/test/java/com/now/naaga/placestatistics/domain/PlaceStatisticsTest.java b/backend/src/test/java/com/now/naaga/place/domain/PlaceStatisticsTest.java similarity index 93% rename from backend/src/test/java/com/now/naaga/placestatistics/domain/PlaceStatisticsTest.java rename to backend/src/test/java/com/now/naaga/place/domain/PlaceStatisticsTest.java index 80be10257..59dd74f95 100644 --- a/backend/src/test/java/com/now/naaga/placestatistics/domain/PlaceStatisticsTest.java +++ b/backend/src/test/java/com/now/naaga/place/domain/PlaceStatisticsTest.java @@ -1,14 +1,13 @@ -package com.now.naaga.placestatistics.domain; +package com.now.naaga.place.domain; + +import static org.assertj.core.api.Assertions.assertThat; import com.now.naaga.common.fixture.PlaceFixture; -import com.now.naaga.place.domain.Place; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; import org.junit.jupiter.api.Test; import org.springframework.test.context.ActiveProfiles; -import static org.assertj.core.api.Assertions.assertThat; - @SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) @ActiveProfiles("test") diff --git a/backend/src/test/java/com/now/naaga/place/service/PlaceServiceTest.java b/backend/src/test/java/com/now/naaga/place/service/PlaceServiceTest.java index 75fa82586..c2e3f225d 100644 --- a/backend/src/test/java/com/now/naaga/place/service/PlaceServiceTest.java +++ b/backend/src/test/java/com/now/naaga/place/service/PlaceServiceTest.java @@ -1,5 +1,9 @@ package com.now.naaga.place.service; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.SoftAssertions.assertSoftly; +import static org.junit.jupiter.api.Assertions.assertThrows; + import com.now.naaga.common.builder.PlaceBuilder; import com.now.naaga.common.exception.BaseExceptionType; import com.now.naaga.common.fixture.PositionFixture; @@ -9,8 +13,6 @@ import com.now.naaga.place.domain.Position; import com.now.naaga.place.exception.PlaceException; import com.now.naaga.place.exception.PlaceExceptionType; -import io.restassured.internal.common.assertion.Assertion; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.RepeatedTest; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -19,11 +21,6 @@ import org.springframework.test.context.jdbc.Sql; import org.springframework.transaction.annotation.Transactional; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.assertj.core.api.SoftAssertions.assertSoftly; -import static org.junit.jupiter.api.Assertions.assertThrows; - @ActiveProfiles("test") @Sql("/truncate.sql") @SpringBootTest From 472aec6cd6a2085bb4c233f5249abad4e9c3cda7 Mon Sep 17 00:00:00 2001 From: kokodak Date: Sun, 15 Oct 2023 23:17:35 +0900 Subject: [PATCH 8/9] =?UTF-8?q?feat:=20Transactional=20=EC=96=B4=EB=85=B8?= =?UTF-8?q?=ED=85=8C=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreatePlaceStatisticsWithPlaceCreateEventHandler.java | 2 ++ .../DeleteTemporaryPlaceWithPlaceCreateEventHandler.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/backend/src/main/java/com/now/naaga/place/application/CreatePlaceStatisticsWithPlaceCreateEventHandler.java b/backend/src/main/java/com/now/naaga/place/application/CreatePlaceStatisticsWithPlaceCreateEventHandler.java index 5ce1db3e3..6726da7b9 100644 --- a/backend/src/main/java/com/now/naaga/place/application/CreatePlaceStatisticsWithPlaceCreateEventHandler.java +++ b/backend/src/main/java/com/now/naaga/place/application/CreatePlaceStatisticsWithPlaceCreateEventHandler.java @@ -4,6 +4,7 @@ import com.now.naaga.place.domain.PlaceCreateEvent; import org.springframework.context.event.EventListener; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; @Component public class CreatePlaceStatisticsWithPlaceCreateEventHandler { @@ -14,6 +15,7 @@ public CreatePlaceStatisticsWithPlaceCreateEventHandler(final PlaceStatisticsSer this.placeStatisticsService = placeStatisticsService; } + @Transactional @EventListener public void handle(final PlaceCreateEvent placeCreateEvent) { final Long placeId = placeCreateEvent.placeId(); diff --git a/backend/src/main/java/com/now/naaga/temporaryplace/application/DeleteTemporaryPlaceWithPlaceCreateEventHandler.java b/backend/src/main/java/com/now/naaga/temporaryplace/application/DeleteTemporaryPlaceWithPlaceCreateEventHandler.java index 9bc160130..f27828ea3 100644 --- a/backend/src/main/java/com/now/naaga/temporaryplace/application/DeleteTemporaryPlaceWithPlaceCreateEventHandler.java +++ b/backend/src/main/java/com/now/naaga/temporaryplace/application/DeleteTemporaryPlaceWithPlaceCreateEventHandler.java @@ -3,6 +3,7 @@ import com.now.naaga.place.domain.PlaceCreateEvent; import org.springframework.context.event.EventListener; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; @Component public class DeleteTemporaryPlaceWithPlaceCreateEventHandler { @@ -13,6 +14,7 @@ public DeleteTemporaryPlaceWithPlaceCreateEventHandler(final TemporaryPlaceServi this.temporaryPlaceService = temporaryPlaceService; } + @Transactional @EventListener public void handle(final PlaceCreateEvent placeCreateEvent) { final Long temporaryPlaceId = placeCreateEvent.temporaryPlaceId(); From bbc44e20403087deb7646edbc6c3b6e84749c927 Mon Sep 17 00:00:00 2001 From: kokodak Date: Wed, 18 Oct 2023 14:15:03 +0900 Subject: [PATCH 9/9] =?UTF-8?q?chore:=20=ED=8C=A8=ED=82=A4=EC=A7=80=20impo?= =?UTF-8?q?rt=20=EC=B5=9C=EC=A0=81=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../naaga/auth/application/AuthService.java | 8 +-- .../com/now/naaga/auth/domain/AuthToken.java | 8 ++- .../naaga/auth/infrastructure/AuthClient.java | 2 +- .../infrastructure/BearerAuthExtractor.java | 8 ++- .../auth/infrastructure/MemberAuthMapper.java | 6 +- .../auth/infrastructure/dto/AuthInfo.java | 1 - .../auth/infrastructure/dto/MemberAuth.java | 1 - .../jwt/AuthTokenGenerator.java | 12 +--- .../auth/infrastructure/jwt/JwtProvider.java | 10 ++-- .../auth/persistence/AuthRepository.java | 4 +- .../auth/presentation/AuthController.java | 8 ++- .../MemberAuthArgumentResolver.java | 3 +- .../PlayerArgumentResolver.java | 2 +- .../interceptor/AuthInterceptor.java | 1 - .../interceptor/ManagerAuthInterceptor.java | 15 ++--- .../now/naaga/common/config/BeanConfig.java | 3 +- .../naaga/common/config/HibernateConfig.java | 4 +- .../infrastructure/MultipartFileManager.java | 10 ++-- .../naaga/common/presentation/LogFilter.java | 15 +++-- .../common/presentation/QueryInspector.java | 5 +- .../RequestMatcherInterceptor.java | 5 +- .../naaga/game/application/GameService.java | 22 +++++--- .../naaga/game/application/HintService.java | 6 +- .../java/com/now/naaga/game/domain/Game.java | 30 +++++++--- .../com/now/naaga/game/domain/Statistic.java | 6 +- .../game/presentation/GameController.java | 33 ++++++++--- .../naaga/game/repository/GameRepository.java | 3 +- .../application/GameResultService.java | 2 +- .../naaga/gameresult/domain/GameResult.java | 12 +++- .../gamescore/FailResultScorePolicy.java | 4 +- .../gamescore/ResultScoreCalculator.java | 5 +- .../gamescore/SuccessResultScorePolicy.java | 9 ++- .../letter/application/LetterService.java | 13 ++--- .../letterlog/ReadLetterLogService.java | 11 ++-- .../letterlog/WriteLetterLogService.java | 3 +- .../com/now/naaga/letter/domain/Letter.java | 10 +++- .../domain/letterlog/ReadLetterLog.java | 9 ++- .../domain/letterlog/WriteLetterLog.java | 12 ++-- .../letter/presentation/LetterController.java | 19 +++++-- .../presentation/LetterLogController.java | 11 ++-- .../dto/FindNearByLetterCommand.java | 1 - .../dto/NearByLetterResponse.java | 1 - .../letter/repository/LetterRepository.java | 3 +- .../letterlog/ReadLetterLogRepository.java | 3 +- .../letterlog/WriteLetterLogRepository.java | 3 +- .../like/application/PlaceLikeService.java | 4 +- .../exception/PlaceLikeExceptionType.java | 2 - .../dto/CheckMyPlaceLikeResponse.java | 1 - .../like/repository/PlaceLikeRepository.java | 3 +- .../com/now/naaga/member/domain/Member.java | 8 ++- .../player/application/PlayerService.java | 9 ++- .../com/now/naaga/player/domain/Player.java | 18 ++++-- .../player/presentation/PlayerController.java | 9 ++- .../application/TemporaryPlaceService.java | 7 +-- .../TemporaryPlaceController.java | 13 +++-- .../dto/TemporaryPlaceResponse.java | 1 - .../repository/TemporaryPlaceRepository.java | 3 +- .../auth/application/AuthServiceTest.java | 21 +++---- .../auth/presentation/AuthControllerTest.java | 21 ++++--- .../presentation/AuthInterceptorTest.java | 10 ++-- .../PlayerArgumentResolverTest.java | 8 +-- .../ManagerAuthInterceptorTest.java | 9 ++- .../naaga/common/builder/LetterBuilder.java | 9 ++- .../common/builder/ReadLetterLogBuilder.java | 3 +- .../common/builder/WriteLetterLogBuilder.java | 3 +- .../now/naaga/common/fixture/GameFixture.java | 4 +- .../naaga/common/fixture/LetterFixture.java | 4 +- .../naaga/common/fixture/PlaceFixture.java | 3 +- .../naaga/common/fixture/PlayerFixture.java | 2 +- .../naaga/common/fixture/PositionFixture.java | 1 - .../common/fixture/ReadLetterLogFixture.java | 4 +- .../common/fixture/TemporaryPlaceFixture.java | 4 +- .../common/fixture/WriteLetterLogFixture.java | 4 +- .../RequestMatcherInterceptorTest.java | 15 ++--- .../interceptor/RequestPatternTest.java | 14 ++--- .../game/application/GameServiceTest.java | 42 +++++++------- .../game/application/HintServiceTest.java | 1 - .../com/now/naaga/game/domain/GameTest.java | 29 +++++----- .../game/domain/ResultScorePolicyTest.java | 19 ++++--- .../now/naaga/game/domain/StatisticTest.java | 25 ++++----- .../game/presentation/GameControllerTest.java | 56 +++++++++++++------ .../presentation/StatisticControllerTest.java | 8 +-- .../application/GameResultServiceTest.java | 16 +++--- .../repository/GameResultRepositoryTest.java | 15 +++-- .../letter/application/LetterServiceTest.java | 19 ++++--- .../letterlog/ReadLetterLogServiceTest.java | 17 +++--- .../presentation/LetterControllerTest.java | 20 +++---- .../presentation/LetterLogControllerTest.java | 22 +++++--- .../application/PlaceLikeServiceTest.java | 5 -- .../now/naaga/like/domain/PlaceLikeTest.java | 8 +-- .../player/application/PlayerServiceTest.java | 2 - .../repository/PlayerRepositoryTest.java | 2 - .../presentation/PlayerControllerTest.java | 13 ++--- .../TemporaryPlaceControllerTest.java | 27 +++++---- 94 files changed, 494 insertions(+), 431 deletions(-) diff --git a/backend/src/main/java/com/now/naaga/auth/application/AuthService.java b/backend/src/main/java/com/now/naaga/auth/application/AuthService.java index 4fd9c15f7..e32c7ccab 100644 --- a/backend/src/main/java/com/now/naaga/auth/application/AuthService.java +++ b/backend/src/main/java/com/now/naaga/auth/application/AuthService.java @@ -1,17 +1,19 @@ package com.now.naaga.auth.application; +import static com.now.naaga.auth.exception.AuthExceptionType.INVALID_TOKEN; + import com.now.naaga.auth.application.dto.AuthCommand; -import com.now.naaga.auth.infrastructure.dto.AuthInfo; import com.now.naaga.auth.application.dto.RefreshTokenCommand; import com.now.naaga.auth.domain.AuthToken; import com.now.naaga.auth.exception.AuthException; import com.now.naaga.auth.infrastructure.AuthClient; +import com.now.naaga.auth.infrastructure.dto.AuthInfo; import com.now.naaga.auth.infrastructure.dto.MemberAuth; import com.now.naaga.auth.infrastructure.jwt.AuthTokenGenerator; import com.now.naaga.auth.persistence.AuthRepository; +import com.now.naaga.member.application.MemberService; import com.now.naaga.member.application.dto.CreateMemberCommand; import com.now.naaga.member.application.dto.DeleteMemberCommand; -import com.now.naaga.member.application.MemberService; import com.now.naaga.member.domain.Member; import com.now.naaga.player.application.PlayerService; import com.now.naaga.player.application.dto.CreatePlayerCommand; @@ -19,8 +21,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import static com.now.naaga.auth.exception.AuthExceptionType.INVALID_TOKEN; - @Transactional @Service public class AuthService { diff --git a/backend/src/main/java/com/now/naaga/auth/domain/AuthToken.java b/backend/src/main/java/com/now/naaga/auth/domain/AuthToken.java index 90b4bf306..58d9c0cca 100644 --- a/backend/src/main/java/com/now/naaga/auth/domain/AuthToken.java +++ b/backend/src/main/java/com/now/naaga/auth/domain/AuthToken.java @@ -1,8 +1,12 @@ package com.now.naaga.auth.domain; import com.now.naaga.member.domain.Member; -import jakarta.persistence.*; - +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; import java.util.Objects; @Entity diff --git a/backend/src/main/java/com/now/naaga/auth/infrastructure/AuthClient.java b/backend/src/main/java/com/now/naaga/auth/infrastructure/AuthClient.java index 593b2ecde..1395b99cd 100644 --- a/backend/src/main/java/com/now/naaga/auth/infrastructure/AuthClient.java +++ b/backend/src/main/java/com/now/naaga/auth/infrastructure/AuthClient.java @@ -1,8 +1,8 @@ package com.now.naaga.auth.infrastructure; -import com.now.naaga.auth.infrastructure.dto.AuthInfo; import com.now.naaga.auth.exception.AuthException; import com.now.naaga.auth.exception.AuthExceptionType; +import com.now.naaga.auth.infrastructure.dto.AuthInfo; import com.now.naaga.auth.infrastructure.dto.LogoutInfo; import com.now.naaga.auth.infrastructure.dto.UnlinkInfo; import org.springframework.beans.factory.annotation.Value; diff --git a/backend/src/main/java/com/now/naaga/auth/infrastructure/BearerAuthExtractor.java b/backend/src/main/java/com/now/naaga/auth/infrastructure/BearerAuthExtractor.java index 84cee103f..4f067c548 100644 --- a/backend/src/main/java/com/now/naaga/auth/infrastructure/BearerAuthExtractor.java +++ b/backend/src/main/java/com/now/naaga/auth/infrastructure/BearerAuthExtractor.java @@ -1,13 +1,15 @@ package com.now.naaga.auth.infrastructure; +import static com.now.naaga.auth.exception.AuthExceptionType.INVALID_HEADER; +import static com.now.naaga.auth.exception.AuthExceptionType.INVALID_TOKEN; +import static com.now.naaga.auth.exception.AuthExceptionType.NOT_EXIST_HEADER; + +import com.now.naaga.auth.exception.AuthException; import com.now.naaga.auth.infrastructure.dto.MemberAuth; import com.now.naaga.auth.infrastructure.jwt.JwtProvider; -import com.now.naaga.auth.exception.AuthException; import com.now.naaga.common.exception.InternalException; import org.springframework.stereotype.Component; -import static com.now.naaga.auth.exception.AuthExceptionType.*; - @Component public class BearerAuthExtractor implements AuthenticationExtractor { diff --git a/backend/src/main/java/com/now/naaga/auth/infrastructure/MemberAuthMapper.java b/backend/src/main/java/com/now/naaga/auth/infrastructure/MemberAuthMapper.java index 20765365d..7430af987 100644 --- a/backend/src/main/java/com/now/naaga/auth/infrastructure/MemberAuthMapper.java +++ b/backend/src/main/java/com/now/naaga/auth/infrastructure/MemberAuthMapper.java @@ -1,13 +1,13 @@ package com.now.naaga.auth.infrastructure; +import static com.now.naaga.common.exception.InternalExceptionType.FAIL_JSON_TO_OBJECT; +import static com.now.naaga.common.exception.InternalExceptionType.FAIL_OBJECT_TO_JSON; + import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.now.naaga.auth.infrastructure.dto.MemberAuth; import com.now.naaga.common.exception.InternalException; -import static com.now.naaga.common.exception.InternalExceptionType.FAIL_JSON_TO_OBJECT; -import static com.now.naaga.common.exception.InternalExceptionType.FAIL_OBJECT_TO_JSON; - public class MemberAuthMapper { private static final ObjectMapper objectMapper = new ObjectMapper(); diff --git a/backend/src/main/java/com/now/naaga/auth/infrastructure/dto/AuthInfo.java b/backend/src/main/java/com/now/naaga/auth/infrastructure/dto/AuthInfo.java index 0e4d2bd1d..ecf815eb1 100644 --- a/backend/src/main/java/com/now/naaga/auth/infrastructure/dto/AuthInfo.java +++ b/backend/src/main/java/com/now/naaga/auth/infrastructure/dto/AuthInfo.java @@ -2,7 +2,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; - import java.util.Objects; public class AuthInfo { diff --git a/backend/src/main/java/com/now/naaga/auth/infrastructure/dto/MemberAuth.java b/backend/src/main/java/com/now/naaga/auth/infrastructure/dto/MemberAuth.java index fdb4eb29c..74ccd1bf6 100644 --- a/backend/src/main/java/com/now/naaga/auth/infrastructure/dto/MemberAuth.java +++ b/backend/src/main/java/com/now/naaga/auth/infrastructure/dto/MemberAuth.java @@ -1,7 +1,6 @@ package com.now.naaga.auth.infrastructure.dto; import com.now.naaga.auth.infrastructure.AuthType; - import java.util.Objects; public class MemberAuth { diff --git a/backend/src/main/java/com/now/naaga/auth/infrastructure/jwt/AuthTokenGenerator.java b/backend/src/main/java/com/now/naaga/auth/infrastructure/jwt/AuthTokenGenerator.java index bdd8f1775..acc7c957d 100644 --- a/backend/src/main/java/com/now/naaga/auth/infrastructure/jwt/AuthTokenGenerator.java +++ b/backend/src/main/java/com/now/naaga/auth/infrastructure/jwt/AuthTokenGenerator.java @@ -1,21 +1,15 @@ package com.now.naaga.auth.infrastructure.jwt; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; +import static com.now.naaga.auth.exception.AuthExceptionType.INVALID_TOKEN_ACCESS; + import com.now.naaga.auth.domain.AuthToken; import com.now.naaga.auth.exception.AuthException; import com.now.naaga.auth.infrastructure.AuthType; import com.now.naaga.auth.infrastructure.MemberAuthMapper; import com.now.naaga.auth.infrastructure.dto.MemberAuth; -import com.now.naaga.common.exception.InternalException; -import com.now.naaga.common.exception.InternalExceptionType; import com.now.naaga.member.domain.Member; -import org.springframework.stereotype.Component; -import org.springframework.validation.ObjectError; - import java.util.Date; - -import static com.now.naaga.auth.exception.AuthExceptionType.INVALID_TOKEN_ACCESS; +import org.springframework.stereotype.Component; @Component public class AuthTokenGenerator { diff --git a/backend/src/main/java/com/now/naaga/auth/infrastructure/jwt/JwtProvider.java b/backend/src/main/java/com/now/naaga/auth/infrastructure/jwt/JwtProvider.java index b3d5c6966..175a38125 100644 --- a/backend/src/main/java/com/now/naaga/auth/infrastructure/jwt/JwtProvider.java +++ b/backend/src/main/java/com/now/naaga/auth/infrastructure/jwt/JwtProvider.java @@ -2,14 +2,16 @@ import com.now.naaga.auth.exception.AuthException; import com.now.naaga.auth.exception.AuthExceptionType; -import io.jsonwebtoken.*; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.ExpiredJwtException; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.io.Decoders; import io.jsonwebtoken.security.Keys; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - import java.security.Key; import java.util.Date; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; @Component public class JwtProvider { diff --git a/backend/src/main/java/com/now/naaga/auth/persistence/AuthRepository.java b/backend/src/main/java/com/now/naaga/auth/persistence/AuthRepository.java index f7c5d6c1b..7be0b62f1 100644 --- a/backend/src/main/java/com/now/naaga/auth/persistence/AuthRepository.java +++ b/backend/src/main/java/com/now/naaga/auth/persistence/AuthRepository.java @@ -1,10 +1,8 @@ package com.now.naaga.auth.persistence; import com.now.naaga.auth.domain.AuthToken; -import org.springframework.data.jpa.repository.JpaRepository; - -import java.util.List; import java.util.Optional; +import org.springframework.data.jpa.repository.JpaRepository; public interface AuthRepository extends JpaRepository { diff --git a/backend/src/main/java/com/now/naaga/auth/presentation/AuthController.java b/backend/src/main/java/com/now/naaga/auth/presentation/AuthController.java index 59dca8d07..b13e39511 100644 --- a/backend/src/main/java/com/now/naaga/auth/presentation/AuthController.java +++ b/backend/src/main/java/com/now/naaga/auth/presentation/AuthController.java @@ -1,17 +1,21 @@ package com.now.naaga.auth.presentation; -import com.now.naaga.auth.presentation.annotation.Auth; import com.now.naaga.auth.application.AuthService; import com.now.naaga.auth.application.dto.AuthCommand; import com.now.naaga.auth.application.dto.RefreshTokenCommand; import com.now.naaga.auth.domain.AuthToken; import com.now.naaga.auth.infrastructure.dto.MemberAuth; +import com.now.naaga.auth.presentation.annotation.Auth; import com.now.naaga.auth.presentation.dto.AuthRequest; import com.now.naaga.auth.presentation.dto.AuthResponse; import com.now.naaga.auth.presentation.dto.RefreshTokenRequest; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; @RequestMapping("/auth") @RestController diff --git a/backend/src/main/java/com/now/naaga/auth/presentation/argumentresolver/MemberAuthArgumentResolver.java b/backend/src/main/java/com/now/naaga/auth/presentation/argumentresolver/MemberAuthArgumentResolver.java index f41a9abd1..068a8eca2 100644 --- a/backend/src/main/java/com/now/naaga/auth/presentation/argumentresolver/MemberAuthArgumentResolver.java +++ b/backend/src/main/java/com/now/naaga/auth/presentation/argumentresolver/MemberAuthArgumentResolver.java @@ -1,9 +1,8 @@ package com.now.naaga.auth.presentation.argumentresolver; -import com.now.naaga.auth.presentation.annotation.Auth; import com.now.naaga.auth.infrastructure.AuthenticationExtractor; import com.now.naaga.auth.infrastructure.dto.MemberAuth; -import com.now.naaga.auth.presentation.dto.MemberRequest; +import com.now.naaga.auth.presentation.annotation.Auth; import jakarta.servlet.http.HttpServletRequest; import org.springframework.core.MethodParameter; import org.springframework.http.HttpHeaders; diff --git a/backend/src/main/java/com/now/naaga/auth/presentation/argumentresolver/PlayerArgumentResolver.java b/backend/src/main/java/com/now/naaga/auth/presentation/argumentresolver/PlayerArgumentResolver.java index 110492546..4353aefcf 100644 --- a/backend/src/main/java/com/now/naaga/auth/presentation/argumentresolver/PlayerArgumentResolver.java +++ b/backend/src/main/java/com/now/naaga/auth/presentation/argumentresolver/PlayerArgumentResolver.java @@ -1,8 +1,8 @@ package com.now.naaga.auth.presentation.argumentresolver; -import com.now.naaga.auth.presentation.annotation.Auth; import com.now.naaga.auth.infrastructure.AuthenticationExtractor; import com.now.naaga.auth.infrastructure.dto.MemberAuth; +import com.now.naaga.auth.presentation.annotation.Auth; import com.now.naaga.player.application.PlayerService; import com.now.naaga.player.domain.Player; import com.now.naaga.player.presentation.dto.PlayerRequest; diff --git a/backend/src/main/java/com/now/naaga/auth/presentation/interceptor/AuthInterceptor.java b/backend/src/main/java/com/now/naaga/auth/presentation/interceptor/AuthInterceptor.java index 54cc716dd..6966a5a7c 100644 --- a/backend/src/main/java/com/now/naaga/auth/presentation/interceptor/AuthInterceptor.java +++ b/backend/src/main/java/com/now/naaga/auth/presentation/interceptor/AuthInterceptor.java @@ -2,7 +2,6 @@ import com.now.naaga.auth.infrastructure.AuthenticationExtractor; import com.now.naaga.auth.infrastructure.dto.MemberAuth; -import com.now.naaga.member.domain.Member; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.springframework.http.HttpHeaders; diff --git a/backend/src/main/java/com/now/naaga/auth/presentation/interceptor/ManagerAuthInterceptor.java b/backend/src/main/java/com/now/naaga/auth/presentation/interceptor/ManagerAuthInterceptor.java index 62ffb63c4..85e20f591 100644 --- a/backend/src/main/java/com/now/naaga/auth/presentation/interceptor/ManagerAuthInterceptor.java +++ b/backend/src/main/java/com/now/naaga/auth/presentation/interceptor/ManagerAuthInterceptor.java @@ -1,19 +1,20 @@ package com.now.naaga.auth.presentation.interceptor; +import static com.now.naaga.auth.exception.AuthExceptionType.INVALID_HEADER; +import static com.now.naaga.auth.exception.AuthExceptionType.INVALID_MANAGER; +import static com.now.naaga.auth.exception.AuthExceptionType.NOT_EXIST_HEADER; + import com.now.naaga.auth.exception.AuthException; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpHeaders; -import org.springframework.stereotype.Component; -import org.springframework.web.servlet.HandlerInterceptor; - import java.util.Arrays; import java.util.Base64; import java.util.List; import java.util.Objects; - -import static com.now.naaga.auth.exception.AuthExceptionType.*; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpHeaders; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.HandlerInterceptor; @Component public class ManagerAuthInterceptor implements HandlerInterceptor { diff --git a/backend/src/main/java/com/now/naaga/common/config/BeanConfig.java b/backend/src/main/java/com/now/naaga/common/config/BeanConfig.java index d6ad7c4a4..93d23ad3f 100644 --- a/backend/src/main/java/com/now/naaga/common/config/BeanConfig.java +++ b/backend/src/main/java/com/now/naaga/common/config/BeanConfig.java @@ -5,12 +5,11 @@ import com.now.naaga.gameresult.domain.gamescore.ResultScoreCalculator; import com.now.naaga.gameresult.domain.gamescore.ResultScorePolicy; import com.now.naaga.gameresult.domain.gamescore.SuccessResultScorePolicy; +import java.util.List; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.client.RestTemplate; -import java.util.List; - @Configuration public class BeanConfig { diff --git a/backend/src/main/java/com/now/naaga/common/config/HibernateConfig.java b/backend/src/main/java/com/now/naaga/common/config/HibernateConfig.java index f84ef50e0..26af49c82 100644 --- a/backend/src/main/java/com/now/naaga/common/config/HibernateConfig.java +++ b/backend/src/main/java/com/now/naaga/common/config/HibernateConfig.java @@ -1,12 +1,12 @@ package com.now.naaga.common.config; +import static org.hibernate.cfg.AvailableSettings.STATEMENT_INSPECTOR; + import com.now.naaga.common.presentation.QueryInspector; import org.springframework.boot.autoconfigure.orm.jpa.HibernatePropertiesCustomizer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import static org.hibernate.cfg.AvailableSettings.STATEMENT_INSPECTOR; - @Configuration public class HibernateConfig { diff --git a/backend/src/main/java/com/now/naaga/common/infrastructure/MultipartFileManager.java b/backend/src/main/java/com/now/naaga/common/infrastructure/MultipartFileManager.java index 03dadefa9..0f20010ae 100644 --- a/backend/src/main/java/com/now/naaga/common/infrastructure/MultipartFileManager.java +++ b/backend/src/main/java/com/now/naaga/common/infrastructure/MultipartFileManager.java @@ -1,21 +1,19 @@ package com.now.naaga.common.infrastructure; +import static com.now.naaga.common.exception.CommonExceptionType.INVALID_REQUEST_BODY; +import static com.now.naaga.common.exception.InternalExceptionType.FAIL_MAKE_DIRECTORY; + import com.now.naaga.common.exception.CommonException; import com.now.naaga.common.exception.CommonExceptionType; +import com.now.naaga.common.exception.InternalException; import java.io.File; import java.io.IOException; import java.util.Objects; import java.util.UUID; - -import com.now.naaga.common.exception.InternalException; -import com.now.naaga.common.exception.InternalExceptionType; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.web.multipart.MultipartFile; -import static com.now.naaga.common.exception.CommonExceptionType.INVALID_REQUEST_BODY; -import static com.now.naaga.common.exception.InternalExceptionType.FAIL_MAKE_DIRECTORY; - @Component public class MultipartFileManager implements FileManager { diff --git a/backend/src/main/java/com/now/naaga/common/presentation/LogFilter.java b/backend/src/main/java/com/now/naaga/common/presentation/LogFilter.java index cad62bbd7..acc69107e 100644 --- a/backend/src/main/java/com/now/naaga/common/presentation/LogFilter.java +++ b/backend/src/main/java/com/now/naaga/common/presentation/LogFilter.java @@ -1,16 +1,19 @@ package com.now.naaga.common.presentation; -import jakarta.servlet.*; +import static com.now.naaga.common.presentation.MdcToken.REQUEST_ID; + +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; import jakarta.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; -import java.io.IOException; -import java.util.UUID; - -import static com.now.naaga.common.presentation.MdcToken.*; - public class LogFilter implements Filter { private static final String LOG_FORMAT = "uri: {}, method: {}, time: {}ms, queryCount: {}"; diff --git a/backend/src/main/java/com/now/naaga/common/presentation/QueryInspector.java b/backend/src/main/java/com/now/naaga/common/presentation/QueryInspector.java index 51e67bba3..216ea91c8 100644 --- a/backend/src/main/java/com/now/naaga/common/presentation/QueryInspector.java +++ b/backend/src/main/java/com/now/naaga/common/presentation/QueryInspector.java @@ -1,13 +1,10 @@ package com.now.naaga.common.presentation; +import java.util.Objects; import org.hibernate.resource.jdbc.spi.StatementInspector; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import org.springframework.web.context.request.RequestContextHolder; -import java.util.Objects; - @Component public class QueryInspector implements StatementInspector { diff --git a/backend/src/main/java/com/now/naaga/common/presentation/interceptor/RequestMatcherInterceptor.java b/backend/src/main/java/com/now/naaga/common/presentation/interceptor/RequestMatcherInterceptor.java index f13c7f3da..ade990797 100644 --- a/backend/src/main/java/com/now/naaga/common/presentation/interceptor/RequestMatcherInterceptor.java +++ b/backend/src/main/java/com/now/naaga/common/presentation/interceptor/RequestMatcherInterceptor.java @@ -2,11 +2,10 @@ import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; -import org.springframework.http.HttpMethod; -import org.springframework.web.servlet.HandlerInterceptor; - import java.util.ArrayList; import java.util.List; +import org.springframework.http.HttpMethod; +import org.springframework.web.servlet.HandlerInterceptor; public class RequestMatcherInterceptor implements HandlerInterceptor { diff --git a/backend/src/main/java/com/now/naaga/game/application/GameService.java b/backend/src/main/java/com/now/naaga/game/application/GameService.java index 509bce1c9..d2c4bc3ad 100644 --- a/backend/src/main/java/com/now/naaga/game/application/GameService.java +++ b/backend/src/main/java/com/now/naaga/game/application/GameService.java @@ -1,6 +1,19 @@ package com.now.naaga.game.application; -import com.now.naaga.game.application.dto.*; +import static com.now.naaga.game.domain.GameStatus.IN_PROGRESS; +import static com.now.naaga.game.exception.GameExceptionType.ALREADY_IN_PROGRESS; +import static com.now.naaga.game.exception.GameExceptionType.CAN_NOT_FIND_PLACE; +import static com.now.naaga.game.exception.GameExceptionType.NOT_EXIST; +import static com.now.naaga.game.exception.GameExceptionType.NOT_EXIST_IN_PROGRESS; +import static com.now.naaga.gameresult.exception.GameResultExceptionType.GAME_RESULT_NOT_EXIST; + +import com.now.naaga.game.application.dto.CreateGameCommand; +import com.now.naaga.game.application.dto.CreateGameResultCommand; +import com.now.naaga.game.application.dto.EndGameCommand; +import com.now.naaga.game.application.dto.FindAllGamesCommand; +import com.now.naaga.game.application.dto.FindGameByIdCommand; +import com.now.naaga.game.application.dto.FindGameByStatusCommand; +import com.now.naaga.game.application.dto.FindGameInProgressCommand; import com.now.naaga.game.domain.EndType; import com.now.naaga.game.domain.Game; import com.now.naaga.game.domain.GameRecord; @@ -19,15 +32,10 @@ import com.now.naaga.player.application.PlayerService; import com.now.naaga.player.domain.Player; import com.now.naaga.player.presentation.dto.PlayerRequest; +import java.util.List; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.List; - -import static com.now.naaga.game.domain.GameStatus.IN_PROGRESS; -import static com.now.naaga.game.exception.GameExceptionType.*; -import static com.now.naaga.gameresult.exception.GameResultExceptionType.GAME_RESULT_NOT_EXIST; - @Transactional @Service public class GameService { diff --git a/backend/src/main/java/com/now/naaga/game/application/HintService.java b/backend/src/main/java/com/now/naaga/game/application/HintService.java index cedb687c9..b4e74cc6d 100644 --- a/backend/src/main/java/com/now/naaga/game/application/HintService.java +++ b/backend/src/main/java/com/now/naaga/game/application/HintService.java @@ -1,5 +1,8 @@ package com.now.naaga.game.application; +import static com.now.naaga.game.exception.GameExceptionType.HINTS_EXHAUSTED; +import static com.now.naaga.game.exception.GameExceptionType.HINT_NOT_EXIST_IN_GAME; + import com.now.naaga.game.application.dto.CreateHintCommand; import com.now.naaga.game.application.dto.FindGameByIdCommand; import com.now.naaga.game.application.dto.FindHintByIdCommand; @@ -13,9 +16,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import static com.now.naaga.game.exception.GameExceptionType.HINTS_EXHAUSTED; -import static com.now.naaga.game.exception.GameExceptionType.HINT_NOT_EXIST_IN_GAME; - @Transactional @Service public class HintService { diff --git a/backend/src/main/java/com/now/naaga/game/domain/Game.java b/backend/src/main/java/com/now/naaga/game/domain/Game.java index 2ddb4b9ae..882b74145 100644 --- a/backend/src/main/java/com/now/naaga/game/domain/Game.java +++ b/backend/src/main/java/com/now/naaga/game/domain/Game.java @@ -1,5 +1,14 @@ package com.now.naaga.game.domain; +import static com.now.naaga.game.domain.EndType.ARRIVED; +import static com.now.naaga.game.domain.EndType.GIVE_UP; +import static com.now.naaga.game.domain.GameStatus.DONE; +import static com.now.naaga.game.domain.GameStatus.IN_PROGRESS; +import static com.now.naaga.game.exception.GameExceptionType.ALREADY_DONE; +import static com.now.naaga.game.exception.GameExceptionType.INACCESSIBLE_AUTHENTICATION; +import static com.now.naaga.game.exception.GameExceptionType.NOT_ARRIVED; +import static com.now.naaga.game.exception.GameExceptionType.NOT_DONE; + import com.now.naaga.common.domain.BaseEntity; import com.now.naaga.game.exception.GameException; import com.now.naaga.game.exception.GameExceptionType; @@ -7,19 +16,24 @@ import com.now.naaga.place.domain.Place; import com.now.naaga.place.domain.Position; import com.now.naaga.player.domain.Player; -import jakarta.persistence.*; - +import jakarta.persistence.AttributeOverride; +import jakarta.persistence.AttributeOverrides; +import jakarta.persistence.Column; +import jakarta.persistence.Embedded; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Objects; -import static com.now.naaga.game.domain.EndType.ARRIVED; -import static com.now.naaga.game.domain.EndType.GIVE_UP; -import static com.now.naaga.game.domain.GameStatus.DONE; -import static com.now.naaga.game.domain.GameStatus.IN_PROGRESS; -import static com.now.naaga.game.exception.GameExceptionType.*; - @Entity public class Game extends BaseEntity { diff --git a/backend/src/main/java/com/now/naaga/game/domain/Statistic.java b/backend/src/main/java/com/now/naaga/game/domain/Statistic.java index 214bba3b9..f627145ff 100644 --- a/backend/src/main/java/com/now/naaga/game/domain/Statistic.java +++ b/backend/src/main/java/com/now/naaga/game/domain/Statistic.java @@ -1,11 +1,11 @@ package com.now.naaga.game.domain; -import java.time.Duration; -import java.util.List; - import static com.now.naaga.gameresult.domain.ResultType.FAIL; import static com.now.naaga.gameresult.domain.ResultType.SUCCESS; +import java.time.Duration; +import java.util.List; + public class Statistic { private int gameCount; diff --git a/backend/src/main/java/com/now/naaga/game/presentation/GameController.java b/backend/src/main/java/com/now/naaga/game/presentation/GameController.java index d7f55eb7a..9b5b4bfb7 100644 --- a/backend/src/main/java/com/now/naaga/game/presentation/GameController.java +++ b/backend/src/main/java/com/now/naaga/game/presentation/GameController.java @@ -1,24 +1,41 @@ package com.now.naaga.game.presentation; +import static com.now.naaga.common.exception.CommonExceptionType.INVALID_REQUEST_PARAMETERS; + import com.now.naaga.auth.presentation.annotation.Auth; import com.now.naaga.common.exception.CommonException; import com.now.naaga.game.application.GameService; import com.now.naaga.game.application.HintService; -import com.now.naaga.game.application.dto.*; +import com.now.naaga.game.application.dto.CreateGameCommand; +import com.now.naaga.game.application.dto.CreateHintCommand; +import com.now.naaga.game.application.dto.EndGameCommand; +import com.now.naaga.game.application.dto.FindAllGamesCommand; +import com.now.naaga.game.application.dto.FindGameByIdCommand; +import com.now.naaga.game.application.dto.FindGameByStatusCommand; +import com.now.naaga.game.application.dto.FindHintByIdCommand; import com.now.naaga.game.domain.Game; import com.now.naaga.game.domain.GameRecord; import com.now.naaga.game.domain.Hint; -import com.now.naaga.game.presentation.dto.*; +import com.now.naaga.game.presentation.dto.CoordinateRequest; +import com.now.naaga.game.presentation.dto.EndGameRequest; +import com.now.naaga.game.presentation.dto.GameResponse; +import com.now.naaga.game.presentation.dto.GameResultResponse; +import com.now.naaga.game.presentation.dto.GameStatusResponse; +import com.now.naaga.game.presentation.dto.HintResponse; import com.now.naaga.player.presentation.dto.PlayerRequest; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - import java.net.URI; import java.util.List; import java.util.stream.Collectors; - -import static com.now.naaga.common.exception.CommonExceptionType.INVALID_REQUEST_PARAMETERS; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; @RequestMapping("/games") @RestController diff --git a/backend/src/main/java/com/now/naaga/game/repository/GameRepository.java b/backend/src/main/java/com/now/naaga/game/repository/GameRepository.java index 27d8e31aa..d7f9b1a93 100644 --- a/backend/src/main/java/com/now/naaga/game/repository/GameRepository.java +++ b/backend/src/main/java/com/now/naaga/game/repository/GameRepository.java @@ -2,9 +2,8 @@ import com.now.naaga.game.domain.Game; import com.now.naaga.game.domain.GameStatus; -import org.springframework.data.jpa.repository.JpaRepository; - import java.util.List; +import org.springframework.data.jpa.repository.JpaRepository; public interface GameRepository extends JpaRepository { diff --git a/backend/src/main/java/com/now/naaga/gameresult/application/GameResultService.java b/backend/src/main/java/com/now/naaga/gameresult/application/GameResultService.java index 010b295ad..25d739646 100644 --- a/backend/src/main/java/com/now/naaga/gameresult/application/GameResultService.java +++ b/backend/src/main/java/com/now/naaga/gameresult/application/GameResultService.java @@ -1,9 +1,9 @@ package com.now.naaga.gameresult.application; +import com.now.naaga.game.application.GameFinishService; import com.now.naaga.game.application.dto.CreateGameResultCommand; import com.now.naaga.game.domain.EndType; import com.now.naaga.game.domain.Game; -import com.now.naaga.game.application.GameFinishService; import com.now.naaga.gameresult.domain.GameResult; import com.now.naaga.gameresult.domain.ResultType; import com.now.naaga.gameresult.domain.gamescore.ResultScoreCalculator; diff --git a/backend/src/main/java/com/now/naaga/gameresult/domain/GameResult.java b/backend/src/main/java/com/now/naaga/gameresult/domain/GameResult.java index 12b8a9c01..ce6acc9e2 100644 --- a/backend/src/main/java/com/now/naaga/gameresult/domain/GameResult.java +++ b/backend/src/main/java/com/now/naaga/gameresult/domain/GameResult.java @@ -3,8 +3,16 @@ import com.now.naaga.common.domain.BaseEntity; import com.now.naaga.game.domain.Game; import com.now.naaga.score.domain.Score; -import jakarta.persistence.*; - +import jakarta.persistence.Embedded; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.OneToOne; import java.util.Objects; @Entity diff --git a/backend/src/main/java/com/now/naaga/gameresult/domain/gamescore/FailResultScorePolicy.java b/backend/src/main/java/com/now/naaga/gameresult/domain/gamescore/FailResultScorePolicy.java index 90a0457ca..5368e1217 100644 --- a/backend/src/main/java/com/now/naaga/gameresult/domain/gamescore/FailResultScorePolicy.java +++ b/backend/src/main/java/com/now/naaga/gameresult/domain/gamescore/FailResultScorePolicy.java @@ -1,11 +1,11 @@ package com.now.naaga.gameresult.domain.gamescore; +import static com.now.naaga.gameresult.domain.ResultType.FAIL; + import com.now.naaga.game.domain.Game; import com.now.naaga.gameresult.domain.ResultType; import com.now.naaga.score.domain.Score; -import static com.now.naaga.gameresult.domain.ResultType.FAIL; - public class FailResultScorePolicy implements ResultScorePolicy { @Override diff --git a/backend/src/main/java/com/now/naaga/gameresult/domain/gamescore/ResultScoreCalculator.java b/backend/src/main/java/com/now/naaga/gameresult/domain/gamescore/ResultScoreCalculator.java index d1db814ef..c8536e948 100644 --- a/backend/src/main/java/com/now/naaga/gameresult/domain/gamescore/ResultScoreCalculator.java +++ b/backend/src/main/java/com/now/naaga/gameresult/domain/gamescore/ResultScoreCalculator.java @@ -1,14 +1,13 @@ package com.now.naaga.gameresult.domain.gamescore; +import static com.now.naaga.common.exception.InternalExceptionType.FAIL_ESTABLISH_GAME_SCORE_POLICY; + import com.now.naaga.common.exception.InternalException; import com.now.naaga.game.domain.Game; import com.now.naaga.gameresult.domain.ResultType; import com.now.naaga.score.domain.Score; - import java.util.List; -import static com.now.naaga.common.exception.InternalExceptionType.FAIL_ESTABLISH_GAME_SCORE_POLICY; - public class ResultScoreCalculator { private final List scorePolicies; diff --git a/backend/src/main/java/com/now/naaga/gameresult/domain/gamescore/SuccessResultScorePolicy.java b/backend/src/main/java/com/now/naaga/gameresult/domain/gamescore/SuccessResultScorePolicy.java index 3827c3d1e..7d5775083 100644 --- a/backend/src/main/java/com/now/naaga/gameresult/domain/gamescore/SuccessResultScorePolicy.java +++ b/backend/src/main/java/com/now/naaga/gameresult/domain/gamescore/SuccessResultScorePolicy.java @@ -1,16 +1,15 @@ package com.now.naaga.gameresult.domain.gamescore; +import static com.now.naaga.game.domain.Game.MAX_ATTEMPT_COUNT; +import static com.now.naaga.game.domain.Game.MAX_HINT_COUNT; +import static com.now.naaga.gameresult.domain.ResultType.SUCCESS; + import com.now.naaga.game.domain.Game; import com.now.naaga.gameresult.domain.ResultType; import com.now.naaga.score.domain.Score; - import java.time.Duration; import java.time.LocalDateTime; -import static com.now.naaga.game.domain.Game.MAX_ATTEMPT_COUNT; -import static com.now.naaga.game.domain.Game.MAX_HINT_COUNT; -import static com.now.naaga.gameresult.domain.ResultType.SUCCESS; - public class SuccessResultScorePolicy implements ResultScorePolicy { private static final Score BASE_SCORE = new Score(50); diff --git a/backend/src/main/java/com/now/naaga/letter/application/LetterService.java b/backend/src/main/java/com/now/naaga/letter/application/LetterService.java index bac46cbdd..2e930bbe9 100644 --- a/backend/src/main/java/com/now/naaga/letter/application/LetterService.java +++ b/backend/src/main/java/com/now/naaga/letter/application/LetterService.java @@ -1,24 +1,23 @@ package com.now.naaga.letter.application; +import static com.now.naaga.letter.exception.LetterExceptionType.NO_EXIST; + +import com.now.naaga.letter.application.dto.CreateLetterCommand; import com.now.naaga.letter.application.letterlog.ReadLetterLogService; +import com.now.naaga.letter.application.letterlog.WriteLetterLogService; import com.now.naaga.letter.application.letterlog.dto.LetterLogCreateCommand; +import com.now.naaga.letter.application.letterlog.dto.WriteLetterLogCreateCommand; import com.now.naaga.letter.domain.Letter; import com.now.naaga.letter.exception.LetterException; import com.now.naaga.letter.presentation.dto.FindNearByLetterCommand; import com.now.naaga.letter.presentation.dto.LetterReadCommand; -import com.now.naaga.letter.application.dto.CreateLetterCommand; -import com.now.naaga.letter.application.letterlog.WriteLetterLogService; -import com.now.naaga.letter.application.letterlog.dto.WriteLetterLogCreateCommand; import com.now.naaga.letter.repository.LetterRepository; import com.now.naaga.player.application.PlayerService; import com.now.naaga.player.domain.Player; +import java.util.List; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.List; - -import static com.now.naaga.letter.exception.LetterExceptionType.NO_EXIST; - @Transactional @Service public class LetterService { diff --git a/backend/src/main/java/com/now/naaga/letter/application/letterlog/ReadLetterLogService.java b/backend/src/main/java/com/now/naaga/letter/application/letterlog/ReadLetterLogService.java index d63c0448a..bd780b0d2 100644 --- a/backend/src/main/java/com/now/naaga/letter/application/letterlog/ReadLetterLogService.java +++ b/backend/src/main/java/com/now/naaga/letter/application/letterlog/ReadLetterLogService.java @@ -1,22 +1,21 @@ package com.now.naaga.letter.application.letterlog; +import static com.now.naaga.game.domain.GameStatus.IN_PROGRESS; + import com.now.naaga.game.application.GameService; +import com.now.naaga.game.application.dto.FindGameByIdCommand; import com.now.naaga.game.application.dto.FindGameByStatusCommand; import com.now.naaga.game.domain.Game; import com.now.naaga.game.exception.GameException; import com.now.naaga.game.exception.GameExceptionType; -import com.now.naaga.letter.application.letterlog.dto.LetterLogCreateCommand; -import com.now.naaga.game.application.dto.FindGameByIdCommand; import com.now.naaga.letter.application.letterlog.dto.LetterByGameCommand; +import com.now.naaga.letter.application.letterlog.dto.LetterLogCreateCommand; import com.now.naaga.letter.domain.letterlog.ReadLetterLog; import com.now.naaga.letter.repository.letterlog.ReadLetterLogRepository; +import java.util.List; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.List; - -import static com.now.naaga.game.domain.GameStatus.IN_PROGRESS; - @Transactional @Service public class ReadLetterLogService { diff --git a/backend/src/main/java/com/now/naaga/letter/application/letterlog/WriteLetterLogService.java b/backend/src/main/java/com/now/naaga/letter/application/letterlog/WriteLetterLogService.java index 86cf95331..c63a69839 100644 --- a/backend/src/main/java/com/now/naaga/letter/application/letterlog/WriteLetterLogService.java +++ b/backend/src/main/java/com/now/naaga/letter/application/letterlog/WriteLetterLogService.java @@ -11,11 +11,10 @@ import com.now.naaga.letter.domain.Letter; import com.now.naaga.letter.domain.letterlog.WriteLetterLog; import com.now.naaga.letter.repository.letterlog.WriteLetterLogRepository; +import java.util.List; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.List; - @Transactional @Service public class WriteLetterLogService { diff --git a/backend/src/main/java/com/now/naaga/letter/domain/Letter.java b/backend/src/main/java/com/now/naaga/letter/domain/Letter.java index 291e65ad3..2d644a5d8 100644 --- a/backend/src/main/java/com/now/naaga/letter/domain/Letter.java +++ b/backend/src/main/java/com/now/naaga/letter/domain/Letter.java @@ -3,8 +3,14 @@ import com.now.naaga.common.domain.BaseEntity; import com.now.naaga.place.domain.Position; import com.now.naaga.player.domain.Player; -import jakarta.persistence.*; - +import jakarta.persistence.Embedded; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; import java.time.LocalDateTime; import java.util.Objects; diff --git a/backend/src/main/java/com/now/naaga/letter/domain/letterlog/ReadLetterLog.java b/backend/src/main/java/com/now/naaga/letter/domain/letterlog/ReadLetterLog.java index cd8fa649e..cc73198cc 100644 --- a/backend/src/main/java/com/now/naaga/letter/domain/letterlog/ReadLetterLog.java +++ b/backend/src/main/java/com/now/naaga/letter/domain/letterlog/ReadLetterLog.java @@ -3,8 +3,13 @@ import com.now.naaga.common.domain.BaseEntity; import com.now.naaga.game.domain.Game; import com.now.naaga.letter.domain.Letter; -import jakarta.persistence.*; - +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; import java.util.Objects; diff --git a/backend/src/main/java/com/now/naaga/letter/domain/letterlog/WriteLetterLog.java b/backend/src/main/java/com/now/naaga/letter/domain/letterlog/WriteLetterLog.java index e00763d75..b95899dfb 100644 --- a/backend/src/main/java/com/now/naaga/letter/domain/letterlog/WriteLetterLog.java +++ b/backend/src/main/java/com/now/naaga/letter/domain/letterlog/WriteLetterLog.java @@ -2,11 +2,15 @@ import com.now.naaga.common.domain.BaseEntity; import com.now.naaga.game.domain.Game; -import com.now.naaga.letter.exception.LetterException; -import com.now.naaga.letter.exception.LetterExceptionType; import com.now.naaga.letter.domain.Letter; -import jakarta.persistence.*; - +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToOne; import java.util.Objects; @Entity diff --git a/backend/src/main/java/com/now/naaga/letter/presentation/LetterController.java b/backend/src/main/java/com/now/naaga/letter/presentation/LetterController.java index ec65df097..af9b288f5 100644 --- a/backend/src/main/java/com/now/naaga/letter/presentation/LetterController.java +++ b/backend/src/main/java/com/now/naaga/letter/presentation/LetterController.java @@ -4,14 +4,23 @@ import com.now.naaga.letter.application.LetterService; import com.now.naaga.letter.application.dto.CreateLetterCommand; import com.now.naaga.letter.domain.Letter; -import com.now.naaga.letter.presentation.dto.*; +import com.now.naaga.letter.presentation.dto.FindNearByLetterCommand; +import com.now.naaga.letter.presentation.dto.LetterReadCommand; +import com.now.naaga.letter.presentation.dto.LetterRequest; +import com.now.naaga.letter.presentation.dto.LetterResponse; +import com.now.naaga.letter.presentation.dto.NearByLetterResponse; import com.now.naaga.player.presentation.dto.PlayerRequest; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - import java.net.URI; import java.util.List; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; @RequestMapping("/letters") @RestController diff --git a/backend/src/main/java/com/now/naaga/letter/presentation/LetterLogController.java b/backend/src/main/java/com/now/naaga/letter/presentation/LetterLogController.java index 6e184cfcd..dd07115b2 100644 --- a/backend/src/main/java/com/now/naaga/letter/presentation/LetterLogController.java +++ b/backend/src/main/java/com/now/naaga/letter/presentation/LetterLogController.java @@ -1,5 +1,9 @@ package com.now.naaga.letter.presentation; +import static com.now.naaga.common.exception.CommonExceptionType.INVALID_REQUEST_PARAMETERS; +import static com.now.naaga.letter.presentation.LogType.READ; +import static com.now.naaga.letter.presentation.LogType.WRITE; + import com.now.naaga.auth.presentation.annotation.Auth; import com.now.naaga.common.exception.CommonException; import com.now.naaga.letter.application.letterlog.ReadLetterLogService; @@ -9,6 +13,7 @@ import com.now.naaga.letter.domain.letterlog.WriteLetterLog; import com.now.naaga.letter.presentation.dto.LetterResponse; import com.now.naaga.player.presentation.dto.PlayerRequest; +import java.util.List; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -16,12 +21,6 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import java.util.List; - -import static com.now.naaga.common.exception.CommonExceptionType.INVALID_REQUEST_PARAMETERS; -import static com.now.naaga.letter.presentation.LogType.READ; -import static com.now.naaga.letter.presentation.LogType.WRITE; - @RequestMapping("/letterlogs") @RestController public class LetterLogController { diff --git a/backend/src/main/java/com/now/naaga/letter/presentation/dto/FindNearByLetterCommand.java b/backend/src/main/java/com/now/naaga/letter/presentation/dto/FindNearByLetterCommand.java index a62bf6c73..32d527413 100644 --- a/backend/src/main/java/com/now/naaga/letter/presentation/dto/FindNearByLetterCommand.java +++ b/backend/src/main/java/com/now/naaga/letter/presentation/dto/FindNearByLetterCommand.java @@ -1,7 +1,6 @@ package com.now.naaga.letter.presentation.dto; import com.now.naaga.place.domain.Position; - import java.math.BigDecimal; public record FindNearByLetterCommand(Position position) { diff --git a/backend/src/main/java/com/now/naaga/letter/presentation/dto/NearByLetterResponse.java b/backend/src/main/java/com/now/naaga/letter/presentation/dto/NearByLetterResponse.java index b1dabac08..fa0f1ce2c 100644 --- a/backend/src/main/java/com/now/naaga/letter/presentation/dto/NearByLetterResponse.java +++ b/backend/src/main/java/com/now/naaga/letter/presentation/dto/NearByLetterResponse.java @@ -2,7 +2,6 @@ import com.now.naaga.game.presentation.dto.CoordinateResponse; import com.now.naaga.letter.domain.Letter; - import java.util.List; public record NearByLetterResponse(Long id, diff --git a/backend/src/main/java/com/now/naaga/letter/repository/LetterRepository.java b/backend/src/main/java/com/now/naaga/letter/repository/LetterRepository.java index 2589bc7e2..24ab1c07d 100644 --- a/backend/src/main/java/com/now/naaga/letter/repository/LetterRepository.java +++ b/backend/src/main/java/com/now/naaga/letter/repository/LetterRepository.java @@ -2,12 +2,11 @@ import com.now.naaga.letter.domain.Letter; import com.now.naaga.place.domain.Position; +import java.util.List; 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; - public interface LetterRepository extends JpaRepository { @Query(value = "SELECT letter FROM Letter letter " + diff --git a/backend/src/main/java/com/now/naaga/letter/repository/letterlog/ReadLetterLogRepository.java b/backend/src/main/java/com/now/naaga/letter/repository/letterlog/ReadLetterLogRepository.java index 33510773b..7a2d47c79 100644 --- a/backend/src/main/java/com/now/naaga/letter/repository/letterlog/ReadLetterLogRepository.java +++ b/backend/src/main/java/com/now/naaga/letter/repository/letterlog/ReadLetterLogRepository.java @@ -1,9 +1,8 @@ package com.now.naaga.letter.repository.letterlog; import com.now.naaga.letter.domain.letterlog.ReadLetterLog; -import org.springframework.data.jpa.repository.JpaRepository; - import java.util.List; +import org.springframework.data.jpa.repository.JpaRepository; public interface ReadLetterLogRepository extends JpaRepository { diff --git a/backend/src/main/java/com/now/naaga/letter/repository/letterlog/WriteLetterLogRepository.java b/backend/src/main/java/com/now/naaga/letter/repository/letterlog/WriteLetterLogRepository.java index bfd1acf73..1af8058e3 100644 --- a/backend/src/main/java/com/now/naaga/letter/repository/letterlog/WriteLetterLogRepository.java +++ b/backend/src/main/java/com/now/naaga/letter/repository/letterlog/WriteLetterLogRepository.java @@ -1,9 +1,8 @@ package com.now.naaga.letter.repository.letterlog; import com.now.naaga.letter.domain.letterlog.WriteLetterLog; -import org.springframework.data.jpa.repository.JpaRepository; - import java.util.List; +import org.springframework.data.jpa.repository.JpaRepository; public interface WriteLetterLogRepository extends JpaRepository { diff --git a/backend/src/main/java/com/now/naaga/like/application/PlaceLikeService.java b/backend/src/main/java/com/now/naaga/like/application/PlaceLikeService.java index 477d8d994..1ab9531af 100644 --- a/backend/src/main/java/com/now/naaga/like/application/PlaceLikeService.java +++ b/backend/src/main/java/com/now/naaga/like/application/PlaceLikeService.java @@ -13,11 +13,11 @@ import com.now.naaga.place.application.PlaceService; import com.now.naaga.place.application.PlaceStatisticsService; import com.now.naaga.place.application.dto.FindPlaceByIdCommand; +import com.now.naaga.place.application.dto.FindPlaceStatisticsByPlaceIdCommand; +import com.now.naaga.place.application.dto.PlusLikeCommand; import com.now.naaga.place.application.dto.SubtractLikeCommand; import com.now.naaga.place.domain.Place; import com.now.naaga.place.domain.PlaceStatistics; -import com.now.naaga.place.application.dto.FindPlaceStatisticsByPlaceIdCommand; -import com.now.naaga.place.application.dto.PlusLikeCommand; import com.now.naaga.player.application.PlayerService; import com.now.naaga.player.domain.Player; import java.util.Optional; diff --git a/backend/src/main/java/com/now/naaga/like/exception/PlaceLikeExceptionType.java b/backend/src/main/java/com/now/naaga/like/exception/PlaceLikeExceptionType.java index 785efe3b7..88cf5b5b2 100644 --- a/backend/src/main/java/com/now/naaga/like/exception/PlaceLikeExceptionType.java +++ b/backend/src/main/java/com/now/naaga/like/exception/PlaceLikeExceptionType.java @@ -3,8 +3,6 @@ import com.now.naaga.common.exception.BaseExceptionType; import org.springframework.http.HttpStatus; -import static com.now.naaga.game.exception.GameExceptionType.INACCESSIBLE_AUTHENTICATION; - public enum PlaceLikeExceptionType implements BaseExceptionType { INACCESSIBLE_AUTHENTICATION( diff --git a/backend/src/main/java/com/now/naaga/like/presentation/dto/CheckMyPlaceLikeResponse.java b/backend/src/main/java/com/now/naaga/like/presentation/dto/CheckMyPlaceLikeResponse.java index 5a7e6402d..d71a8b39d 100644 --- a/backend/src/main/java/com/now/naaga/like/presentation/dto/CheckMyPlaceLikeResponse.java +++ b/backend/src/main/java/com/now/naaga/like/presentation/dto/CheckMyPlaceLikeResponse.java @@ -1,7 +1,6 @@ package com.now.naaga.like.presentation.dto; import com.now.naaga.like.domain.MyPlaceLikeType; -import com.now.naaga.like.domain.PlaceLikeType; public record CheckMyPlaceLikeResponse(MyPlaceLikeType type) { diff --git a/backend/src/main/java/com/now/naaga/like/repository/PlaceLikeRepository.java b/backend/src/main/java/com/now/naaga/like/repository/PlaceLikeRepository.java index 844a72aa7..b1376f9d7 100644 --- a/backend/src/main/java/com/now/naaga/like/repository/PlaceLikeRepository.java +++ b/backend/src/main/java/com/now/naaga/like/repository/PlaceLikeRepository.java @@ -1,9 +1,8 @@ package com.now.naaga.like.repository; import com.now.naaga.like.domain.PlaceLike; -import org.springframework.data.jpa.repository.JpaRepository; - import java.util.Optional; +import org.springframework.data.jpa.repository.JpaRepository; public interface PlaceLikeRepository extends JpaRepository { diff --git a/backend/src/main/java/com/now/naaga/member/domain/Member.java b/backend/src/main/java/com/now/naaga/member/domain/Member.java index f57ffe742..a8327b525 100644 --- a/backend/src/main/java/com/now/naaga/member/domain/Member.java +++ b/backend/src/main/java/com/now/naaga/member/domain/Member.java @@ -1,12 +1,14 @@ package com.now.naaga.member.domain; import com.now.naaga.common.domain.BaseEntity; -import jakarta.persistence.*; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import java.util.Objects; import org.hibernate.annotations.SQLDelete; import org.hibernate.annotations.Where; -import java.util.Objects; - @SQLDelete(sql = "UPDATE member SET deleted = true WHERE id = ?") @Where(clause = "deleted = false") @Entity diff --git a/backend/src/main/java/com/now/naaga/player/application/PlayerService.java b/backend/src/main/java/com/now/naaga/player/application/PlayerService.java index b1c96dd24..b3ea891ad 100644 --- a/backend/src/main/java/com/now/naaga/player/application/PlayerService.java +++ b/backend/src/main/java/com/now/naaga/player/application/PlayerService.java @@ -1,5 +1,7 @@ package com.now.naaga.player.application; +import static com.now.naaga.player.exception.PlayerExceptionType.PLAYER_NOT_FOUND; + import com.now.naaga.player.application.dto.AddScoreCommand; import com.now.naaga.player.application.dto.CreatePlayerCommand; import com.now.naaga.player.application.dto.DeletePlayerCommand; @@ -9,13 +11,10 @@ import com.now.naaga.player.persistence.repository.PlayerRepository; import com.now.naaga.player.presentation.dto.PlayerRequest; import com.now.naaga.score.domain.Score; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - import java.util.ArrayList; import java.util.List; - -import static com.now.naaga.player.exception.PlayerExceptionType.PLAYER_NOT_FOUND; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Transactional @Service diff --git a/backend/src/main/java/com/now/naaga/player/domain/Player.java b/backend/src/main/java/com/now/naaga/player/domain/Player.java index c892c1a62..aaea7a4c3 100644 --- a/backend/src/main/java/com/now/naaga/player/domain/Player.java +++ b/backend/src/main/java/com/now/naaga/player/domain/Player.java @@ -1,16 +1,24 @@ package com.now.naaga.player.domain; +import static java.lang.Boolean.FALSE; + import com.now.naaga.common.domain.BaseEntity; import com.now.naaga.member.domain.Member; import com.now.naaga.score.domain.Score; -import jakarta.persistence.*; +import jakarta.persistence.AttributeOverride; +import jakarta.persistence.Column; +import jakarta.persistence.Embedded; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.OneToOne; +import java.util.Objects; import org.hibernate.annotations.SQLDelete; import org.hibernate.annotations.Where; -import java.util.Objects; - -import static java.lang.Boolean.FALSE; - @SQLDelete(sql = "UPDATE player SET deleted = true WHERE id = ?") @Where(clause = "deleted = false") @Entity diff --git a/backend/src/main/java/com/now/naaga/player/presentation/PlayerController.java b/backend/src/main/java/com/now/naaga/player/presentation/PlayerController.java index 318957cac..0638e5ac7 100644 --- a/backend/src/main/java/com/now/naaga/player/presentation/PlayerController.java +++ b/backend/src/main/java/com/now/naaga/player/presentation/PlayerController.java @@ -1,22 +1,21 @@ package com.now.naaga.player.presentation; +import static com.now.naaga.common.exception.CommonExceptionType.INVALID_REQUEST_PARAMETERS; + import com.now.naaga.auth.presentation.annotation.Auth; import com.now.naaga.common.exception.CommonException; import com.now.naaga.player.application.PlayerService; import com.now.naaga.player.domain.Rank; import com.now.naaga.player.presentation.dto.PlayerRequest; import com.now.naaga.player.presentation.dto.RankResponse; +import java.util.List; +import java.util.stream.Collectors; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import java.util.List; -import java.util.stream.Collectors; - -import static com.now.naaga.common.exception.CommonExceptionType.INVALID_REQUEST_PARAMETERS; - @RequestMapping("/ranks") @RestController public class PlayerController { diff --git a/backend/src/main/java/com/now/naaga/temporaryplace/application/TemporaryPlaceService.java b/backend/src/main/java/com/now/naaga/temporaryplace/application/TemporaryPlaceService.java index 5165a2694..355782be4 100644 --- a/backend/src/main/java/com/now/naaga/temporaryplace/application/TemporaryPlaceService.java +++ b/backend/src/main/java/com/now/naaga/temporaryplace/application/TemporaryPlaceService.java @@ -7,13 +7,12 @@ import com.now.naaga.temporaryplace.application.dto.CreateTemporaryPlaceCommand; import com.now.naaga.temporaryplace.domain.TemporaryPlace; import com.now.naaga.temporaryplace.repository.TemporaryPlaceRepository; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.multipart.MultipartFile; - import java.io.File; import java.util.Comparator; import java.util.List; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; @Transactional @Service diff --git a/backend/src/main/java/com/now/naaga/temporaryplace/presentation/TemporaryPlaceController.java b/backend/src/main/java/com/now/naaga/temporaryplace/presentation/TemporaryPlaceController.java index c6832a902..a9d47954b 100644 --- a/backend/src/main/java/com/now/naaga/temporaryplace/presentation/TemporaryPlaceController.java +++ b/backend/src/main/java/com/now/naaga/temporaryplace/presentation/TemporaryPlaceController.java @@ -7,12 +7,17 @@ import com.now.naaga.temporaryplace.domain.TemporaryPlace; import com.now.naaga.temporaryplace.presentation.dto.CreateTemporaryPlaceRequest; import com.now.naaga.temporaryplace.presentation.dto.TemporaryPlaceResponse; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - import java.net.URI; import java.util.List; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; @RequestMapping("/temporary-places") @RestController diff --git a/backend/src/main/java/com/now/naaga/temporaryplace/presentation/dto/TemporaryPlaceResponse.java b/backend/src/main/java/com/now/naaga/temporaryplace/presentation/dto/TemporaryPlaceResponse.java index 2730c3832..f8da3b645 100644 --- a/backend/src/main/java/com/now/naaga/temporaryplace/presentation/dto/TemporaryPlaceResponse.java +++ b/backend/src/main/java/com/now/naaga/temporaryplace/presentation/dto/TemporaryPlaceResponse.java @@ -2,7 +2,6 @@ import com.now.naaga.game.presentation.dto.CoordinateResponse; import com.now.naaga.temporaryplace.domain.TemporaryPlace; - import java.util.List; import java.util.stream.Collectors; diff --git a/backend/src/main/java/com/now/naaga/temporaryplace/repository/TemporaryPlaceRepository.java b/backend/src/main/java/com/now/naaga/temporaryplace/repository/TemporaryPlaceRepository.java index d9a4a1faf..6c3ac7a0e 100644 --- a/backend/src/main/java/com/now/naaga/temporaryplace/repository/TemporaryPlaceRepository.java +++ b/backend/src/main/java/com/now/naaga/temporaryplace/repository/TemporaryPlaceRepository.java @@ -2,11 +2,10 @@ import com.now.naaga.temporaryplace.domain.TemporaryPlace; +import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; -import java.util.List; - public interface TemporaryPlaceRepository extends JpaRepository { @Override diff --git a/backend/src/test/java/com/now/naaga/auth/application/AuthServiceTest.java b/backend/src/test/java/com/now/naaga/auth/application/AuthServiceTest.java index 4ca8e2bff..106c8170e 100644 --- a/backend/src/test/java/com/now/naaga/auth/application/AuthServiceTest.java +++ b/backend/src/test/java/com/now/naaga/auth/application/AuthServiceTest.java @@ -1,19 +1,24 @@ package com.now.naaga.auth.application; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.SoftAssertions.assertSoftly; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.when; + import com.now.naaga.auth.application.dto.AuthCommand; -import com.now.naaga.auth.infrastructure.dto.AuthInfo; import com.now.naaga.auth.domain.AuthToken; import com.now.naaga.auth.infrastructure.AuthClient; import com.now.naaga.auth.infrastructure.AuthType; +import com.now.naaga.auth.infrastructure.dto.AuthInfo; import com.now.naaga.auth.infrastructure.dto.MemberAuth; import com.now.naaga.common.builder.PlayerBuilder; import com.now.naaga.member.domain.Member; -import com.now.naaga.member.exception.MemberException; import com.now.naaga.member.persistence.repository.MemberRepository; import com.now.naaga.player.domain.Player; -import com.now.naaga.player.exception.PlayerException; import com.now.naaga.player.persistence.repository.PlayerRepository; import com.now.naaga.score.domain.Score; +import java.util.Optional; import org.assertj.core.api.SoftAssertions; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; @@ -22,16 +27,6 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.jdbc.Sql; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.MimeType; - -import java.util.Optional; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.SoftAssertions.assertSoftly; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.when; @SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) diff --git a/backend/src/test/java/com/now/naaga/auth/presentation/AuthControllerTest.java b/backend/src/test/java/com/now/naaga/auth/presentation/AuthControllerTest.java index 544f04d7a..eae1b861f 100644 --- a/backend/src/test/java/com/now/naaga/auth/presentation/AuthControllerTest.java +++ b/backend/src/test/java/com/now/naaga/auth/presentation/AuthControllerTest.java @@ -1,5 +1,14 @@ package com.now.naaga.auth.presentation; +import static com.now.naaga.auth.exception.AuthExceptionType.EXPIRED_TOKEN; +import static com.now.naaga.auth.exception.AuthExceptionType.INVALID_TOKEN; +import static com.now.naaga.auth.exception.AuthExceptionType.INVALID_TOKEN_ACCESS; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.SoftAssertions.assertSoftly; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.when; + import com.now.naaga.auth.domain.AuthToken; import com.now.naaga.auth.infrastructure.AuthClient; import com.now.naaga.auth.infrastructure.AuthType; @@ -17,11 +26,11 @@ import com.now.naaga.common.exception.ExceptionResponse; import com.now.naaga.member.domain.Member; import com.now.naaga.player.domain.Player; -import com.now.naaga.player.persistence.repository.PlayerRepository; import com.now.naaga.score.domain.Score; import io.restassured.RestAssured; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; +import java.util.Date; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores; @@ -31,16 +40,6 @@ import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; -import java.util.Date; - -import static com.now.naaga.auth.exception.AuthExceptionType.*; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.InstanceOfAssertFactories.spliterator; -import static org.assertj.core.api.SoftAssertions.assertSoftly; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.when; - @SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(ReplaceUnderscores.class) class AuthControllerTest extends CommonControllerTest { diff --git a/backend/src/test/java/com/now/naaga/auth/presentation/AuthInterceptorTest.java b/backend/src/test/java/com/now/naaga/auth/presentation/AuthInterceptorTest.java index 604b55c32..ae30a54fe 100644 --- a/backend/src/test/java/com/now/naaga/auth/presentation/AuthInterceptorTest.java +++ b/backend/src/test/java/com/now/naaga/auth/presentation/AuthInterceptorTest.java @@ -1,5 +1,11 @@ package com.now.naaga.auth.presentation; +import static com.now.naaga.auth.exception.AuthExceptionType.INVALID_HEADER; +import static com.now.naaga.auth.exception.AuthExceptionType.INVALID_TOKEN; +import static com.now.naaga.auth.exception.AuthExceptionType.NOT_EXIST_HEADER; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.SoftAssertions.assertSoftly; + import com.now.naaga.auth.domain.AuthToken; import com.now.naaga.auth.infrastructure.AuthType; import com.now.naaga.auth.infrastructure.jwt.AuthTokenGenerator; @@ -21,10 +27,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; -import static com.now.naaga.auth.exception.AuthExceptionType.*; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.SoftAssertions.assertSoftly; - @SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(ReplaceUnderscores.class) public class AuthInterceptorTest extends CommonControllerTest { diff --git a/backend/src/test/java/com/now/naaga/auth/presentation/PlayerArgumentResolverTest.java b/backend/src/test/java/com/now/naaga/auth/presentation/PlayerArgumentResolverTest.java index 4db66a1a4..702334f78 100644 --- a/backend/src/test/java/com/now/naaga/auth/presentation/PlayerArgumentResolverTest.java +++ b/backend/src/test/java/com/now/naaga/auth/presentation/PlayerArgumentResolverTest.java @@ -1,5 +1,9 @@ package com.now.naaga.auth.presentation; +import static com.now.naaga.player.exception.PlayerExceptionType.PLAYER_NOT_FOUND; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.SoftAssertions.assertSoftly; + import com.now.naaga.auth.domain.AuthToken; import com.now.naaga.auth.infrastructure.AuthType; import com.now.naaga.auth.infrastructure.jwt.AuthTokenGenerator; @@ -18,10 +22,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; -import static com.now.naaga.player.exception.PlayerExceptionType.PLAYER_NOT_FOUND; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.SoftAssertions.assertSoftly; - @SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(ReplaceUnderscores.class) public class PlayerArgumentResolverTest extends CommonControllerTest { diff --git a/backend/src/test/java/com/now/naaga/auth/presentation/interceptor/ManagerAuthInterceptorTest.java b/backend/src/test/java/com/now/naaga/auth/presentation/interceptor/ManagerAuthInterceptorTest.java index 0ba3de499..6eb262c4d 100644 --- a/backend/src/test/java/com/now/naaga/auth/presentation/interceptor/ManagerAuthInterceptorTest.java +++ b/backend/src/test/java/com/now/naaga/auth/presentation/interceptor/ManagerAuthInterceptorTest.java @@ -1,6 +1,10 @@ package com.now.naaga.auth.presentation.interceptor; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + import com.now.naaga.auth.exception.AuthException; +import java.util.Base64; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; import org.junit.jupiter.api.Test; @@ -13,11 +17,6 @@ import org.springframework.test.context.ActiveProfiles; import org.springframework.web.servlet.mvc.Controller; -import java.util.Base64; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - @ActiveProfiles("test") @SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) diff --git a/backend/src/test/java/com/now/naaga/common/builder/LetterBuilder.java b/backend/src/test/java/com/now/naaga/common/builder/LetterBuilder.java index bf9013ea8..de7e2b51b 100644 --- a/backend/src/test/java/com/now/naaga/common/builder/LetterBuilder.java +++ b/backend/src/test/java/com/now/naaga/common/builder/LetterBuilder.java @@ -1,17 +1,16 @@ package com.now.naaga.common.builder; +import static com.now.naaga.common.fixture.LetterFixture.MESSAGE; +import static com.now.naaga.common.fixture.PositionFixture.잠실역_교보문고_좌표; + import com.now.naaga.letter.domain.Letter; import com.now.naaga.letter.repository.LetterRepository; import com.now.naaga.place.domain.Position; import com.now.naaga.player.domain.Player; +import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.Optional; - -import static com.now.naaga.common.fixture.LetterFixture.MESSAGE; -import static com.now.naaga.common.fixture.PositionFixture.잠실역_교보문고_좌표; - @Component public class LetterBuilder { diff --git a/backend/src/test/java/com/now/naaga/common/builder/ReadLetterLogBuilder.java b/backend/src/test/java/com/now/naaga/common/builder/ReadLetterLogBuilder.java index 8e2f329fb..5e9b30fcb 100644 --- a/backend/src/test/java/com/now/naaga/common/builder/ReadLetterLogBuilder.java +++ b/backend/src/test/java/com/now/naaga/common/builder/ReadLetterLogBuilder.java @@ -4,11 +4,10 @@ import com.now.naaga.letter.domain.Letter; import com.now.naaga.letter.domain.letterlog.ReadLetterLog; import com.now.naaga.letter.repository.letterlog.ReadLetterLogRepository; +import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.Optional; - @Component public class ReadLetterLogBuilder { diff --git a/backend/src/test/java/com/now/naaga/common/builder/WriteLetterLogBuilder.java b/backend/src/test/java/com/now/naaga/common/builder/WriteLetterLogBuilder.java index efea96ca4..27ed2d335 100644 --- a/backend/src/test/java/com/now/naaga/common/builder/WriteLetterLogBuilder.java +++ b/backend/src/test/java/com/now/naaga/common/builder/WriteLetterLogBuilder.java @@ -4,11 +4,10 @@ import com.now.naaga.letter.domain.Letter; import com.now.naaga.letter.domain.letterlog.WriteLetterLog; import com.now.naaga.letter.repository.letterlog.WriteLetterLogRepository; +import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.Optional; - @Component public class WriteLetterLogBuilder { diff --git a/backend/src/test/java/com/now/naaga/common/fixture/GameFixture.java b/backend/src/test/java/com/now/naaga/common/fixture/GameFixture.java index c9c7bc09d..f9f5d79ca 100644 --- a/backend/src/test/java/com/now/naaga/common/fixture/GameFixture.java +++ b/backend/src/test/java/com/now/naaga/common/fixture/GameFixture.java @@ -1,11 +1,11 @@ package com.now.naaga.common.fixture; -import com.now.naaga.game.domain.Game; - import static com.now.naaga.common.fixture.PlaceFixture.PLACE; import static com.now.naaga.common.fixture.PlayerFixture.PLAYER; import static com.now.naaga.common.fixture.PositionFixture.서울_좌표; +import com.now.naaga.game.domain.Game; + public class GameFixture { public static Game GAME() { diff --git a/backend/src/test/java/com/now/naaga/common/fixture/LetterFixture.java b/backend/src/test/java/com/now/naaga/common/fixture/LetterFixture.java index dadc3607f..aff247be8 100644 --- a/backend/src/test/java/com/now/naaga/common/fixture/LetterFixture.java +++ b/backend/src/test/java/com/now/naaga/common/fixture/LetterFixture.java @@ -1,10 +1,10 @@ package com.now.naaga.common.fixture; -import com.now.naaga.letter.domain.Letter; - import static com.now.naaga.common.fixture.PlayerFixture.PLAYER; import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_좌표; +import com.now.naaga.letter.domain.Letter; + public class LetterFixture { public static final String MESSAGE = "안녕하세요. 나아가 개발자들 입니다."; diff --git a/backend/src/test/java/com/now/naaga/common/fixture/PlaceFixture.java b/backend/src/test/java/com/now/naaga/common/fixture/PlaceFixture.java index f4d5363d0..4fb54e1bb 100644 --- a/backend/src/test/java/com/now/naaga/common/fixture/PlaceFixture.java +++ b/backend/src/test/java/com/now/naaga/common/fixture/PlaceFixture.java @@ -1,7 +1,6 @@ package com.now.naaga.common.fixture; -import static com.now.naaga.common.fixture.PlayerFixture.PLAYER; -import static com.now.naaga.common.fixture.PositionFixture.*; +import static com.now.naaga.common.fixture.PositionFixture.서울_좌표; import com.now.naaga.place.domain.Place; import com.now.naaga.place.domain.Position; diff --git a/backend/src/test/java/com/now/naaga/common/fixture/PlayerFixture.java b/backend/src/test/java/com/now/naaga/common/fixture/PlayerFixture.java index 067007b2b..6645b3387 100644 --- a/backend/src/test/java/com/now/naaga/common/fixture/PlayerFixture.java +++ b/backend/src/test/java/com/now/naaga/common/fixture/PlayerFixture.java @@ -1,6 +1,6 @@ package com.now.naaga.common.fixture; -import static com.now.naaga.common.fixture.MemberFixture.*; +import static com.now.naaga.common.fixture.MemberFixture.MEMBER; import com.now.naaga.player.domain.Player; import com.now.naaga.score.domain.Score; diff --git a/backend/src/test/java/com/now/naaga/common/fixture/PositionFixture.java b/backend/src/test/java/com/now/naaga/common/fixture/PositionFixture.java index e4933af73..075cb2aed 100644 --- a/backend/src/test/java/com/now/naaga/common/fixture/PositionFixture.java +++ b/backend/src/test/java/com/now/naaga/common/fixture/PositionFixture.java @@ -1,7 +1,6 @@ package com.now.naaga.common.fixture; import com.now.naaga.place.domain.Position; - import java.math.BigDecimal; public class PositionFixture { diff --git a/backend/src/test/java/com/now/naaga/common/fixture/ReadLetterLogFixture.java b/backend/src/test/java/com/now/naaga/common/fixture/ReadLetterLogFixture.java index 3397818c3..a33678b03 100644 --- a/backend/src/test/java/com/now/naaga/common/fixture/ReadLetterLogFixture.java +++ b/backend/src/test/java/com/now/naaga/common/fixture/ReadLetterLogFixture.java @@ -1,10 +1,10 @@ package com.now.naaga.common.fixture; -import com.now.naaga.letter.domain.letterlog.ReadLetterLog; - import static com.now.naaga.common.fixture.GameFixture.GAME; import static com.now.naaga.common.fixture.LetterFixture.LETTER; +import com.now.naaga.letter.domain.letterlog.ReadLetterLog; + public class ReadLetterLogFixture { public static ReadLetterLog READ_LETTER_LOG() { diff --git a/backend/src/test/java/com/now/naaga/common/fixture/TemporaryPlaceFixture.java b/backend/src/test/java/com/now/naaga/common/fixture/TemporaryPlaceFixture.java index 906f53597..d00235bc3 100644 --- a/backend/src/test/java/com/now/naaga/common/fixture/TemporaryPlaceFixture.java +++ b/backend/src/test/java/com/now/naaga/common/fixture/TemporaryPlaceFixture.java @@ -1,10 +1,10 @@ package com.now.naaga.common.fixture; -import com.now.naaga.temporaryplace.domain.TemporaryPlace; - import static com.now.naaga.common.fixture.PlayerFixture.PLAYER; import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_좌표; +import com.now.naaga.temporaryplace.domain.TemporaryPlace; + public class TemporaryPlaceFixture { public static final String NAME = "temp_place_name"; diff --git a/backend/src/test/java/com/now/naaga/common/fixture/WriteLetterLogFixture.java b/backend/src/test/java/com/now/naaga/common/fixture/WriteLetterLogFixture.java index 7afb388b3..cb1901c62 100644 --- a/backend/src/test/java/com/now/naaga/common/fixture/WriteLetterLogFixture.java +++ b/backend/src/test/java/com/now/naaga/common/fixture/WriteLetterLogFixture.java @@ -1,10 +1,10 @@ package com.now.naaga.common.fixture; -import com.now.naaga.letter.domain.letterlog.WriteLetterLog; - import static com.now.naaga.common.fixture.GameFixture.GAME; import static com.now.naaga.common.fixture.LetterFixture.LETTER; +import com.now.naaga.letter.domain.letterlog.WriteLetterLog; + public class WriteLetterLogFixture { public static WriteLetterLog WRITE_LETTER_LOG() { diff --git a/backend/src/test/java/com/now/naaga/common/presentation/interceptor/RequestMatcherInterceptorTest.java b/backend/src/test/java/com/now/naaga/common/presentation/interceptor/RequestMatcherInterceptorTest.java index 7693dd2cc..9c88dbb0e 100644 --- a/backend/src/test/java/com/now/naaga/common/presentation/interceptor/RequestMatcherInterceptorTest.java +++ b/backend/src/test/java/com/now/naaga/common/presentation/interceptor/RequestMatcherInterceptorTest.java @@ -1,5 +1,11 @@ package com.now.naaga.common.presentation.interceptor; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.springframework.http.HttpMethod.GET; +import static org.springframework.http.HttpMethod.POST; + +import java.util.stream.Stream; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; import org.junit.jupiter.params.ParameterizedTest; @@ -10,18 +16,9 @@ import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.test.context.ActiveProfiles; -import org.springframework.util.AntPathMatcher; -import org.springframework.util.PathMatcher; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.mvc.Controller; -import java.util.stream.Stream; - -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.springframework.http.HttpMethod.GET; -import static org.springframework.http.HttpMethod.POST; - @ActiveProfiles("test") @SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) diff --git a/backend/src/test/java/com/now/naaga/common/presentation/interceptor/RequestPatternTest.java b/backend/src/test/java/com/now/naaga/common/presentation/interceptor/RequestPatternTest.java index ec66c21a0..5debcc19d 100644 --- a/backend/src/test/java/com/now/naaga/common/presentation/interceptor/RequestPatternTest.java +++ b/backend/src/test/java/com/now/naaga/common/presentation/interceptor/RequestPatternTest.java @@ -1,21 +1,17 @@ package com.now.naaga.common.presentation.interceptor; +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.http.HttpMethod.GET; +import static org.springframework.http.HttpMethod.POST; + +import java.util.stream.Stream; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; -import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.springframework.http.HttpMethod; import org.springframework.test.context.ActiveProfiles; -import org.springframework.util.AntPathMatcher; -import org.springframework.util.PathMatcher; - -import java.util.stream.Stream; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.http.HttpMethod.GET; -import static org.springframework.http.HttpMethod.POST; @ActiveProfiles("test") @SuppressWarnings("NonAsciiCharacters") diff --git a/backend/src/test/java/com/now/naaga/game/application/GameServiceTest.java b/backend/src/test/java/com/now/naaga/game/application/GameServiceTest.java index 7112ba7f2..9281e908c 100644 --- a/backend/src/test/java/com/now/naaga/game/application/GameServiceTest.java +++ b/backend/src/test/java/com/now/naaga/game/application/GameServiceTest.java @@ -1,5 +1,23 @@ package com.now.naaga.game.application; +import static com.now.naaga.common.fixture.PositionFixture.역삼역_좌표; +import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_근처_좌표; +import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_좌표; +import static com.now.naaga.common.fixture.PositionFixture.잠실역_교보문고_좌표; +import static com.now.naaga.game.domain.EndType.ARRIVED; +import static com.now.naaga.game.domain.EndType.GIVE_UP; +import static com.now.naaga.game.domain.GameStatus.DONE; +import static com.now.naaga.game.domain.GameStatus.IN_PROGRESS; +import static com.now.naaga.game.exception.GameExceptionType.ALREADY_IN_PROGRESS; +import static com.now.naaga.game.exception.GameExceptionType.CAN_NOT_FIND_PLACE; +import static com.now.naaga.game.exception.GameExceptionType.INACCESSIBLE_AUTHENTICATION; +import static com.now.naaga.gameresult.domain.ResultType.FAIL; +import static com.now.naaga.gameresult.domain.ResultType.SUCCESS; +import static com.now.naaga.gameresult.exception.GameResultExceptionType.GAME_RESULT_NOT_EXIST; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.SoftAssertions.assertSoftly; +import static org.junit.jupiter.api.Assertions.assertThrows; + import com.now.naaga.common.builder.GameBuilder; import com.now.naaga.common.builder.GameResultBuilder; import com.now.naaga.common.builder.PlaceBuilder; @@ -10,14 +28,17 @@ import com.now.naaga.game.application.dto.FindGameByStatusCommand; import com.now.naaga.game.domain.Game; import com.now.naaga.game.domain.GameRecord; -import com.now.naaga.game.exception.GameNotFinishedException; -import com.now.naaga.gameresult.domain.GameResult; import com.now.naaga.game.domain.Statistic; import com.now.naaga.game.exception.GameException; +import com.now.naaga.game.exception.GameNotFinishedException; +import com.now.naaga.gameresult.domain.GameResult; import com.now.naaga.gameresult.exception.GameResultException; import com.now.naaga.place.domain.Place; import com.now.naaga.player.domain.Player; import com.now.naaga.player.presentation.dto.PlayerRequest; +import java.time.LocalDateTime; +import java.time.Month; +import java.util.List; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; import org.junit.jupiter.api.Test; @@ -25,23 +46,6 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.jdbc.Sql; -import java.time.LocalDateTime; -import java.time.Month; -import java.util.List; - -import static com.now.naaga.common.fixture.PositionFixture.*; -import static com.now.naaga.game.domain.EndType.ARRIVED; -import static com.now.naaga.game.domain.EndType.GIVE_UP; -import static com.now.naaga.game.domain.GameStatus.DONE; -import static com.now.naaga.game.domain.GameStatus.IN_PROGRESS; -import static com.now.naaga.gameresult.domain.ResultType.FAIL; -import static com.now.naaga.gameresult.domain.ResultType.SUCCESS; -import static com.now.naaga.game.exception.GameExceptionType.*; -import static com.now.naaga.gameresult.exception.GameResultExceptionType.*; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.SoftAssertions.assertSoftly; -import static org.junit.jupiter.api.Assertions.assertThrows; - @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) @Sql("/truncate.sql") @SpringBootTest diff --git a/backend/src/test/java/com/now/naaga/game/application/HintServiceTest.java b/backend/src/test/java/com/now/naaga/game/application/HintServiceTest.java index f511504c8..351844d2e 100644 --- a/backend/src/test/java/com/now/naaga/game/application/HintServiceTest.java +++ b/backend/src/test/java/com/now/naaga/game/application/HintServiceTest.java @@ -17,7 +17,6 @@ import com.now.naaga.game.domain.Game; import com.now.naaga.game.domain.Hint; import com.now.naaga.game.exception.GameException; -import com.now.naaga.member.domain.Member; import com.now.naaga.place.domain.Place; import java.time.LocalDateTime; import org.junit.jupiter.api.DisplayNameGeneration; diff --git a/backend/src/test/java/com/now/naaga/game/domain/GameTest.java b/backend/src/test/java/com/now/naaga/game/domain/GameTest.java index e89146dc5..38d15db49 100644 --- a/backend/src/test/java/com/now/naaga/game/domain/GameTest.java +++ b/backend/src/test/java/com/now/naaga/game/domain/GameTest.java @@ -1,10 +1,25 @@ package com.now.naaga.game.domain; +import static com.now.naaga.common.fixture.PlaceFixture.PLACE; +import static com.now.naaga.common.fixture.PlayerFixture.PLAYER; +import static com.now.naaga.common.fixture.PositionFixture.GS25_방이도곡점_좌표; +import static com.now.naaga.common.fixture.PositionFixture.던킨도너츠_올림픽공원점_좌표; +import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_근처_좌표; +import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_좌표; +import static com.now.naaga.game.domain.EndType.ARRIVED; +import static com.now.naaga.game.domain.EndType.GIVE_UP; +import static com.now.naaga.game.domain.Game.MAX_ATTEMPT_COUNT; +import static com.now.naaga.game.domain.GameStatus.DONE; +import static com.now.naaga.game.domain.GameStatus.IN_PROGRESS; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + import com.now.naaga.game.exception.GameException; import com.now.naaga.game.exception.GameNotFinishedException; import com.now.naaga.place.domain.Place; import com.now.naaga.place.domain.Position; import com.now.naaga.player.domain.Player; +import java.time.LocalDateTime; +import java.util.ArrayList; import org.assertj.core.api.SoftAssertions; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; @@ -13,20 +28,6 @@ import org.junit.jupiter.params.provider.ValueSource; import org.springframework.test.context.ActiveProfiles; -import java.time.LocalDateTime; -import java.util.ArrayList; - -import static com.now.naaga.common.fixture.PlaceFixture.PLACE; -import static com.now.naaga.common.fixture.PlayerFixture.PLAYER; -import static com.now.naaga.common.fixture.PositionFixture.*; -import static com.now.naaga.game.domain.EndType.ARRIVED; -import static com.now.naaga.game.domain.EndType.GIVE_UP; -import static com.now.naaga.game.domain.Game.MAX_ATTEMPT_COUNT; -import static com.now.naaga.game.domain.Game.MAX_HINT_COUNT; -import static com.now.naaga.game.domain.GameStatus.DONE; -import static com.now.naaga.game.domain.GameStatus.IN_PROGRESS; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - @ActiveProfiles("test") @SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) diff --git a/backend/src/test/java/com/now/naaga/game/domain/ResultScorePolicyTest.java b/backend/src/test/java/com/now/naaga/game/domain/ResultScorePolicyTest.java index beacce10f..5291cad0c 100644 --- a/backend/src/test/java/com/now/naaga/game/domain/ResultScorePolicyTest.java +++ b/backend/src/test/java/com/now/naaga/game/domain/ResultScorePolicyTest.java @@ -1,23 +1,24 @@ package com.now.naaga.game.domain; +import static com.now.naaga.common.fixture.PlaceFixture.PLACE; +import static com.now.naaga.common.fixture.PlayerFixture.PLAYER; +import static com.now.naaga.common.fixture.PositionFixture.던킨도너츠_올림픽공원점_좌표; +import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_좌표; +import static com.now.naaga.common.fixture.PositionFixture.잠실역_교보문고_좌표; +import static com.now.naaga.game.domain.GameStatus.DONE; +import static org.assertj.core.api.Assertions.assertThat; + import com.now.naaga.gameresult.domain.gamescore.ResultScorePolicy; import com.now.naaga.gameresult.domain.gamescore.SuccessResultScorePolicy; import com.now.naaga.player.domain.Player; import com.now.naaga.score.domain.Score; +import java.time.LocalDateTime; +import java.util.List; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; import org.junit.jupiter.api.Test; import org.springframework.test.context.ActiveProfiles; -import java.time.LocalDateTime; -import java.util.List; - -import static com.now.naaga.common.fixture.PlaceFixture.PLACE; -import static com.now.naaga.common.fixture.PlayerFixture.PLAYER; -import static com.now.naaga.common.fixture.PositionFixture.*; -import static com.now.naaga.game.domain.GameStatus.DONE; -import static org.assertj.core.api.Assertions.assertThat; - @ActiveProfiles("test") @SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) diff --git a/backend/src/test/java/com/now/naaga/game/domain/StatisticTest.java b/backend/src/test/java/com/now/naaga/game/domain/StatisticTest.java index 3865c809c..1f1ab2848 100644 --- a/backend/src/test/java/com/now/naaga/game/domain/StatisticTest.java +++ b/backend/src/test/java/com/now/naaga/game/domain/StatisticTest.java @@ -1,28 +1,27 @@ package com.now.naaga.game.domain; +import static com.now.naaga.common.fixture.PlaceFixture.PLACE; +import static com.now.naaga.common.fixture.PlayerFixture.PLAYER; +import static com.now.naaga.common.fixture.PositionFixture.던킨도너츠_올림픽공원점_좌표; +import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_좌표; +import static com.now.naaga.game.domain.GameStatus.DONE; +import static com.now.naaga.gameresult.domain.ResultType.SUCCESS; +import static org.assertj.core.api.SoftAssertions.assertSoftly; + import com.now.naaga.gameresult.domain.GameResult; import com.now.naaga.place.domain.Place; import com.now.naaga.place.domain.Position; import com.now.naaga.player.domain.Player; import com.now.naaga.score.domain.Score; -import org.junit.jupiter.api.DisplayNameGeneration; -import org.junit.jupiter.api.DisplayNameGenerator; -import org.junit.jupiter.api.Test; -import org.springframework.test.context.ActiveProfiles; - import java.time.Duration; import java.time.LocalDateTime; import java.time.Month; import java.util.ArrayList; import java.util.List; - -import static com.now.naaga.common.fixture.PlaceFixture.PLACE; -import static com.now.naaga.common.fixture.PlayerFixture.PLAYER; -import static com.now.naaga.common.fixture.PositionFixture.던킨도너츠_올림픽공원점_좌표; -import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_좌표; -import static com.now.naaga.game.domain.GameStatus.DONE; -import static com.now.naaga.gameresult.domain.ResultType.SUCCESS; -import static org.assertj.core.api.SoftAssertions.assertSoftly; +import org.junit.jupiter.api.DisplayNameGeneration; +import org.junit.jupiter.api.DisplayNameGenerator; +import org.junit.jupiter.api.Test; +import org.springframework.test.context.ActiveProfiles; @ActiveProfiles("test") @SuppressWarnings("NonAsciiCharacters") diff --git a/backend/src/test/java/com/now/naaga/game/presentation/GameControllerTest.java b/backend/src/test/java/com/now/naaga/game/presentation/GameControllerTest.java index 69744849a..5a1dcd656 100644 --- a/backend/src/test/java/com/now/naaga/game/presentation/GameControllerTest.java +++ b/backend/src/test/java/com/now/naaga/game/presentation/GameControllerTest.java @@ -1,13 +1,46 @@ package com.now.naaga.game.presentation; +import static com.now.naaga.auth.exception.AuthExceptionType.NOT_EXIST_HEADER; +import static com.now.naaga.common.fixture.PositionFixture.서울_좌표; +import static com.now.naaga.common.fixture.PositionFixture.역삼역_좌표; +import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_근처_좌표; +import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_좌표; +import static com.now.naaga.common.fixture.PositionFixture.잠실역_교보문고_좌표; +import static com.now.naaga.common.fixture.PositionFixture.제주_좌표; +import static com.now.naaga.game.domain.Game.MAX_ATTEMPT_COUNT; +import static com.now.naaga.game.domain.GameStatus.DONE; +import static com.now.naaga.game.domain.GameStatus.IN_PROGRESS; +import static com.now.naaga.game.exception.GameExceptionType.ALREADY_DONE; +import static com.now.naaga.game.exception.GameExceptionType.ALREADY_IN_PROGRESS; +import static com.now.naaga.game.exception.GameExceptionType.CAN_NOT_FIND_PLACE; +import static com.now.naaga.game.exception.GameExceptionType.HINT_NOT_EXIST_IN_GAME; +import static com.now.naaga.game.exception.GameExceptionType.INACCESSIBLE_AUTHENTICATION; +import static com.now.naaga.game.exception.GameExceptionType.NOT_ARRIVED; +import static com.now.naaga.game.exception.GameExceptionType.NOT_EXIST; +import static com.now.naaga.gameresult.domain.ResultType.FAIL; +import static com.now.naaga.gameresult.domain.ResultType.SUCCESS; +import static org.assertj.core.api.SoftAssertions.assertSoftly; + import com.now.naaga.auth.domain.AuthToken; import com.now.naaga.auth.infrastructure.AuthType; import com.now.naaga.auth.infrastructure.jwt.AuthTokenGenerator; import com.now.naaga.common.CommonControllerTest; -import com.now.naaga.common.builder.*; +import com.now.naaga.common.builder.GameBuilder; +import com.now.naaga.common.builder.GameResultBuilder; +import com.now.naaga.common.builder.MemberBuilder; +import com.now.naaga.common.builder.PlaceBuilder; +import com.now.naaga.common.builder.PlayerBuilder; import com.now.naaga.common.exception.ExceptionResponse; -import com.now.naaga.game.domain.*; -import com.now.naaga.game.presentation.dto.*; +import com.now.naaga.game.domain.Direction; +import com.now.naaga.game.domain.Game; +import com.now.naaga.game.domain.GameRecord; +import com.now.naaga.game.domain.Hint; +import com.now.naaga.game.presentation.dto.CoordinateRequest; +import com.now.naaga.game.presentation.dto.EndGameRequest; +import com.now.naaga.game.presentation.dto.GameResponse; +import com.now.naaga.game.presentation.dto.GameResultResponse; +import com.now.naaga.game.presentation.dto.GameStatusResponse; +import com.now.naaga.game.presentation.dto.HintResponse; import com.now.naaga.game.repository.GameRepository; import com.now.naaga.game.repository.HintRepository; import com.now.naaga.gameresult.domain.GameResult; @@ -23,6 +56,9 @@ import io.restassured.http.ContentType; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores; @@ -31,20 +67,6 @@ import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; - -import static com.now.naaga.auth.exception.AuthExceptionType.NOT_EXIST_HEADER; -import static com.now.naaga.common.fixture.PositionFixture.*; -import static com.now.naaga.game.domain.Game.MAX_ATTEMPT_COUNT; -import static com.now.naaga.game.domain.GameStatus.DONE; -import static com.now.naaga.game.domain.GameStatus.IN_PROGRESS; -import static com.now.naaga.gameresult.domain.ResultType.FAIL; -import static com.now.naaga.gameresult.domain.ResultType.SUCCESS; -import static com.now.naaga.game.exception.GameExceptionType.*; -import static org.assertj.core.api.SoftAssertions.assertSoftly; - @SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(ReplaceUnderscores.class) class GameControllerTest extends CommonControllerTest { diff --git a/backend/src/test/java/com/now/naaga/game/presentation/StatisticControllerTest.java b/backend/src/test/java/com/now/naaga/game/presentation/StatisticControllerTest.java index 16d798e76..53808d3ea 100644 --- a/backend/src/test/java/com/now/naaga/game/presentation/StatisticControllerTest.java +++ b/backend/src/test/java/com/now/naaga/game/presentation/StatisticControllerTest.java @@ -1,5 +1,9 @@ package com.now.naaga.game.presentation; +import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_좌표; +import static com.now.naaga.common.fixture.PositionFixture.잠실역_교보문고_좌표; +import static org.assertj.core.api.SoftAssertions.assertSoftly; + import com.now.naaga.auth.domain.AuthToken; import com.now.naaga.auth.infrastructure.AuthType; import com.now.naaga.auth.infrastructure.jwt.AuthTokenGenerator; @@ -27,10 +31,6 @@ import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; -import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_좌표; -import static com.now.naaga.common.fixture.PositionFixture.잠실역_교보문고_좌표; -import static org.assertj.core.api.SoftAssertions.assertSoftly; - @SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) public class StatisticControllerTest extends CommonControllerTest { diff --git a/backend/src/test/java/com/now/naaga/gameresult/application/GameResultServiceTest.java b/backend/src/test/java/com/now/naaga/gameresult/application/GameResultServiceTest.java index 5842116a9..cc7aeb026 100644 --- a/backend/src/test/java/com/now/naaga/gameresult/application/GameResultServiceTest.java +++ b/backend/src/test/java/com/now/naaga/gameresult/application/GameResultServiceTest.java @@ -1,5 +1,11 @@ package com.now.naaga.gameresult.application; +import static com.now.naaga.game.domain.EndType.ARRIVED; +import static com.now.naaga.game.domain.GameStatus.DONE; +import static com.now.naaga.game.domain.GameStatus.IN_PROGRESS; +import static com.now.naaga.gameresult.domain.ResultType.SUCCESS; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + import com.now.naaga.common.builder.GameBuilder; import com.now.naaga.common.builder.GameResultBuilder; import com.now.naaga.common.builder.PlaceBuilder; @@ -8,11 +14,11 @@ import com.now.naaga.game.domain.Game; import com.now.naaga.game.exception.GameException; import com.now.naaga.gameresult.domain.GameResult; -import com.now.naaga.gameresult.exception.GameResultException; import com.now.naaga.gameresult.repository.GameResultRepository; import com.now.naaga.place.domain.Position; import com.now.naaga.player.domain.Player; import com.now.naaga.score.domain.Score; +import java.time.LocalDateTime; import org.assertj.core.api.SoftAssertions; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; @@ -23,14 +29,6 @@ import org.springframework.test.context.jdbc.Sql; import org.springframework.transaction.annotation.Transactional; -import java.time.LocalDateTime; - -import static com.now.naaga.game.domain.EndType.ARRIVED; -import static com.now.naaga.game.domain.GameStatus.DONE; -import static com.now.naaga.game.domain.GameStatus.IN_PROGRESS; -import static com.now.naaga.gameresult.domain.ResultType.SUCCESS; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) @Sql("/truncate.sql") @ActiveProfiles("test") diff --git a/backend/src/test/java/com/now/naaga/gameresult/repository/GameResultRepositoryTest.java b/backend/src/test/java/com/now/naaga/gameresult/repository/GameResultRepositoryTest.java index a0297933a..c4b42d429 100644 --- a/backend/src/test/java/com/now/naaga/gameresult/repository/GameResultRepositoryTest.java +++ b/backend/src/test/java/com/now/naaga/gameresult/repository/GameResultRepositoryTest.java @@ -1,5 +1,11 @@ package com.now.naaga.gameresult.repository; +import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_좌표; +import static com.now.naaga.common.fixture.PositionFixture.잠실역_교보문고_좌표; +import static com.now.naaga.game.domain.GameStatus.DONE; +import static com.now.naaga.gameresult.domain.ResultType.SUCCESS; +import static org.assertj.core.api.Assertions.assertThat; + import com.now.naaga.common.builder.GameBuilder; import com.now.naaga.common.builder.GameResultBuilder; import com.now.naaga.common.builder.PlaceBuilder; @@ -8,6 +14,7 @@ import com.now.naaga.gameresult.domain.GameResult; import com.now.naaga.place.domain.Place; import com.now.naaga.player.domain.Player; +import java.util.List; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; import org.junit.jupiter.api.Test; @@ -15,14 +22,6 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.jdbc.Sql; -import java.util.List; - -import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_좌표; -import static com.now.naaga.common.fixture.PositionFixture.잠실역_교보문고_좌표; -import static com.now.naaga.game.domain.GameStatus.DONE; -import static com.now.naaga.gameresult.domain.ResultType.SUCCESS; -import static org.assertj.core.api.Assertions.assertThat; - @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) @Sql("/truncate.sql") @SpringBootTest diff --git a/backend/src/test/java/com/now/naaga/letter/application/LetterServiceTest.java b/backend/src/test/java/com/now/naaga/letter/application/LetterServiceTest.java index f0db17471..27bf88d7f 100644 --- a/backend/src/test/java/com/now/naaga/letter/application/LetterServiceTest.java +++ b/backend/src/test/java/com/now/naaga/letter/application/LetterServiceTest.java @@ -1,5 +1,14 @@ package com.now.naaga.letter.application; +import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_좌표; +import static com.now.naaga.common.fixture.PositionFixture.잠실역_교보문고_110미터_앞_좌표; +import static com.now.naaga.common.fixture.PositionFixture.잠실역_교보문고_좌표; +import static com.now.naaga.letter.exception.LetterExceptionType.NO_EXIST; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.assertj.core.api.SoftAssertions.assertSoftly; +import static org.junit.jupiter.api.Assertions.assertThrows; + import com.now.naaga.common.builder.GameBuilder; import com.now.naaga.common.builder.LetterBuilder; import com.now.naaga.common.builder.PlaceBuilder; @@ -17,6 +26,7 @@ import com.now.naaga.place.domain.Place; import com.now.naaga.place.domain.Position; import com.now.naaga.player.domain.Player; +import java.util.List; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; @@ -27,15 +37,6 @@ import org.springframework.test.context.jdbc.Sql; import org.springframework.transaction.annotation.Transactional; -import java.util.List; - -import static com.now.naaga.common.fixture.PositionFixture.*; -import static com.now.naaga.letter.exception.LetterExceptionType.NO_EXIST; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.assertj.core.api.SoftAssertions.assertSoftly; -import static org.junit.jupiter.api.Assertions.assertThrows; - @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) @ActiveProfiles("test") @Sql("/truncate.sql") diff --git a/backend/src/test/java/com/now/naaga/letter/application/letterlog/ReadLetterLogServiceTest.java b/backend/src/test/java/com/now/naaga/letter/application/letterlog/ReadLetterLogServiceTest.java index 3c4639c67..4ddc644ef 100644 --- a/backend/src/test/java/com/now/naaga/letter/application/letterlog/ReadLetterLogServiceTest.java +++ b/backend/src/test/java/com/now/naaga/letter/application/letterlog/ReadLetterLogServiceTest.java @@ -1,5 +1,12 @@ package com.now.naaga.letter.application.letterlog; +import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_좌표; +import static com.now.naaga.common.fixture.PositionFixture.잠실역_교보문고_좌표; +import static com.now.naaga.game.exception.GameExceptionType.NOT_EXIST_IN_PROGRESS; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.SoftAssertions.assertSoftly; +import static org.junit.jupiter.api.Assertions.assertThrows; + import com.now.naaga.common.builder.GameBuilder; import com.now.naaga.common.builder.LetterBuilder; import com.now.naaga.common.builder.PlaceBuilder; @@ -13,6 +20,7 @@ import com.now.naaga.letter.repository.letterlog.ReadLetterLogRepository; import com.now.naaga.place.domain.Place; import com.now.naaga.player.domain.Player; +import java.util.List; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; import org.junit.jupiter.api.Test; @@ -20,15 +28,6 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.jdbc.Sql; -import java.util.List; - -import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_좌표; -import static com.now.naaga.common.fixture.PositionFixture.잠실역_교보문고_좌표; -import static com.now.naaga.game.exception.GameExceptionType.NOT_EXIST_IN_PROGRESS; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.SoftAssertions.assertSoftly; -import static org.junit.jupiter.api.Assertions.assertThrows; - @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) @Sql("/truncate.sql") @SpringBootTest diff --git a/backend/src/test/java/com/now/naaga/letter/presentation/LetterControllerTest.java b/backend/src/test/java/com/now/naaga/letter/presentation/LetterControllerTest.java index 3caa55b06..10326043a 100644 --- a/backend/src/test/java/com/now/naaga/letter/presentation/LetterControllerTest.java +++ b/backend/src/test/java/com/now/naaga/letter/presentation/LetterControllerTest.java @@ -1,5 +1,13 @@ package com.now.naaga.letter.presentation; +import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_좌표; +import static com.now.naaga.common.fixture.PositionFixture.잠실역_교보문고_110미터_앞_좌표; +import static com.now.naaga.common.fixture.PositionFixture.잠실역_교보문고_좌표; +import static com.now.naaga.game.domain.GameStatus.DONE; +import static com.now.naaga.game.exception.GameExceptionType.NOT_EXIST_IN_PROGRESS; +import static com.now.naaga.player.exception.PlayerExceptionType.PLAYER_NOT_FOUND; +import static org.assertj.core.api.SoftAssertions.assertSoftly; + import com.now.naaga.auth.domain.AuthToken; import com.now.naaga.auth.infrastructure.AuthType; import com.now.naaga.auth.infrastructure.jwt.AuthTokenGenerator; @@ -28,6 +36,8 @@ import io.restassured.parsing.Parser; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; +import java.time.LocalDateTime; +import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; @@ -35,16 +45,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; -import org.springframework.test.context.ActiveProfiles; - -import java.time.LocalDateTime; -import java.util.List; - -import static com.now.naaga.common.fixture.PositionFixture.*; -import static com.now.naaga.game.domain.GameStatus.DONE; -import static com.now.naaga.game.exception.GameExceptionType.NOT_EXIST_IN_PROGRESS; -import static com.now.naaga.player.exception.PlayerExceptionType.PLAYER_NOT_FOUND; -import static org.assertj.core.api.SoftAssertions.assertSoftly; @SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) diff --git a/backend/src/test/java/com/now/naaga/letter/presentation/LetterLogControllerTest.java b/backend/src/test/java/com/now/naaga/letter/presentation/LetterLogControllerTest.java index 37a98b142..350dfa22e 100644 --- a/backend/src/test/java/com/now/naaga/letter/presentation/LetterLogControllerTest.java +++ b/backend/src/test/java/com/now/naaga/letter/presentation/LetterLogControllerTest.java @@ -1,10 +1,21 @@ package com.now.naaga.letter.presentation; +import static com.now.naaga.common.exception.CommonExceptionType.INVALID_REQUEST_PARAMETERS; +import static com.now.naaga.common.fixture.PositionFixture.GS25_방이도곡점_좌표; +import static com.now.naaga.common.fixture.PositionFixture.역삼역_좌표; +import static com.now.naaga.common.fixture.PositionFixture.잠실_루터회관_정문_좌표; +import static org.assertj.core.api.SoftAssertions.assertSoftly; + import com.now.naaga.auth.domain.AuthToken; import com.now.naaga.auth.infrastructure.AuthType; import com.now.naaga.auth.infrastructure.jwt.AuthTokenGenerator; import com.now.naaga.common.CommonControllerTest; -import com.now.naaga.common.builder.*; +import com.now.naaga.common.builder.GameBuilder; +import com.now.naaga.common.builder.LetterBuilder; +import com.now.naaga.common.builder.PlaceBuilder; +import com.now.naaga.common.builder.PlayerBuilder; +import com.now.naaga.common.builder.ReadLetterLogBuilder; +import com.now.naaga.common.builder.WriteLetterLogBuilder; import com.now.naaga.common.exception.ExceptionResponse; import com.now.naaga.game.domain.Game; import com.now.naaga.letter.domain.Letter; @@ -18,6 +29,8 @@ import io.restassured.common.mapper.TypeRef; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; +import java.time.LocalDateTime; +import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; @@ -25,13 +38,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; -import java.time.LocalDateTime; -import java.util.List; - -import static com.now.naaga.common.exception.CommonExceptionType.INVALID_REQUEST_PARAMETERS; -import static com.now.naaga.common.fixture.PositionFixture.*; -import static org.assertj.core.api.SoftAssertions.assertSoftly; - @SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) class LetterLogControllerTest extends CommonControllerTest { diff --git a/backend/src/test/java/com/now/naaga/like/application/PlaceLikeServiceTest.java b/backend/src/test/java/com/now/naaga/like/application/PlaceLikeServiceTest.java index f07b242b0..f7266a748 100644 --- a/backend/src/test/java/com/now/naaga/like/application/PlaceLikeServiceTest.java +++ b/backend/src/test/java/com/now/naaga/like/application/PlaceLikeServiceTest.java @@ -5,10 +5,6 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.SoftAssertions.assertSoftly; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - import com.now.naaga.common.builder.PlaceBuilder; import com.now.naaga.common.builder.PlaceLikeBuilder; import com.now.naaga.common.builder.PlaceStatisticsBuilder; @@ -30,7 +26,6 @@ import com.now.naaga.player.domain.Player; import java.util.Optional; import org.assertj.core.api.SoftAssertions; -import java.util.Optional; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores; import org.junit.jupiter.api.Test; diff --git a/backend/src/test/java/com/now/naaga/like/domain/PlaceLikeTest.java b/backend/src/test/java/com/now/naaga/like/domain/PlaceLikeTest.java index bdd541813..d92a62d89 100644 --- a/backend/src/test/java/com/now/naaga/like/domain/PlaceLikeTest.java +++ b/backend/src/test/java/com/now/naaga/like/domain/PlaceLikeTest.java @@ -1,5 +1,9 @@ package com.now.naaga.like.domain; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.SoftAssertions.assertSoftly; +import static org.junit.jupiter.api.Assertions.assertThrows; + import com.now.naaga.common.exception.BaseExceptionType; import com.now.naaga.common.fixture.PlaceLikeFixture; import com.now.naaga.like.exception.PlaceLikeException; @@ -12,10 +16,6 @@ import org.junit.jupiter.api.Test; import org.springframework.test.context.ActiveProfiles; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.SoftAssertions.assertSoftly; -import static org.junit.jupiter.api.Assertions.assertThrows; - @ActiveProfiles("test") @SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) diff --git a/backend/src/test/java/com/now/naaga/player/application/PlayerServiceTest.java b/backend/src/test/java/com/now/naaga/player/application/PlayerServiceTest.java index 593aa8b2b..c5a24b2e8 100644 --- a/backend/src/test/java/com/now/naaga/player/application/PlayerServiceTest.java +++ b/backend/src/test/java/com/now/naaga/player/application/PlayerServiceTest.java @@ -14,8 +14,6 @@ import com.now.naaga.score.domain.Score; import java.util.ArrayList; import java.util.List; - -import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; diff --git a/backend/src/test/java/com/now/naaga/player/persistence/repository/PlayerRepositoryTest.java b/backend/src/test/java/com/now/naaga/player/persistence/repository/PlayerRepositoryTest.java index 6f554ce97..e977ebffa 100644 --- a/backend/src/test/java/com/now/naaga/player/persistence/repository/PlayerRepositoryTest.java +++ b/backend/src/test/java/com/now/naaga/player/persistence/repository/PlayerRepositoryTest.java @@ -5,13 +5,11 @@ import com.now.naaga.common.builder.PlayerBuilder; import com.now.naaga.player.domain.Player; import org.junit.jupiter.api.DisplayNameGeneration; -import org.junit.jupiter.api.DisplayNameGenerator; import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.jdbc.Sql; -import org.springframework.transaction.annotation.Transactional; @SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(ReplaceUnderscores.class) diff --git a/backend/src/test/java/com/now/naaga/player/presentation/PlayerControllerTest.java b/backend/src/test/java/com/now/naaga/player/presentation/PlayerControllerTest.java index 26a0ea32e..327c177a5 100644 --- a/backend/src/test/java/com/now/naaga/player/presentation/PlayerControllerTest.java +++ b/backend/src/test/java/com/now/naaga/player/presentation/PlayerControllerTest.java @@ -1,5 +1,9 @@ package com.now.naaga.player.presentation; +import static com.now.naaga.common.exception.CommonExceptionType.INVALID_REQUEST_PARAMETERS; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.SoftAssertions.assertSoftly; + import com.now.naaga.auth.domain.AuthToken; import com.now.naaga.auth.infrastructure.AuthType; import com.now.naaga.auth.infrastructure.jwt.AuthTokenGenerator; @@ -13,6 +17,8 @@ import io.restassured.common.mapper.TypeRef; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; +import java.time.LocalDateTime; +import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores; @@ -21,13 +27,6 @@ import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; -import java.time.LocalDateTime; -import java.util.List; - -import static com.now.naaga.common.exception.CommonExceptionType.INVALID_REQUEST_PARAMETERS; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.SoftAssertions.assertSoftly; - @SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(ReplaceUnderscores.class) public class PlayerControllerTest extends CommonControllerTest { diff --git a/backend/src/test/java/com/now/naaga/temporaryplace/presentation/TemporaryPlaceControllerTest.java b/backend/src/test/java/com/now/naaga/temporaryplace/presentation/TemporaryPlaceControllerTest.java index cfb51f20b..33182956a 100644 --- a/backend/src/test/java/com/now/naaga/temporaryplace/presentation/TemporaryPlaceControllerTest.java +++ b/backend/src/test/java/com/now/naaga/temporaryplace/presentation/TemporaryPlaceControllerTest.java @@ -1,5 +1,12 @@ package com.now.naaga.temporaryplace.presentation; +import static com.now.naaga.common.fixture.TemporaryPlaceFixture.TEMPORARY_PLACE; +import static io.restassured.RestAssured.given; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.SoftAssertions.assertSoftly; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doReturn; + import com.fasterxml.jackson.core.JsonProcessingException; import com.now.naaga.auth.domain.AuthToken; import com.now.naaga.auth.infrastructure.AuthType; @@ -17,6 +24,12 @@ import io.restassured.common.mapper.TypeRef; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.math.RoundingMode; +import java.nio.charset.StandardCharsets; +import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores; @@ -28,20 +41,6 @@ import org.springframework.test.context.ActiveProfiles; import org.springframework.web.multipart.MultipartFile; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.math.RoundingMode; -import java.nio.charset.StandardCharsets; -import java.util.List; - -import static com.now.naaga.common.fixture.TemporaryPlaceFixture.TEMPORARY_PLACE; -import static io.restassured.RestAssured.given; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.SoftAssertions.assertSoftly; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doReturn; - @SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(ReplaceUnderscores.class) @ActiveProfiles("test")