-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#221] refactor(HomePromotionDetail): 정적 팩토리 메서드 내에서 초기화해서 return 하도록 변경
- Loading branch information
1 parent
91327b2
commit 0539206
Showing
1 changed file
with
16 additions
and
10 deletions.
There are no files selected for viewing
26 changes: 16 additions & 10 deletions
26
src/main/java/com/beat/domain/performance/application/dto/home/HomePromotionDetail.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
package com.beat.domain.performance.application.dto.home; | ||
|
||
public record HomePromotionDetail( | ||
Long promotionId, | ||
String promotionPhoto, | ||
Long performanceId, | ||
String redirectUrl, | ||
boolean isExternal | ||
) { | ||
public static HomePromotionDetail of(Long promotionId, String promotionPhoto, Long performanceId, String redirectUrl, boolean isExternal) { | ||
return new HomePromotionDetail(promotionId, promotionPhoto, performanceId, redirectUrl, isExternal); | ||
} | ||
import com.beat.domain.promotion.domain.CarouselNumber; | ||
import com.beat.domain.promotion.domain.Promotion; | ||
|
||
public record HomePromotionDetail(Long promotionId, String promotionPhoto, Long performanceId, String redirectUrl, | ||
boolean isExternal, CarouselNumber carouselNumber) { | ||
|
||
public static HomePromotionDetail from(Promotion promotion) { | ||
Long performanceId = null; | ||
|
||
if (promotion.getPerformance() != null) { | ||
performanceId = promotion.getPerformance().getId(); | ||
} | ||
|
||
return new HomePromotionDetail(promotion.getId(), promotion.getPromotionPhoto(), performanceId, | ||
promotion.getRedirectUrl(), promotion.isExternal(), promotion.getCarouselNumber()); | ||
} | ||
} |