Skip to content

Commit

Permalink
fix: 목탁 던지기 숫자 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
DongGeon0908 committed Apr 6, 2024
1 parent 030060c commit c3f023b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,20 @@ public class ItemDetailResponseDto {
private String address;
private List<ItemDetailCommentDto> commentList;
private LocalDateTime createdAt;
private Long likeCounts;

public ItemDetailResponseDto(Item item, List<ItemDetailCommentDto> itemCommentList) {
public ItemDetailResponseDto(
Item item,
List<ItemDetailCommentDto> itemCommentList,
Long likeCounts
) {
this.ItemId = item.getId();
this.message = item.getMessage();
this.latitude = item.getLatitude();
this.longitude = item.getLongitude();
this.address = item.getAddress();
this.commentList = itemCommentList;
this.createdAt = item.getCreatedAt();
this.likeCounts = likeCounts;
}
}
4 changes: 3 additions & 1 deletion src/main/java/com/core/api/item/service/ItemService.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ public ItemDetailResponseDto itemDetail(Long uId, Long itemId) {
.groupBy(itemComment.id, user.id)
.fetch();

return new ItemDetailResponseDto(item, itemCommentList);
Long likeCounts = itemLikeRepository.countByItemId(item.getId());

return new ItemDetailResponseDto(item, itemCommentList, likeCounts);
}

public Integer itemCommentLike(Long id, Long itemCommentId) {
Expand Down

0 comments on commit c3f023b

Please sign in to comment.