Skip to content

Commit

Permalink
Merge pull request #157 from BudgetBuddiesTeam/feat/#156
Browse files Browse the repository at this point in the history
[feat] Calendar 관련 DiscountInfo, SupportInfo field 추가
  • Loading branch information
wnd01jun authored Aug 21, 2024
2 parents b374237 + 9e49cc3 commit 85ff0fb
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public DiscountInfo toEntity(DiscountRequest.RegisterDiscountDto requestDto) {
.likeCount(0)
.siteUrl(requestDto.getSiteUrl())
.thumbnailUrl(requestDto.getThumbnailUrl())
.isInCalendar(requestDto.getIsInCalendar())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public static class RegisterDiscountDto {
private String siteUrl;

private String thumbnailUrl;

private Boolean isInCalendar;

}

@Getter
Expand All @@ -44,6 +47,8 @@ public static class UpdateDiscountDto {
private String siteUrl;

private String thumbnailUrl;

private Boolean isInCalendar;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand All @@ -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();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public interface DiscountInfoRepository extends JpaRepository<DiscountInfo, Long
Page<DiscountInfo> 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<DiscountInfo> findByMonth(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public SupportInfo toEntity(SupportRequest.RegisterSupportDto requestDto) {
.likeCount(0)
.siteUrl(requestDto.getSiteUrl())
.thumbnailUrl(requestDto.getThumbnailUrl())
.isInCalendar(requestDto.getIsInCalendar())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public static class RegisterSupportDto {

private String thumbnailUrl;

private Boolean isInCalendar;


}

@Getter
Expand All @@ -46,6 +49,9 @@ public static class UpdateSupportDto {

private String thumbnailUrl;

private Boolean isInCalendar;


}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand All @@ -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();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public interface SupportInfoRepository extends JpaRepository<SupportInfo, Long>
Page<SupportInfo> 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<SupportInfo> findByMonth(@Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);

Expand Down

0 comments on commit 85ff0fb

Please sign in to comment.