From 21031e1ab432bd8eb75302051f6f086fa54ab4ac Mon Sep 17 00:00:00 2001 From: You-Hyuk Date: Fri, 16 Aug 2024 17:51:04 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20GET=20/menu=20=EC=98=A4=EB=A5=98=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 --- .../domain/menu/application/PlaceService.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/ourMenu/backend/domain/menu/application/PlaceService.java b/src/main/java/com/ourMenu/backend/domain/menu/application/PlaceService.java index d1b40046..353055d4 100644 --- a/src/main/java/com/ourMenu/backend/domain/menu/application/PlaceService.java +++ b/src/main/java/com/ourMenu/backend/domain/menu/application/PlaceService.java @@ -92,11 +92,13 @@ public List findMenuInPlaceByUserId(Long userId){ log.info(places.toString()); for (Place place : places) { - Menu menu = menuRepository.findDistinctByUserIdOrderByCreatedAtDesc( - place.getId(), - userId - ).orElseThrow(() -> new MenuNotFoundException()); - menuList.add(menu); + if(place.getMenus() != null && !place.getMenus().isEmpty()) { + Menu menu = menuRepository.findDistinctByUserIdOrderByCreatedAtDesc( + place.getId(), + userId + ).orElseThrow(() -> new MenuNotFoundException()); + menuList.add(menu); + } } log.info(menuList.toString());