|
22 | 22 | import ita.tinybite.global.location.LocationService; |
23 | 23 | import ita.tinybite.global.util.DistanceCalculator; |
24 | 24 | import lombok.RequiredArgsConstructor; |
| 25 | +import org.springframework.beans.factory.annotation.Value; |
25 | 26 | import org.springframework.stereotype.Service; |
26 | 27 | import org.springframework.transaction.annotation.Transactional; |
27 | 28 |
|
|
35 | 36 | @RequiredArgsConstructor |
36 | 37 | @Transactional(readOnly = true) |
37 | 38 | public class PartyService { |
| 39 | + @Value("${default.image.delivery}") |
| 40 | + private String defaultDeliveryImage; |
| 41 | + @Value("${default.image.grocery}") |
| 42 | + private String defaultGroceryImage; |
| 43 | + @Value("${default.image.household}") |
| 44 | + private String defaultHouseholdImage; |
38 | 45 | private final PartyRepository partyRepository; |
39 | 46 | private final UserRepository userRepository; |
40 | 47 | private final LocationService locationService; |
@@ -657,7 +664,12 @@ private String getThumbnailIfPresent(List<String> images, PartyCategory category |
657 | 664 | if (images != null && !images.isEmpty()) { |
658 | 665 | return images.get(0); |
659 | 666 | } |
660 | | - return null; |
| 667 | + return switch (category) { |
| 668 | + case DELIVERY -> defaultDeliveryImage; |
| 669 | + case GROCERY -> defaultGroceryImage; |
| 670 | + case HOUSEHOLD -> defaultHouseholdImage; |
| 671 | + default -> throw new IllegalArgumentException("존재하지 않는 카테고리입니다: " + category); |
| 672 | + }; |
661 | 673 | } |
662 | 674 |
|
663 | 675 | private String getLinkIfValid(String link, PartyCategory category) { |
|
0 commit comments