From 9e75d2e1a189cbbcc18ac1e7903fc4bf3d5f9f50 Mon Sep 17 00:00:00 2001 From: itavita08 Date: Tue, 14 May 2024 20:44:47 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20main=20path=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?=EB=B0=8F=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20=EC=BF=BC?= =?UTF-8?q?=EB=A6=AC=EB=AC=B8=20=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - main path를 search/main으로 수정 후 태그도 serach 태그 적용 - 카테고리 필터 시 잘못된 쿼리로 정상적으로 작동 x -> 수정 --- .../domain/guideProduct/api/GuideProductController.java | 4 ++-- .../domain/guideProduct/application/GuideProductService.java | 3 ++- .../guideProduct/domain/GuideProductCustomRepositoryImpl.java | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/swygbro/trip/backend/domain/guideProduct/api/GuideProductController.java b/src/main/java/com/swygbro/trip/backend/domain/guideProduct/api/GuideProductController.java index 5587070..d2b6d8e 100644 --- a/src/main/java/com/swygbro/trip/backend/domain/guideProduct/api/GuideProductController.java +++ b/src/main/java/com/swygbro/trip/backend/domain/guideProduct/api/GuideProductController.java @@ -33,7 +33,7 @@ public class GuideProductController { private final GuideProductService guideProductService; - @GetMapping() + @GetMapping("/search/main") @Operation(summary = "메인 페이지", description = """ # 메인 페이지 @@ -53,7 +53,7 @@ public class GuideProductController { ## 응답 - 상품 등록 성공 시 `200` 코드와 함께 메인 페이지 정보를 json 형태로 반환합니다. - """, tags = "Main Page") + """, tags = "Search Guide Products") @ApiResponse( responseCode = "200", description = "메인페이지 조회 성공", diff --git a/src/main/java/com/swygbro/trip/backend/domain/guideProduct/application/GuideProductService.java b/src/main/java/com/swygbro/trip/backend/domain/guideProduct/application/GuideProductService.java index 1e07070..887426e 100644 --- a/src/main/java/com/swygbro/trip/backend/domain/guideProduct/application/GuideProductService.java +++ b/src/main/java/com/swygbro/trip/backend/domain/guideProduct/application/GuideProductService.java @@ -96,7 +96,8 @@ public GuideProductDto getProduct(Long productId) { // 가이드 상품 수정 @Transactional - public GuideProductDto modifyGuideProduct(User user, Long productId, ModifyGuideProductRequest edits, Optional modifyThumb, Optional> modifyImages) { + public GuideProductDto modifyGuideProduct(User user, Long productId, ModifyGuideProductRequest edits, + Optional modifyThumb, Optional> modifyImages) { GuideProduct product = guideProductRepository.findById(productId).orElseThrow(() -> new GuideProductNotFoundException(productId)); if (product.getUser() != user) throw new MismatchUserFromCreatorException("가이드 상품을 수정할 권한이 없습니다."); diff --git a/src/main/java/com/swygbro/trip/backend/domain/guideProduct/domain/GuideProductCustomRepositoryImpl.java b/src/main/java/com/swygbro/trip/backend/domain/guideProduct/domain/GuideProductCustomRepositoryImpl.java index edc141c..133a069 100644 --- a/src/main/java/com/swygbro/trip/backend/domain/guideProduct/domain/GuideProductCustomRepositoryImpl.java +++ b/src/main/java/com/swygbro/trip/backend/domain/guideProduct/domain/GuideProductCustomRepositoryImpl.java @@ -164,7 +164,9 @@ private BooleanExpression categoryIn(MultiPolygon region, SearchCategoriesReques } else if (request.getCategory() == GuideCategoryCode.BEST) return Expressions.booleanTemplate("ST_CONTAINS({0}, {1})", region, qProduct.location); - else return qCategory.categoryCode.eq(request.getCategory()); + else return qProduct.id.in(jpaQueryFactory.select(qCategory.product.id) + .from(qCategory) + .where(qCategory.categoryCode.eq(request.getCategory()))); } return null; }