From 3e1d5a5223e2d721e1103b67e0a55614bef8fb5e Mon Sep 17 00:00:00 2001 From: GaBaljaintheroom Date: Sat, 8 Jun 2024 02:11:21 +0900 Subject: [PATCH 1/8] =?UTF-8?q?fix=20:=20=ED=8C=A8=ED=82=A4=EC=A7=80=20?= =?UTF-8?q?=EA=B5=AC=EC=84=B1=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../capsule/CapsuleQueryRepository.java | 31 +++++++++++++++++++ .../CapsuleQueryRepositoryImpl.java} | 12 +++---- .../{ => capsule}/CapsuleRepository.java | 4 +-- .../image/ImageQueryRepository.java | 9 ++++++ .../ImageQueryRepositoryImpl.java} | 4 +-- .../{ => image}/ImageRepository.java | 4 +-- .../video/VideoQueryRepository.java | 10 ++++++ .../VideoQueryRepositoryImpl.java} | 4 +-- .../{ => video}/VideoRepository.java | 4 +-- .../service/CapsuleService.java | 12 +++---- .../generic_capsule/service/ImageService.java | 6 ++-- .../generic_capsule/service/VideoService.java | 6 ++-- .../service/GroupCapsuleService.java | 2 +- .../CapsuleQueryRepositoryTest.java | 4 ++- .../service/GroupCapsuleServiceTest.java | 2 +- .../repository/MediaQueryRepositoryTest.java | 10 +++--- 16 files changed, 88 insertions(+), 36 deletions(-) create mode 100644 backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/capsule/CapsuleQueryRepository.java rename backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/{CapsuleQueryRepository.java => capsule/CapsuleQueryRepositoryImpl.java} (96%) rename backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/{ => capsule}/CapsuleRepository.java (96%) create mode 100644 backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/image/ImageQueryRepository.java rename backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/{ImageQueryRepository.java => image/ImageQueryRepositoryImpl.java} (94%) rename backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/{ => image}/ImageRepository.java (85%) create mode 100644 backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/video/VideoQueryRepository.java rename backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/{VideoQueryRepository.java => video/VideoQueryRepositoryImpl.java} (94%) rename backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/{ => video}/VideoRepository.java (85%) diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/capsule/CapsuleQueryRepository.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/capsule/CapsuleQueryRepository.java new file mode 100644 index 000000000..5b82ab35e --- /dev/null +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/capsule/CapsuleQueryRepository.java @@ -0,0 +1,31 @@ +package site.timecapsulearchive.core.domain.capsule.generic_capsule.repository.capsule; + +import java.util.List; +import org.locationtech.jts.geom.Polygon; +import site.timecapsulearchive.core.domain.capsule.entity.CapsuleType; +import site.timecapsulearchive.core.domain.capsule.generic_capsule.data.dto.NearbyARCapsuleSummaryDto; +import site.timecapsulearchive.core.domain.capsule.generic_capsule.data.dto.NearbyCapsuleSummaryDto; + +public interface CapsuleQueryRepository { + List findARCapsuleSummaryDtosByCurrentLocationAndCapsuleType( + final Long memberId, + final Polygon mbr, + final CapsuleType capsuleType + ); + + List findCapsuleSummaryDtosByCurrentLocationAndCapsuleType( + final Long memberId, + final Polygon mbr, + final CapsuleType capsuleType + ); + + List findFriendsCapsuleSummaryDtosByCurrentLocationAndCapsuleType( + final List friendIds, + final Polygon mbr + ); + + List findFriendsARCapsulesByCurrentLocation( + final List friendIds, + final Polygon mbr + ); +} diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/CapsuleQueryRepository.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/capsule/CapsuleQueryRepositoryImpl.java similarity index 96% rename from backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/CapsuleQueryRepository.java rename to backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/capsule/CapsuleQueryRepositoryImpl.java index 700a7d637..0942ed27e 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/CapsuleQueryRepository.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/capsule/CapsuleQueryRepositoryImpl.java @@ -1,4 +1,4 @@ -package site.timecapsulearchive.core.domain.capsule.generic_capsule.repository; +package site.timecapsulearchive.core.domain.capsule.generic_capsule.repository.capsule; import static site.timecapsulearchive.core.domain.capsule.entity.QCapsule.capsule; import static site.timecapsulearchive.core.domain.capsuleskin.entity.QCapsuleSkin.capsuleSkin; @@ -20,7 +20,7 @@ @Repository @RequiredArgsConstructor -public class CapsuleQueryRepository { +public class CapsuleQueryRepositoryImpl implements CapsuleQueryRepository { private final JPAQueryFactory jpaQueryFactory; @@ -104,8 +104,8 @@ public List findCapsuleSummaryDtosByCurrentLocationAndC * @return 범위 내에 조회된 캡슐들의 요약 정보들을 반환한다. */ public List findFriendsCapsuleSummaryDtosByCurrentLocationAndCapsuleType( - List friendIds, - Polygon mbr + final List friendIds, + final Polygon mbr ) { return jpaQueryFactory .select( @@ -136,8 +136,8 @@ private BooleanExpression ST_Contains(Polygon mbr, ComparablePath point) * @return 범위 내에 조회된 캡슐들의 요약 정보들을 반환한다. */ public List findFriendsARCapsulesByCurrentLocation( - List friendIds, - Polygon mbr + final List friendIds, + final Polygon mbr ) { return jpaQueryFactory .select( diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/CapsuleRepository.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/capsule/CapsuleRepository.java similarity index 96% rename from backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/CapsuleRepository.java rename to backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/capsule/CapsuleRepository.java index 788197a56..c0cb84b1c 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/CapsuleRepository.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/capsule/CapsuleRepository.java @@ -1,4 +1,4 @@ -package site.timecapsulearchive.core.domain.capsule.generic_capsule.repository; +package site.timecapsulearchive.core.domain.capsule.generic_capsule.repository.capsule; import java.util.Optional; import org.springframework.data.jpa.repository.Modifying; @@ -7,7 +7,7 @@ import org.springframework.data.repository.query.Param; import site.timecapsulearchive.core.domain.capsule.entity.Capsule; -public interface CapsuleRepository extends Repository { +public interface CapsuleRepository extends Repository, CapsuleQueryRepository { Capsule save(Capsule capsule); diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/image/ImageQueryRepository.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/image/ImageQueryRepository.java new file mode 100644 index 000000000..4db15a1da --- /dev/null +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/image/ImageQueryRepository.java @@ -0,0 +1,9 @@ +package site.timecapsulearchive.core.domain.capsule.generic_capsule.repository.image; + +import java.util.List; +import site.timecapsulearchive.core.domain.capsule.entity.Image; + +public interface ImageQueryRepository { + + void bulkSave(final List images); +} diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/ImageQueryRepository.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/image/ImageQueryRepositoryImpl.java similarity index 94% rename from backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/ImageQueryRepository.java rename to backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/image/ImageQueryRepositoryImpl.java index 6148f5377..ccd86258d 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/ImageQueryRepository.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/image/ImageQueryRepositoryImpl.java @@ -1,4 +1,4 @@ -package site.timecapsulearchive.core.domain.capsule.generic_capsule.repository; +package site.timecapsulearchive.core.domain.capsule.generic_capsule.repository.image; import java.sql.PreparedStatement; import java.sql.SQLException; @@ -14,7 +14,7 @@ @Repository @RequiredArgsConstructor -public class ImageQueryRepository { +public class ImageQueryRepositoryImpl implements ImageQueryRepository { private final JdbcTemplate jdbcTemplate; diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/ImageRepository.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/image/ImageRepository.java similarity index 85% rename from backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/ImageRepository.java rename to backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/image/ImageRepository.java index 2c8478ce6..f83a05c4c 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/ImageRepository.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/image/ImageRepository.java @@ -1,9 +1,9 @@ -package site.timecapsulearchive.core.domain.capsule.generic_capsule.repository; +package site.timecapsulearchive.core.domain.capsule.generic_capsule.repository.image; import org.springframework.data.repository.Repository; import site.timecapsulearchive.core.domain.capsule.entity.Image; -public interface ImageRepository extends Repository { +public interface ImageRepository extends Repository, ImageQueryRepository { void save(Image newImage); } diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/video/VideoQueryRepository.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/video/VideoQueryRepository.java new file mode 100644 index 000000000..8acfe6026 --- /dev/null +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/video/VideoQueryRepository.java @@ -0,0 +1,10 @@ +package site.timecapsulearchive.core.domain.capsule.generic_capsule.repository.video; + +import java.util.List; +import org.springframework.data.repository.Repository; +import site.timecapsulearchive.core.domain.capsule.entity.Video; + +public interface VideoQueryRepository { + + void bulkSave(final List