diff --git a/src/main/java/com/bbteam/budgetbuddies/domain/discountinfo/converter/DiscountInfoConverter.java b/src/main/java/com/bbteam/budgetbuddies/domain/discountinfo/converter/DiscountInfoConverter.java index 9cb07da0..c00cb6fa 100644 --- a/src/main/java/com/bbteam/budgetbuddies/domain/discountinfo/converter/DiscountInfoConverter.java +++ b/src/main/java/com/bbteam/budgetbuddies/domain/discountinfo/converter/DiscountInfoConverter.java @@ -43,6 +43,7 @@ public DiscountInfo toEntity(DiscountRequest.RegisterDiscountDto requestDto) { .likeCount(0) .siteUrl(requestDto.getSiteUrl()) .thumbnailUrl(requestDto.getThumbnailUrl()) + .isInCalendar(requestDto.getIsInCalendar()) .build(); } diff --git a/src/main/java/com/bbteam/budgetbuddies/domain/discountinfo/dto/DiscountRequest.java b/src/main/java/com/bbteam/budgetbuddies/domain/discountinfo/dto/DiscountRequest.java index 66a145ed..9fc2e34b 100644 --- a/src/main/java/com/bbteam/budgetbuddies/domain/discountinfo/dto/DiscountRequest.java +++ b/src/main/java/com/bbteam/budgetbuddies/domain/discountinfo/dto/DiscountRequest.java @@ -23,6 +23,9 @@ public static class RegisterDiscountDto { private String siteUrl; private String thumbnailUrl; + + private Boolean isInCalendar; + } @Getter @@ -44,6 +47,8 @@ public static class UpdateDiscountDto { private String siteUrl; private String thumbnailUrl; + + private Boolean isInCalendar; } diff --git a/src/main/java/com/bbteam/budgetbuddies/domain/discountinfo/entity/DiscountInfo.java b/src/main/java/com/bbteam/budgetbuddies/domain/discountinfo/entity/DiscountInfo.java index 6c6779dc..91153236 100644 --- a/src/main/java/com/bbteam/budgetbuddies/domain/discountinfo/entity/DiscountInfo.java +++ b/src/main/java/com/bbteam/budgetbuddies/domain/discountinfo/entity/DiscountInfo.java @@ -37,6 +37,10 @@ public class DiscountInfo extends BaseEntity { @Column(length = 1000) private String thumbnailUrl; // 카드 썸네일 이미지 + @Column(nullable = false) + private Boolean isInCalendar; + + public void addLikeCount() { this.likeCount++; } @@ -57,6 +61,7 @@ public void update(DiscountRequest.UpdateDiscountDto discountRequestDto) { this.discountRate = discountRequestDto.getDiscountRate(); this.siteUrl = discountRequestDto.getSiteUrl(); this.thumbnailUrl = discountRequestDto.getThumbnailUrl(); + this.isInCalendar = discountRequestDto.getIsInCalendar(); } } diff --git a/src/main/java/com/bbteam/budgetbuddies/domain/discountinfo/repository/DiscountInfoRepository.java b/src/main/java/com/bbteam/budgetbuddies/domain/discountinfo/repository/DiscountInfoRepository.java index f62b9128..64ccb5ec 100644 --- a/src/main/java/com/bbteam/budgetbuddies/domain/discountinfo/repository/DiscountInfoRepository.java +++ b/src/main/java/com/bbteam/budgetbuddies/domain/discountinfo/repository/DiscountInfoRepository.java @@ -17,6 +17,7 @@ public interface DiscountInfoRepository extends JpaRepository findByDateRange(LocalDate startDate, LocalDate endDate, Pageable pageable); @Query("SELECT i FROM DiscountInfo i WHERE (i.startDate <= :endDate AND i.endDate >= :startDate)" + + " AND i.isInCalendar = TRUE " + " ORDER BY i.likeCount DESC") List findByMonth(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate); diff --git a/src/main/java/com/bbteam/budgetbuddies/domain/supportinfo/converter/SupportInfoConverter.java b/src/main/java/com/bbteam/budgetbuddies/domain/supportinfo/converter/SupportInfoConverter.java index 804f8b51..e064492d 100644 --- a/src/main/java/com/bbteam/budgetbuddies/domain/supportinfo/converter/SupportInfoConverter.java +++ b/src/main/java/com/bbteam/budgetbuddies/domain/supportinfo/converter/SupportInfoConverter.java @@ -40,6 +40,7 @@ public SupportInfo toEntity(SupportRequest.RegisterSupportDto requestDto) { .likeCount(0) .siteUrl(requestDto.getSiteUrl()) .thumbnailUrl(requestDto.getThumbnailUrl()) + .isInCalendar(requestDto.getIsInCalendar()) .build(); } } diff --git a/src/main/java/com/bbteam/budgetbuddies/domain/supportinfo/dto/SupportRequest.java b/src/main/java/com/bbteam/budgetbuddies/domain/supportinfo/dto/SupportRequest.java index e63b7bc1..48cca65f 100644 --- a/src/main/java/com/bbteam/budgetbuddies/domain/supportinfo/dto/SupportRequest.java +++ b/src/main/java/com/bbteam/budgetbuddies/domain/supportinfo/dto/SupportRequest.java @@ -26,6 +26,9 @@ public static class RegisterSupportDto { private String thumbnailUrl; + private Boolean isInCalendar; + + } @Getter @@ -46,6 +49,9 @@ public static class UpdateSupportDto { private String thumbnailUrl; + private Boolean isInCalendar; + + } diff --git a/src/main/java/com/bbteam/budgetbuddies/domain/supportinfo/entity/SupportInfo.java b/src/main/java/com/bbteam/budgetbuddies/domain/supportinfo/entity/SupportInfo.java index 95b14372..57152c04 100644 --- a/src/main/java/com/bbteam/budgetbuddies/domain/supportinfo/entity/SupportInfo.java +++ b/src/main/java/com/bbteam/budgetbuddies/domain/supportinfo/entity/SupportInfo.java @@ -35,6 +35,10 @@ public class SupportInfo extends BaseEntity { @Column(length = 1000) private String thumbnailUrl; // 카드 썸네일 이미지 + @Column(nullable = false) + private Boolean isInCalendar; + + public void addLikeCount() { this.likeCount++; } @@ -54,6 +58,7 @@ public void update(SupportRequest.UpdateSupportDto supportRequestDto) { this.endDate = supportRequestDto.getEndDate(); this.siteUrl = supportRequestDto.getSiteUrl(); this.thumbnailUrl = supportRequestDto.getThumbnailUrl(); + this.isInCalendar = supportRequestDto.getIsInCalendar(); } } diff --git a/src/main/java/com/bbteam/budgetbuddies/domain/supportinfo/repository/SupportInfoRepository.java b/src/main/java/com/bbteam/budgetbuddies/domain/supportinfo/repository/SupportInfoRepository.java index c6e0a13c..d0f35853 100644 --- a/src/main/java/com/bbteam/budgetbuddies/domain/supportinfo/repository/SupportInfoRepository.java +++ b/src/main/java/com/bbteam/budgetbuddies/domain/supportinfo/repository/SupportInfoRepository.java @@ -18,6 +18,7 @@ public interface SupportInfoRepository extends JpaRepository Page findByDateRange(LocalDate startDate, LocalDate endDate, Pageable pageable); @Query("SELECT i FROM SupportInfo i WHERE (i.startDate <= :endDate AND i.endDate >= :startDate)" + + " AND i.isInCalendar = TRUE " + " ORDER BY i.likeCount DESC") List findByMonth(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);