From 6f783b535cc46cb0db3807f0ad20e01e83070e7c Mon Sep 17 00:00:00 2001 From: You-Hyuk Date: Fri, 1 Aug 2025 16:13:50 +0900 Subject: [PATCH 01/16] =?UTF-8?q?fix:=20=EC=A7=80=EB=8F=84=20API=20?= =?UTF-8?q?=EA=B2=80=EC=83=89=20=EA=B8=B0=EB=A1=9D=20=EC=A4=91=EB=B3=B5=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search/dao/OwnedMenuSearchRepository.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/ourmenu/backend/domain/search/dao/OwnedMenuSearchRepository.java b/src/main/java/com/ourmenu/backend/domain/search/dao/OwnedMenuSearchRepository.java index 69e6ff54..f4a7508b 100644 --- a/src/main/java/com/ourmenu/backend/domain/search/dao/OwnedMenuSearchRepository.java +++ b/src/main/java/com/ourmenu/backend/domain/search/dao/OwnedMenuSearchRepository.java @@ -4,8 +4,20 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; public interface OwnedMenuSearchRepository extends JpaRepository { - Page findByUserId(Long userId, Pageable pageable); + @Query(""" + SELECT oms + FROM OwnedMenuSearch oms + WHERE oms.id IN ( + SELECT MIN(o.id) + FROM OwnedMenuSearch o + WHERE o.userId = :userId + GROUP BY o.menuTitle + ) + """) + Page findByUserId(@Param("userId") Long userId, Pageable pageable); } From be9124b291fec97892be9eee4015525942186753 Mon Sep 17 00:00:00 2001 From: You-Hyuk Date: Fri, 1 Aug 2025 16:30:38 +0900 Subject: [PATCH 02/16] =?UTF-8?q?refactor:=20=EC=9C=A0=EC=A0=80=20?= =?UTF-8?q?=EA=B2=80=EC=A6=9D=20=EB=A1=9C=EC=A7=81=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/domain/menu/application/MapService.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java b/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java index f69866f7..a7ccf10f 100644 --- a/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java +++ b/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java @@ -60,8 +60,6 @@ public class MapService { * @return */ public List findMenusOnMap(Long userId) { - User user = userRepository.findById(userId) - .orElseThrow(NotFoundUserException::new); List menus = menuRepository.findMenusByUserId(userId); java.util.Map> menuMaps = menus.stream() @@ -99,9 +97,6 @@ public List findMenuOnMap(Long mapId, Long userId) { * @return */ public List findSearchResultOnMap(String title, double mapX, double mapY, Long userId) { - User user = userRepository.findById(userId) - .orElseThrow(NotFoundUserException::new); - GeometryFactory geometryFactory = new GeometryFactory(new PrecisionModel(), 4326); Point userLocation = geometryFactory.createPoint(new Coordinate(mapX, mapY)); @@ -122,9 +117,6 @@ public List findSearchResultOnMap(String title, double mapX, doubl * @return */ public List findSearchHistoryOnMap(Long userId) { - User user = userRepository.findById(userId) - .orElseThrow(NotFoundUserException::new); - Pageable pageable = PageRequest.of( 0, 10, @@ -148,9 +140,6 @@ public List findSearchHistoryOnMap(Long userId) { */ @Transactional public MenuInfoOnMapDto findMenuByMenuIdOnMap(Long menuId, Long userId) { - User user = userRepository.findById(userId) - .orElseThrow(NotFoundUserException::new); - Menu menu = menuRepository.findByIdAndUserId(menuId, userId) .orElseThrow(NotFoundMenuException::new); From 982480409891dff4dc84fe5652ae575eecece67b Mon Sep 17 00:00:00 2001 From: You-Hyuk Date: Fri, 1 Aug 2025 17:17:07 +0900 Subject: [PATCH 03/16] =?UTF-8?q?fix:=20=EA=B2=80=EC=83=89=20=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=20=EB=A1=9C=EC=A7=81=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/domain/menu/application/MapService.java | 8 ++++++++ .../backend/domain/menu/dao/MenuRepository.java | 9 ++++++++- .../domain/search/dao/OwnedMenuSearchRepository.java | 11 +++++------ .../backend/domain/store/dao/MapRepository.java | 7 +++++++ 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java b/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java index f69866f7..155cfc23 100644 --- a/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java +++ b/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java @@ -25,6 +25,7 @@ import com.ourmenu.backend.domain.user.exception.NotFoundUserException; import java.util.Comparator; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -187,6 +188,13 @@ private MenuInfoOnMapDto getMenuInfo(Menu menu) { * @param menu */ private void saveOwnedMenuSearchHistory(Long userId, Menu menu) { + Optional searchHistory = ownedMenuSearchRepository.findByUserIdAndMenuId(userId, menu.getId()); + + if (searchHistory.isPresent()) { + searchHistory.get().updateModifiedAt(); + return; + } + OwnedMenuSearch ownedMenuSearch = OwnedMenuSearch.builder() .menuId(menu.getId()) .menuTitle(menu.getTitle()) diff --git a/src/main/java/com/ourmenu/backend/domain/menu/dao/MenuRepository.java b/src/main/java/com/ourmenu/backend/domain/menu/dao/MenuRepository.java index c0eeff4b..83f35735 100644 --- a/src/main/java/com/ourmenu/backend/domain/menu/dao/MenuRepository.java +++ b/src/main/java/com/ourmenu/backend/domain/menu/dao/MenuRepository.java @@ -19,7 +19,14 @@ public interface MenuRepository extends JpaRepository { boolean existsByStore(Store store); - List findMenusByUserId(Long userId); + @Query(""" + SELECT m + FROM Menu m + JOIN FETCH m.store s + JOIN FETCH s.map map + WHERE m.userId = :userId + """) + List findMenusByUserId(@Param("userId") Long userId); List findMenusByStoreIdAndUserId(Long storeId, Long userId); diff --git a/src/main/java/com/ourmenu/backend/domain/search/dao/OwnedMenuSearchRepository.java b/src/main/java/com/ourmenu/backend/domain/search/dao/OwnedMenuSearchRepository.java index f4a7508b..afa08630 100644 --- a/src/main/java/com/ourmenu/backend/domain/search/dao/OwnedMenuSearchRepository.java +++ b/src/main/java/com/ourmenu/backend/domain/search/dao/OwnedMenuSearchRepository.java @@ -7,17 +7,16 @@ import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; +import java.util.Optional; + public interface OwnedMenuSearchRepository extends JpaRepository { @Query(""" SELECT oms FROM OwnedMenuSearch oms - WHERE oms.id IN ( - SELECT MIN(o.id) - FROM OwnedMenuSearch o - WHERE o.userId = :userId - GROUP BY o.menuTitle - ) + WHERE oms.userId = :userId """) Page findByUserId(@Param("userId") Long userId, Pageable pageable); + + Optional findByUserIdAndMenuId(Long userId, Long menuId); } diff --git a/src/main/java/com/ourmenu/backend/domain/store/dao/MapRepository.java b/src/main/java/com/ourmenu/backend/domain/store/dao/MapRepository.java index 8c93c2d2..6e4f199e 100644 --- a/src/main/java/com/ourmenu/backend/domain/store/dao/MapRepository.java +++ b/src/main/java/com/ourmenu/backend/domain/store/dao/MapRepository.java @@ -5,6 +5,7 @@ import org.locationtech.jts.geom.Point; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; @Repository @@ -12,5 +13,11 @@ public interface MapRepository extends JpaRepository { Optional findByLocation(Point location); + @Query(""" + SELECT mp + FROM Map mp + JOIN FETCH mp.stores st + WHERE mp.id = :mapId + """) Optional findMapById(Long mapId); } From 27d319bf5e28971e023d4905cdc04ecc38035a2e Mon Sep 17 00:00:00 2001 From: You-Hyuk Date: Fri, 1 Aug 2025 17:58:58 +0900 Subject: [PATCH 04/16] =?UTF-8?q?refactor:=20N+1=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/menu/dao/MenuRepository.java | 42 ++++++++++--------- .../domain/store/dao/MapRepository.java | 7 ++++ 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/ourmenu/backend/domain/menu/dao/MenuRepository.java b/src/main/java/com/ourmenu/backend/domain/menu/dao/MenuRepository.java index c0eeff4b..86840d41 100644 --- a/src/main/java/com/ourmenu/backend/domain/menu/dao/MenuRepository.java +++ b/src/main/java/com/ourmenu/backend/domain/menu/dao/MenuRepository.java @@ -19,6 +19,13 @@ public interface MenuRepository extends JpaRepository { boolean existsByStore(Store store); + @Query(""" + SELECT m + FROM Menu m + JOIN FETCH m.store s + JOIN FETCH s.map map + WHERE m.userId = :userId + """) List findMenusByUserId(Long userId); List findMenusByStoreIdAndUserId(Long storeId, Long userId); @@ -27,8 +34,6 @@ public interface MenuRepository extends JpaRepository { Optional findByIdAndUserId(Long menuId, Long userId); - List findByUserIdAndStoreId(Long userId, Long storeId); - int countByUserId(Long userId); @Query(value = """ @@ -264,23 +269,20 @@ List findByUserIdAndTag(@Param("userId") Long userId, @Param("tag") String tag, Pageable pageable); - @Query( - value = "SELECT m.* FROM menu m " + - "JOIN store s ON m.store_id = s.id " + - "JOIN map ON s.map_id = map.id " + - "WHERE m.user_id = :userId " + - "AND LOWER(m.title) LIKE CONCAT('%', LOWER(:title), '%') " + - "ORDER BY ST_Distance_Sphere(map.location, :userLocation) ASC", - countQuery = "SELECT COUNT(*) FROM menu m " + - "JOIN store s ON m.store_id = s.id " + - "JOIN map ON s.map_id = map.id " + - "WHERE m.user_id = :userId " + - "AND LOWER(m.title) LIKE CONCAT('%', LOWER(:title), '%')", - nativeQuery = true - ) - Page findByUserIdTitleContainingOrderByDistance(@Param("userId") Long userId, - @Param("title") String title, - @Param("userLocation") Point userLocation, - Pageable pageable); + @Query(""" + SELECT m + FROM Menu m + JOIN FETCH m.store s + JOIN FETCH s.map map + WHERE m.userId = :userId + AND LOWER(m.title) LIKE CONCAT('%', LOWER(:title), '%') + ORDER BY ST_Distance_Sphere(map.location, :userLocation) ASC + """) + List findByUserIdTitleContainingOrderByDistance( + @Param("userId") Long userId, + @Param("title") String title, + @Param("userLocation") Point userLocation, + Pageable pageable + ); } diff --git a/src/main/java/com/ourmenu/backend/domain/store/dao/MapRepository.java b/src/main/java/com/ourmenu/backend/domain/store/dao/MapRepository.java index 8c93c2d2..d7cd045e 100644 --- a/src/main/java/com/ourmenu/backend/domain/store/dao/MapRepository.java +++ b/src/main/java/com/ourmenu/backend/domain/store/dao/MapRepository.java @@ -5,6 +5,7 @@ import org.locationtech.jts.geom.Point; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; @Repository @@ -12,5 +13,11 @@ public interface MapRepository extends JpaRepository { Optional findByLocation(Point location); + @Query(""" + SELECT m + FROM Map m + JOIN FETCH m.stores s + WHERE m.id = :mapId + """) Optional findMapById(Long mapId); } From 79daa7588379da600d47891c78463d7040bb825b Mon Sep 17 00:00:00 2001 From: You-Hyuk Date: Fri, 1 Aug 2025 18:01:30 +0900 Subject: [PATCH 05/16] =?UTF-8?q?refactor:=20=EB=B0=98=ED=99=98=20?= =?UTF-8?q?=ED=83=80=EC=9E=85=20Page=20->=20List=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/domain/menu/application/MapService.java | 8 +++----- .../domain/search/dao/OwnedMenuSearchRepository.java | 5 +++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java b/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java index a7ccf10f..5a10a8bd 100644 --- a/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java +++ b/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java @@ -102,7 +102,7 @@ public List findSearchResultOnMap(String title, double mapX, doubl PageRequest pageRequest = PageRequest.of(0, 10); - Page menusByUserIdOrderByDistance = + List menusByUserIdOrderByDistance = menuRepository.findByUserIdTitleContainingOrderByDistance(userId, title, userLocation, pageRequest); return menusByUserIdOrderByDistance.stream() @@ -118,12 +118,10 @@ public List findSearchResultOnMap(String title, double mapX, doubl */ public List findSearchHistoryOnMap(Long userId) { Pageable pageable = PageRequest.of( - 0, - 10, - Sort.by(Sort.Direction.DESC, "modifiedAt") + 0, 10, Sort.by(Sort.Direction.DESC, "modifiedAt") ); - Page searchHistoryPage = ownedMenuSearchRepository + List searchHistoryPage = ownedMenuSearchRepository .findByUserId(userId, pageable); return searchHistoryPage.stream() diff --git a/src/main/java/com/ourmenu/backend/domain/search/dao/OwnedMenuSearchRepository.java b/src/main/java/com/ourmenu/backend/domain/search/dao/OwnedMenuSearchRepository.java index 69e6ff54..032fcec1 100644 --- a/src/main/java/com/ourmenu/backend/domain/search/dao/OwnedMenuSearchRepository.java +++ b/src/main/java/com/ourmenu/backend/domain/search/dao/OwnedMenuSearchRepository.java @@ -1,11 +1,12 @@ package com.ourmenu.backend.domain.search.dao; import com.ourmenu.backend.domain.search.domain.OwnedMenuSearch; -import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; +import java.util.List; + public interface OwnedMenuSearchRepository extends JpaRepository { - Page findByUserId(Long userId, Pageable pageable); + List findByUserId(Long userId, Pageable pageable); } From 37d8bcc084d6720285a95a0331b436cbc18853c3 Mon Sep 17 00:00:00 2001 From: You-Hyuk Date: Fri, 1 Aug 2025 18:12:22 +0900 Subject: [PATCH 06/16] =?UTF-8?q?chore:=20=EC=BD=94=EB=93=9C=20=EC=A0=95?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ourmenu/backend/domain/menu/application/MapService.java | 5 ----- .../ourmenu/backend/domain/user/application/UserService.java | 1 - 2 files changed, 6 deletions(-) diff --git a/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java b/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java index 5a10a8bd..066eeb71 100644 --- a/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java +++ b/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java @@ -20,9 +20,6 @@ import com.ourmenu.backend.domain.store.domain.Map; import com.ourmenu.backend.domain.tag.dao.MenuTagRepository; import com.ourmenu.backend.domain.tag.domain.MenuTag; -import com.ourmenu.backend.domain.user.dao.UserRepository; -import com.ourmenu.backend.domain.user.domain.User; -import com.ourmenu.backend.domain.user.exception.NotFoundUserException; import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; @@ -32,7 +29,6 @@ import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.geom.Point; import org.locationtech.jts.geom.PrecisionModel; -import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; @@ -45,7 +41,6 @@ public class MapService { private final MenuRepository menuRepository; - private final UserRepository userRepository; private final MapRepository mapRepository; private final MenuTagRepository menuTagRepository; private final MenuImgRepository menuImgRepository; diff --git a/src/main/java/com/ourmenu/backend/domain/user/application/UserService.java b/src/main/java/com/ourmenu/backend/domain/user/application/UserService.java index 7638d15a..2a73efe5 100644 --- a/src/main/java/com/ourmenu/backend/domain/user/application/UserService.java +++ b/src/main/java/com/ourmenu/backend/domain/user/application/UserService.java @@ -23,7 +23,6 @@ import com.ourmenu.backend.domain.user.exception.NotMatchPasswordException; import com.ourmenu.backend.domain.user.exception.NotMatchTokenException; import com.ourmenu.backend.domain.user.exception.TokenExpiredExcpetion; -import com.ourmenu.backend.domain.user.exception.UnsupportedSignInTypeException; import com.ourmenu.backend.global.util.JwtTokenProvider; import jakarta.servlet.http.HttpServletRequest; From 3f849cfedf8d4cdd0df263067b4cd16b4311386e Mon Sep 17 00:00:00 2001 From: You-Hyuk Date: Thu, 7 Aug 2025 17:01:27 +0900 Subject: [PATCH 07/16] =?UTF-8?q?fix:=20=EB=84=A4=EC=9D=B4=ED=8B=B0?= =?UTF-8?q?=EB=B8=8C=20=EC=BF=BC=EB=A6=AC=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/menu/dao/MenuRepository.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/ourmenu/backend/domain/menu/dao/MenuRepository.java b/src/main/java/com/ourmenu/backend/domain/menu/dao/MenuRepository.java index 86840d41..84d98ec6 100644 --- a/src/main/java/com/ourmenu/backend/domain/menu/dao/MenuRepository.java +++ b/src/main/java/com/ourmenu/backend/domain/menu/dao/MenuRepository.java @@ -269,15 +269,15 @@ List findByUserIdAndTag(@Param("userId") Long userId, @Param("tag") String tag, Pageable pageable); - @Query(""" - SELECT m - FROM Menu m - JOIN FETCH m.store s - JOIN FETCH s.map map - WHERE m.userId = :userId - AND LOWER(m.title) LIKE CONCAT('%', LOWER(:title), '%') - ORDER BY ST_Distance_Sphere(map.location, :userLocation) ASC - """) + @Query(value = """ + SELECT m.* + FROM menu m + JOIN store s ON m.store_id = s.id + JOIN map ON s.map_id = map.id + WHERE m.user_id = :userId + AND LOWER(m.title) LIKE CONCAT('%', LOWER(:title), '%') + ORDER BY ST_Distance_Sphere(map.location, :userLocation) ASC + """, nativeQuery = true) List findByUserIdTitleContainingOrderByDistance( @Param("userId") Long userId, @Param("title") String title, From 450cd2caef7cb7171ccfc5eb482d9883a60548d6 Mon Sep 17 00:00:00 2001 From: You-Hyuk Date: Thu, 14 Aug 2025 17:59:50 +0900 Subject: [PATCH 08/16] =?UTF-8?q?fix:=20Response=20mapId=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ourmenu/backend/domain/menu/dto/MapSearchDto.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/ourmenu/backend/domain/menu/dto/MapSearchDto.java b/src/main/java/com/ourmenu/backend/domain/menu/dto/MapSearchDto.java index 75d818fc..0a62ff8b 100644 --- a/src/main/java/com/ourmenu/backend/domain/menu/dto/MapSearchDto.java +++ b/src/main/java/com/ourmenu/backend/domain/menu/dto/MapSearchDto.java @@ -12,12 +12,14 @@ @AllArgsConstructor(access = AccessLevel.PRIVATE) public class MapSearchDto { + private Long mapId; private String menuTitle; private String storeTitle; private String storeAddress; public static MapSearchDto from(Menu menu){ return MapSearchDto.builder() + .mapId(menu.getStore().getMap().getId()) .menuTitle(menu.getTitle()) .storeTitle(menu.getStore().getTitle()) .storeAddress(menu.getStore().getAddress()) From 147e462246dca4e754837ad75473ee480aade5c2 Mon Sep 17 00:00:00 2001 From: You-Hyuk Date: Thu, 14 Aug 2025 18:01:04 +0900 Subject: [PATCH 09/16] =?UTF-8?q?feat:=20OwnedMenuSearch=20mapId=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- infra/sql/ddl.sql | 1 + .../ourmenu/backend/domain/search/domain/OwnedMenuSearch.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/infra/sql/ddl.sql b/infra/sql/ddl.sql index 997b8a4a..b552128c 100644 --- a/infra/sql/ddl.sql +++ b/infra/sql/ddl.sql @@ -107,6 +107,7 @@ create table owned_menu_search ( menu_id bigint not null, modified_at datetime(6), user_id bigint not null, + map_id bigint not null, menu_title varchar(255) not null, store_address varchar(255) not null, store_title varchar(255) not null, diff --git a/src/main/java/com/ourmenu/backend/domain/search/domain/OwnedMenuSearch.java b/src/main/java/com/ourmenu/backend/domain/search/domain/OwnedMenuSearch.java index 223cf16f..521c6178 100644 --- a/src/main/java/com/ourmenu/backend/domain/search/domain/OwnedMenuSearch.java +++ b/src/main/java/com/ourmenu/backend/domain/search/domain/OwnedMenuSearch.java @@ -40,4 +40,6 @@ public class OwnedMenuSearch extends BaseEntity { @NotNull private Long userId; + + private Long mapId; } From d672481185a1bec44133dc7c733e54443724d3f2 Mon Sep 17 00:00:00 2001 From: You-Hyuk Date: Thu, 14 Aug 2025 18:01:47 +0900 Subject: [PATCH 10/16] =?UTF-8?q?del:=20validation=20=EC=96=B4=EB=85=B8?= =?UTF-8?q?=ED=85=8C=EC=9D=B4=EC=85=98=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/domain/search/domain/OwnedMenuSearch.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/main/java/com/ourmenu/backend/domain/search/domain/OwnedMenuSearch.java b/src/main/java/com/ourmenu/backend/domain/search/domain/OwnedMenuSearch.java index 521c6178..e8aa9318 100644 --- a/src/main/java/com/ourmenu/backend/domain/search/domain/OwnedMenuSearch.java +++ b/src/main/java/com/ourmenu/backend/domain/search/domain/OwnedMenuSearch.java @@ -6,8 +6,6 @@ import jakarta.persistence.GenerationType; import jakarta.persistence.Id; import jakarta.persistence.Table; -import jakarta.validation.constraints.NotNull; -import java.time.LocalDateTime; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Builder; @@ -26,19 +24,14 @@ public class OwnedMenuSearch extends BaseEntity { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; - @NotNull private Long menuId; - @NotNull private String menuTitle; - @NotNull private String storeTitle; - @NotNull private String storeAddress; - @NotNull private Long userId; private Long mapId; From 34373f2c887eb87ce11441da0dfc0b606d135463 Mon Sep 17 00:00:00 2001 From: You-Hyuk Date: Thu, 14 Aug 2025 18:19:16 +0900 Subject: [PATCH 11/16] =?UTF-8?q?fix:=20=EA=B2=80=EC=83=89=20=EB=B0=8F=20?= =?UTF-8?q?=EA=B2=80=EC=83=89=EA=B8=B0=EB=A1=9D=20DTO=20=ED=86=B5=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ourmenu/backend/domain/menu/api/MapController.java | 5 ++--- .../ourmenu/backend/domain/menu/application/MapService.java | 6 +++--- .../com/ourmenu/backend/domain/menu/dto/MapSearchDto.java | 4 ++++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/ourmenu/backend/domain/menu/api/MapController.java b/src/main/java/com/ourmenu/backend/domain/menu/api/MapController.java index c15e6451..9b839b4d 100644 --- a/src/main/java/com/ourmenu/backend/domain/menu/api/MapController.java +++ b/src/main/java/com/ourmenu/backend/domain/menu/api/MapController.java @@ -2,7 +2,6 @@ import com.ourmenu.backend.domain.menu.application.MapService; import com.ourmenu.backend.domain.menu.dto.MapSearchDto; -import com.ourmenu.backend.domain.menu.dto.MapSearchHistoryDto; import com.ourmenu.backend.domain.menu.dto.MenuInfoOnMapDto; import com.ourmenu.backend.domain.menu.dto.MenuOnMapDto; import com.ourmenu.backend.domain.user.domain.CustomUserDetails; @@ -62,9 +61,9 @@ public ApiResponse findMenuInfoByMenuId(@PathVariable Long men @Operation(summary = "지도 검색 기록 조회", description = "지도에서 식당 검색 기록을 조회한다.") @GetMapping("/maps/search-history") - public ApiResponse> findSearchHistoryOnMap( + public ApiResponse> findSearchHistoryOnMap( @AuthenticationPrincipal CustomUserDetails userDetails) { - List response = mapService.findSearchHistoryOnMap(userDetails.getId()); + List response = mapService.findSearchHistoryOnMap(userDetails.getId()); return ApiUtil.success(response); } } diff --git a/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java b/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java index 51016535..f4a1b1be 100644 --- a/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java +++ b/src/main/java/com/ourmenu/backend/domain/menu/application/MapService.java @@ -8,7 +8,6 @@ import com.ourmenu.backend.domain.menu.domain.MenuFolder; import com.ourmenu.backend.domain.menu.domain.MenuImg; import com.ourmenu.backend.domain.menu.dto.MapSearchDto; -import com.ourmenu.backend.domain.menu.dto.MapSearchHistoryDto; import com.ourmenu.backend.domain.menu.dto.MenuFolderInfoOnMapDto; import com.ourmenu.backend.domain.menu.dto.MenuInfoOnMapDto; import com.ourmenu.backend.domain.menu.dto.MenuOnMapDto; @@ -112,7 +111,7 @@ public List findSearchResultOnMap(String title, double mapX, doubl * @param userId * @return */ - public List findSearchHistoryOnMap(Long userId) { + public List findSearchHistoryOnMap(Long userId) { Pageable pageable = PageRequest.of( 0, 10, Sort.by(Sort.Direction.DESC, "modifiedAt") ); @@ -121,7 +120,7 @@ public List findSearchHistoryOnMap(Long userId) { .findByUserId(userId, pageable); return searchHistoryPage.stream() - .map(MapSearchHistoryDto::from) + .map(MapSearchDto::from) .collect(Collectors.toList()); } @@ -178,6 +177,7 @@ private void saveOwnedMenuSearchHistory(Long userId, Menu menu) { } OwnedMenuSearch ownedMenuSearch = OwnedMenuSearch.builder() + .mapId(menu.getStore().getMap().getId()) .menuId(menu.getId()) .menuTitle(menu.getTitle()) .storeTitle(menu.getStore().getTitle()) diff --git a/src/main/java/com/ourmenu/backend/domain/menu/dto/MapSearchDto.java b/src/main/java/com/ourmenu/backend/domain/menu/dto/MapSearchDto.java index 0a62ff8b..4aa9b356 100644 --- a/src/main/java/com/ourmenu/backend/domain/menu/dto/MapSearchDto.java +++ b/src/main/java/com/ourmenu/backend/domain/menu/dto/MapSearchDto.java @@ -13,6 +13,7 @@ public class MapSearchDto { private Long mapId; + private Long menuId; private String menuTitle; private String storeTitle; private String storeAddress; @@ -20,6 +21,7 @@ public class MapSearchDto { public static MapSearchDto from(Menu menu){ return MapSearchDto.builder() .mapId(menu.getStore().getMap().getId()) + .menuId(menu.getId()) .menuTitle(menu.getTitle()) .storeTitle(menu.getStore().getTitle()) .storeAddress(menu.getStore().getAddress()) @@ -28,6 +30,8 @@ public static MapSearchDto from(Menu menu){ public static MapSearchDto from(OwnedMenuSearch ownedMenuSearch){ return MapSearchDto.builder() + .mapId(ownedMenuSearch.getMapId()) + .menuId(ownedMenuSearch.getMenuId()) .menuTitle(ownedMenuSearch.getMenuTitle()) .storeTitle(ownedMenuSearch.getStoreTitle()) .storeAddress(ownedMenuSearch.getStoreAddress()) From 1d75da36baa308d70daadfee0ff477e618100862 Mon Sep 17 00:00:00 2001 From: You-Hyuk Date: Thu, 14 Aug 2025 18:19:47 +0900 Subject: [PATCH 12/16] =?UTF-8?q?del:=20DTO=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/menu/dto/MapSearchHistoryDto.java | 29 ------------------- 1 file changed, 29 deletions(-) delete mode 100644 src/main/java/com/ourmenu/backend/domain/menu/dto/MapSearchHistoryDto.java diff --git a/src/main/java/com/ourmenu/backend/domain/menu/dto/MapSearchHistoryDto.java b/src/main/java/com/ourmenu/backend/domain/menu/dto/MapSearchHistoryDto.java deleted file mode 100644 index 02a26286..00000000 --- a/src/main/java/com/ourmenu/backend/domain/menu/dto/MapSearchHistoryDto.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ourmenu.backend.domain.menu.dto; - -import com.ourmenu.backend.domain.search.domain.OwnedMenuSearch; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; - -import java.time.LocalDateTime; - -@Getter -@Builder(access = AccessLevel.PRIVATE) -@AllArgsConstructor(access = AccessLevel.PRIVATE) -public class MapSearchHistoryDto { - - private Long menuId; - private String menuTitle; - private String storeTitle; - private String storeAddress; - - public static MapSearchHistoryDto from(OwnedMenuSearch ownedMenuSearch){ - return MapSearchHistoryDto.builder() - .menuId(ownedMenuSearch.getMenuId()) - .menuTitle(ownedMenuSearch.getMenuTitle()) - .storeTitle(ownedMenuSearch.getStoreTitle()) - .storeAddress(ownedMenuSearch.getStoreAddress()) - .build(); - } -} From 44814f09f7e0642565ea31e2c7e3bb8e7ad0154c Mon Sep 17 00:00:00 2001 From: david-parkk Date: Fri, 15 Aug 2025 22:36:27 +0900 Subject: [PATCH 13/16] =?UTF-8?q?fix:=20response=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ourmenu/backend/domain/menu/api/MenuController.java | 2 +- .../ourmenu/backend/domain/menu/dto/SaveMenuRequest.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/ourmenu/backend/domain/menu/api/MenuController.java b/src/main/java/com/ourmenu/backend/domain/menu/api/MenuController.java index d890255d..8e5b8794 100644 --- a/src/main/java/com/ourmenu/backend/domain/menu/api/MenuController.java +++ b/src/main/java/com/ourmenu/backend/domain/menu/api/MenuController.java @@ -45,7 +45,7 @@ public ApiResponse saveMenu(@ModelAttribute SaveMenuRequest re @AuthenticationPrincipal CustomUserDetails userDetails) { request.initList(); SimpleSearchDto simpleSearchDto = searchService.getSearchDto(request.getIsCrawled(), request.getStoreId()); - MenuDto menuDto = MenuDto.of(request, request.getMenuFolderImgs(), userDetails, simpleSearchDto); + MenuDto menuDto = MenuDto.of(request, request.getMenuImgs(), userDetails, simpleSearchDto); SaveMenuResponse response = menuService.saveMenu(menuDto); return ApiUtil.success(response); } diff --git a/src/main/java/com/ourmenu/backend/domain/menu/dto/SaveMenuRequest.java b/src/main/java/com/ourmenu/backend/domain/menu/dto/SaveMenuRequest.java index e4bc979b..a91c0a14 100644 --- a/src/main/java/com/ourmenu/backend/domain/menu/dto/SaveMenuRequest.java +++ b/src/main/java/com/ourmenu/backend/domain/menu/dto/SaveMenuRequest.java @@ -12,7 +12,7 @@ @Getter public class SaveMenuRequest { - List menuFolderImgs; + List menuImgs; private String menuTitle; private int menuPrice; private MenuPin menuPin; @@ -27,8 +27,8 @@ public class SaveMenuRequest { * request 에 null 들어오는 경우에 대해서 request 초기화 swagger 를 위한 메서드 */ public void initList() { - if (menuFolderImgs == null) { - menuFolderImgs = new ArrayList<>(); + if (menuImgs == null) { + menuImgs = new ArrayList<>(); } if (menuFolderIds == null) { menuFolderIds = new ArrayList<>(); From 55894900def75a8fc8649e3cb136bd93d80255dd Mon Sep 17 00:00:00 2001 From: david-parkk Date: Fri, 15 Aug 2025 23:27:48 +0900 Subject: [PATCH 14/16] =?UTF-8?q?feat:=20=EB=A9=94=EB=89=B4=ED=8F=B4?= =?UTF-8?q?=EB=8D=94=EC=95=84=EC=9D=B4=EC=BD=98=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/cache/api/CacheController.java | 9 ++++++++ .../cache/application/CacheService.java | 10 ++++++++ .../cache/dto/GetMenuFolderIconResponse.java | 23 +++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 src/main/java/com/ourmenu/backend/domain/cache/dto/GetMenuFolderIconResponse.java diff --git a/src/main/java/com/ourmenu/backend/domain/cache/api/CacheController.java b/src/main/java/com/ourmenu/backend/domain/cache/api/CacheController.java index 58b59855..c29af45b 100644 --- a/src/main/java/com/ourmenu/backend/domain/cache/api/CacheController.java +++ b/src/main/java/com/ourmenu/backend/domain/cache/api/CacheController.java @@ -2,9 +2,11 @@ import com.ourmenu.backend.domain.cache.application.CacheService; import com.ourmenu.backend.domain.cache.dto.GetCacheInfoResponse; +import com.ourmenu.backend.domain.cache.dto.GetMenuFolderIconResponse; import com.ourmenu.backend.global.response.ApiResponse; import com.ourmenu.backend.global.response.util.ApiUtil; import io.swagger.v3.oas.annotations.tags.Tag; +import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @@ -22,4 +24,11 @@ public ApiResponse getCacheInfo() { return ApiUtil.success(response); } + + @GetMapping("api/cache-data/menuFolderIcons") + public ApiResponse> getMenuFolderIconsResponse() { + List response = cacheService.getMenuFolderIcon(); + + return ApiUtil.success(response); + } } diff --git a/src/main/java/com/ourmenu/backend/domain/cache/application/CacheService.java b/src/main/java/com/ourmenu/backend/domain/cache/application/CacheService.java index e9f19f97..287fba87 100644 --- a/src/main/java/com/ourmenu/backend/domain/cache/application/CacheService.java +++ b/src/main/java/com/ourmenu/backend/domain/cache/application/CacheService.java @@ -4,6 +4,7 @@ import com.ourmenu.backend.domain.cache.domain.MenuFolderIcon; import com.ourmenu.backend.domain.cache.domain.MenuPin; import com.ourmenu.backend.domain.cache.dto.GetCacheInfoResponse; +import com.ourmenu.backend.domain.cache.dto.GetMenuFolderIconResponse; import com.ourmenu.backend.domain.cache.dto.SimpleHomeImgResponse; import com.ourmenu.backend.domain.cache.dto.SimpleMenuFolderIconResponse; import com.ourmenu.backend.domain.cache.dto.SimpleMenuPinResponse; @@ -29,6 +30,15 @@ public GetCacheInfoResponse getCacheInfo() { return GetCacheInfoResponse.of(menuFolderIconInfo, menuPinInfo, homeImgInfo, tagInfo); } + + public List getMenuFolderIcon() { + List menuFolderIconInfo = getMenuFolderIconInfo(); + + return menuFolderIconInfo.stream() + .map(GetMenuFolderIconResponse::from) + .toList(); + } + private List getMenuFolderIconInfo() { return Arrays.stream(MenuFolderIcon.values()) .map(menuFolderIcon -> { diff --git a/src/main/java/com/ourmenu/backend/domain/cache/dto/GetMenuFolderIconResponse.java b/src/main/java/com/ourmenu/backend/domain/cache/dto/GetMenuFolderIconResponse.java new file mode 100644 index 00000000..b9ef8585 --- /dev/null +++ b/src/main/java/com/ourmenu/backend/domain/cache/dto/GetMenuFolderIconResponse.java @@ -0,0 +1,23 @@ +package com.ourmenu.backend.domain.cache.dto; + +import com.ourmenu.backend.domain.cache.domain.MenuFolderIcon; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; + +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@Builder(access = AccessLevel.PRIVATE) +@Getter +public class GetMenuFolderIconResponse { + + private MenuFolderIcon menuFolderIcon; + private String menuFolderIconUrl; + + public static GetMenuFolderIconResponse from(SimpleMenuFolderIconResponse simpleMenuFolderIconResponse) { + return GetMenuFolderIconResponse.builder() + .menuFolderIcon(simpleMenuFolderIconResponse.getMenuFolderIcon()) + .menuFolderIconUrl(simpleMenuFolderIconResponse.getMenuFolderIconUrl()) + .build(); + } +} From e45c169e173f86619f148cb6461d35ce4625a7b0 Mon Sep 17 00:00:00 2001 From: david-parkk Date: Fri, 15 Aug 2025 23:34:42 +0900 Subject: [PATCH 15/16] =?UTF-8?q?fix:=20=EB=A9=94=EB=89=B4=ED=95=80=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/cache/api/CacheController.java | 10 +++++++- .../cache/application/CacheService.java | 15 ++++++++--- .../domain/cache/dto/GetMenuPinResponse.java | 25 +++++++++++++++++++ 3 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/ourmenu/backend/domain/cache/dto/GetMenuPinResponse.java diff --git a/src/main/java/com/ourmenu/backend/domain/cache/api/CacheController.java b/src/main/java/com/ourmenu/backend/domain/cache/api/CacheController.java index c29af45b..fbd0f576 100644 --- a/src/main/java/com/ourmenu/backend/domain/cache/api/CacheController.java +++ b/src/main/java/com/ourmenu/backend/domain/cache/api/CacheController.java @@ -3,6 +3,7 @@ import com.ourmenu.backend.domain.cache.application.CacheService; import com.ourmenu.backend.domain.cache.dto.GetCacheInfoResponse; import com.ourmenu.backend.domain.cache.dto.GetMenuFolderIconResponse; +import com.ourmenu.backend.domain.cache.dto.GetMenuPinResponse; import com.ourmenu.backend.global.response.ApiResponse; import com.ourmenu.backend.global.response.util.ApiUtil; import io.swagger.v3.oas.annotations.tags.Tag; @@ -27,7 +28,14 @@ public ApiResponse getCacheInfo() { @GetMapping("api/cache-data/menuFolderIcons") public ApiResponse> getMenuFolderIconsResponse() { - List response = cacheService.getMenuFolderIcon(); + List response = cacheService.getMenuFolderIcons(); + + return ApiUtil.success(response); + } + + @GetMapping("api/cache-data/menuPins") + public ApiResponse> getMenuPinResponse() { + List response = cacheService.getMenuPins(); return ApiUtil.success(response); } diff --git a/src/main/java/com/ourmenu/backend/domain/cache/application/CacheService.java b/src/main/java/com/ourmenu/backend/domain/cache/application/CacheService.java index 287fba87..b592d760 100644 --- a/src/main/java/com/ourmenu/backend/domain/cache/application/CacheService.java +++ b/src/main/java/com/ourmenu/backend/domain/cache/application/CacheService.java @@ -5,6 +5,7 @@ import com.ourmenu.backend.domain.cache.domain.MenuPin; import com.ourmenu.backend.domain.cache.dto.GetCacheInfoResponse; import com.ourmenu.backend.domain.cache.dto.GetMenuFolderIconResponse; +import com.ourmenu.backend.domain.cache.dto.GetMenuPinResponse; import com.ourmenu.backend.domain.cache.dto.SimpleHomeImgResponse; import com.ourmenu.backend.domain.cache.dto.SimpleMenuFolderIconResponse; import com.ourmenu.backend.domain.cache.dto.SimpleMenuPinResponse; @@ -31,14 +32,22 @@ public GetCacheInfoResponse getCacheInfo() { } - public List getMenuFolderIcon() { - List menuFolderIconInfo = getMenuFolderIconInfo(); + public List getMenuFolderIcons() { + List menuFolderIconsInfo = getMenuFolderIconInfo(); - return menuFolderIconInfo.stream() + return menuFolderIconsInfo.stream() .map(GetMenuFolderIconResponse::from) .toList(); } + public List getMenuPins() { + List menuPinsInfo = getMenuPinInfo(); + + return menuPinsInfo.stream() + .map(GetMenuPinResponse::from) + .toList(); + } + private List getMenuFolderIconInfo() { return Arrays.stream(MenuFolderIcon.values()) .map(menuFolderIcon -> { diff --git a/src/main/java/com/ourmenu/backend/domain/cache/dto/GetMenuPinResponse.java b/src/main/java/com/ourmenu/backend/domain/cache/dto/GetMenuPinResponse.java new file mode 100644 index 00000000..31f55735 --- /dev/null +++ b/src/main/java/com/ourmenu/backend/domain/cache/dto/GetMenuPinResponse.java @@ -0,0 +1,25 @@ +package com.ourmenu.backend.domain.cache.dto; + +import com.ourmenu.backend.domain.cache.domain.MenuPin; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; + +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@Builder(access = AccessLevel.PRIVATE) +@Getter +public class GetMenuPinResponse { + + private MenuPin menuPin; + private String menuPinAddImgUrl; + private String menuPinAddDisableImgUrl; + + public static GetMenuPinResponse from(SimpleMenuPinResponse simpleMenuPinResponse) { + return GetMenuPinResponse.builder() + .menuPin(simpleMenuPinResponse.getMenuPin()) + .menuPinAddImgUrl(simpleMenuPinResponse.getMenuPinAddImgUrl()) + .menuPinAddDisableImgUrl(simpleMenuPinResponse.getMenuPinAddDisableImgUrl()) + .build(); + } +} From 22ab3e12a7a426ab1fd31a961339d95c7c5f7994 Mon Sep 17 00:00:00 2001 From: david-parkk Date: Fri, 15 Aug 2025 23:49:57 +0900 Subject: [PATCH 16/16] =?UTF-8?q?fix:=20endpoint=20=EB=B3=80=EA=B2=BD,=20s?= =?UTF-8?q?ecurity=20endpoint=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/cache/api/CacheController.java | 12 +++++++-- .../cache/application/CacheService.java | 9 +++++++ .../domain/cache/dto/GetTagResponse.java | 25 +++++++++++++++++++ .../backend/global/config/SecurityConfig.java | 4 ++- 4 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/ourmenu/backend/domain/cache/dto/GetTagResponse.java diff --git a/src/main/java/com/ourmenu/backend/domain/cache/api/CacheController.java b/src/main/java/com/ourmenu/backend/domain/cache/api/CacheController.java index fbd0f576..4018d4b1 100644 --- a/src/main/java/com/ourmenu/backend/domain/cache/api/CacheController.java +++ b/src/main/java/com/ourmenu/backend/domain/cache/api/CacheController.java @@ -4,6 +4,7 @@ import com.ourmenu.backend.domain.cache.dto.GetCacheInfoResponse; import com.ourmenu.backend.domain.cache.dto.GetMenuFolderIconResponse; import com.ourmenu.backend.domain.cache.dto.GetMenuPinResponse; +import com.ourmenu.backend.domain.cache.dto.GetTagResponse; import com.ourmenu.backend.global.response.ApiResponse; import com.ourmenu.backend.global.response.util.ApiUtil; import io.swagger.v3.oas.annotations.tags.Tag; @@ -26,17 +27,24 @@ public ApiResponse getCacheInfo() { return ApiUtil.success(response); } - @GetMapping("api/cache-data/menuFolderIcons") + @GetMapping("api/cache-data/menu-folder-icons") public ApiResponse> getMenuFolderIconsResponse() { List response = cacheService.getMenuFolderIcons(); return ApiUtil.success(response); } - @GetMapping("api/cache-data/menuPins") + @GetMapping("api/cache-data/menu-pins") public ApiResponse> getMenuPinResponse() { List response = cacheService.getMenuPins(); return ApiUtil.success(response); } + + @GetMapping("api/cache-data/tags") + public ApiResponse> getTagResponse() { + List response = cacheService.getTags(); + + return ApiUtil.success(response); + } } diff --git a/src/main/java/com/ourmenu/backend/domain/cache/application/CacheService.java b/src/main/java/com/ourmenu/backend/domain/cache/application/CacheService.java index b592d760..a35d2997 100644 --- a/src/main/java/com/ourmenu/backend/domain/cache/application/CacheService.java +++ b/src/main/java/com/ourmenu/backend/domain/cache/application/CacheService.java @@ -6,6 +6,7 @@ import com.ourmenu.backend.domain.cache.dto.GetCacheInfoResponse; import com.ourmenu.backend.domain.cache.dto.GetMenuFolderIconResponse; import com.ourmenu.backend.domain.cache.dto.GetMenuPinResponse; +import com.ourmenu.backend.domain.cache.dto.GetTagResponse; import com.ourmenu.backend.domain.cache.dto.SimpleHomeImgResponse; import com.ourmenu.backend.domain.cache.dto.SimpleMenuFolderIconResponse; import com.ourmenu.backend.domain.cache.dto.SimpleMenuPinResponse; @@ -48,6 +49,14 @@ public List getMenuPins() { .toList(); } + public List getTags() { + List tagsImgInfo = getTagImgInfo(); + + return tagsImgInfo.stream() + .map(GetTagResponse::from) + .toList(); + } + private List getMenuFolderIconInfo() { return Arrays.stream(MenuFolderIcon.values()) .map(menuFolderIcon -> { diff --git a/src/main/java/com/ourmenu/backend/domain/cache/dto/GetTagResponse.java b/src/main/java/com/ourmenu/backend/domain/cache/dto/GetTagResponse.java new file mode 100644 index 00000000..8e72977c --- /dev/null +++ b/src/main/java/com/ourmenu/backend/domain/cache/dto/GetTagResponse.java @@ -0,0 +1,25 @@ +package com.ourmenu.backend.domain.cache.dto; + +import com.ourmenu.backend.domain.tag.domain.Tag; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; + +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@Builder(access = AccessLevel.PRIVATE) +@Getter +public class GetTagResponse { + + private Tag tag; + private String orangeTagImgUrl; + private String whiteTagImgUrl; + + public static GetTagResponse from(SimpleTagImgResponse simpleTagImgResponse) { + return GetTagResponse.builder() + .tag(simpleTagImgResponse.getTag()) + .orangeTagImgUrl(simpleTagImgResponse.getOrangeTagImgUrl()) + .whiteTagImgUrl(simpleTagImgResponse.getWhiteTagImgUrl()) + .build(); + } +} diff --git a/src/main/java/com/ourmenu/backend/global/config/SecurityConfig.java b/src/main/java/com/ourmenu/backend/global/config/SecurityConfig.java index 30dc1d13..b1020f1b 100644 --- a/src/main/java/com/ourmenu/backend/global/config/SecurityConfig.java +++ b/src/main/java/com/ourmenu/backend/global/config/SecurityConfig.java @@ -38,7 +38,8 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { sessionManagementConfigurer.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) .logout(AbstractHttpConfigurer::disable) .authorizeHttpRequests(authorize -> authorize - .requestMatchers("/api/users/sign-up", "/api/users/sign-in", "/api/users/auth/kakao", "/api/users/reissue-token") + .requestMatchers("/api/users/sign-up", "/api/users/sign-in", "/api/users/auth/kakao", + "/api/users/reissue-token") .permitAll() .requestMatchers("/api/emails/**").permitAll() .requestMatchers("/swagger-ui/**", "/swagger-resources/**", "/v3/api-docs/**").permitAll() @@ -68,6 +69,7 @@ public WebSecurityCustomizer webSecurityCustomizer() { "/api/users/sign-in", "/api/users/reissue-token", "/api/cache-data", + "/api/cache-data/**", "/api/emails/**", "/swagger-ui/**", "/swagger-resources/**",