From cfb68a1075b8d8dcf97103b3d94f5574f54bea74 Mon Sep 17 00:00:00 2001 From: hyerinhwang-sailin Date: Thu, 29 Aug 2024 21:21:47 +0900 Subject: [PATCH] =?UTF-8?q?[#196]=20fix(PerformanceService):=20getPromotio?= =?UTF-8?q?ns=20=EB=A1=9C=EC=A7=81=20performanceId=20null=EC=9D=B8=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0=20=EA=B3=A0=EB=A0=A4=ED=95=B4=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/PerformanceService.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/beat/domain/performance/application/PerformanceService.java b/src/main/java/com/beat/domain/performance/application/PerformanceService.java index b684485..dc2c735 100644 --- a/src/main/java/com/beat/domain/performance/application/PerformanceService.java +++ b/src/main/java/com/beat/domain/performance/application/PerformanceService.java @@ -219,13 +219,19 @@ public HomeResponse getHomePerformanceList(HomeRequest homeRequest) { private List getPromotions() { List promotionList = promotionRepository.findAll(); return promotionList.stream() - .map(promotion -> HomePromotionDetail.of( - promotion.getId(), - promotion.getPromotionPhoto(), - promotion.getPerformance().getId(), - promotion.getRedirectUrl(), - promotion.isExternal() - )) + .map(promotion -> { + Long performanceId = null; + if (promotion.getPerformance() != null) { + performanceId = promotion.getPerformance().getId(); + } + return HomePromotionDetail.of( + promotion.getId(), + promotion.getPromotionPhoto(), + performanceId, + promotion.getRedirectUrl(), + promotion.isExternal() + ); + }) .collect(Collectors.toList()); }