diff --git a/resource-server/src/main/java/com/inhabas/api/domain/contest/repository/ContestBoardRepositoryImpl.java b/resource-server/src/main/java/com/inhabas/api/domain/contest/repository/ContestBoardRepositoryImpl.java index 1a2fc733..d4174cec 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/contest/repository/ContestBoardRepositoryImpl.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/contest/repository/ContestBoardRepositoryImpl.java @@ -1,20 +1,18 @@ package com.inhabas.api.domain.contest.repository; -import static com.inhabas.api.domain.contest.domain.QContestBoard.contestBoard; - +import com.inhabas.api.domain.contest.domain.QContestBoard; import java.util.ArrayList; import java.util.HashMap; import java.util.List; + import java.util.Map; import java.util.function.BiFunction; - import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import com.inhabas.api.domain.contest.domain.ContestBoard; -import com.inhabas.api.domain.contest.domain.QContestBoard; import com.inhabas.api.domain.contest.domain.valueObject.ContestType; import com.querydsl.core.types.Order; import com.querydsl.core.types.OrderSpecifier; @@ -29,16 +27,12 @@ public class ContestBoardRepositoryImpl implements ContestBoardRepositoryCustom private QContestBoard contestBoard = QContestBoard.contestBoard; // 필드 이름과 정렬 기준을 매핑 - private OrderSpecifier getSortedColumn( - Order order, QContestBoard contestBoard, String fieldName) { - Map>> orderSpecifierMap = - new HashMap<>(); + private OrderSpecifier getSortedColumn(Order order, QContestBoard contestBoard, String fieldName) { + Map>> orderSpecifierMap = new HashMap<>(); orderSpecifierMap.put("id", (o, cb) -> new OrderSpecifier<>(o, cb.id)); orderSpecifierMap.put("dateContestEnd", (o, cb) -> new OrderSpecifier<>(o, cb.dateContestEnd)); - return orderSpecifierMap - .getOrDefault(fieldName, (o, cb) -> new OrderSpecifier<>(Order.DESC, cb.dateContestEnd)) - .apply(order, contestBoard); + return orderSpecifierMap.getOrDefault(fieldName, (o, cb) -> new OrderSpecifier<>(Order.DESC, cb.dateContestEnd)).apply(order, contestBoard); } // 페이지 요청에 따른 정렬 @@ -47,8 +41,7 @@ public List> getAllOrderSpecifiers(Pageable pageable) { if (pageable.getSort() != null) { for (Sort.Order order : pageable.getSort()) { Order direction = order.getDirection().isAscending() ? Order.ASC : Order.DESC; - OrderSpecifier orderSpecifier = - getSortedColumn(direction, contestBoard, order.getProperty()); + OrderSpecifier orderSpecifier = getSortedColumn(direction, contestBoard, order.getProperty()); orders.add(orderSpecifier); } } else { diff --git a/resource-server/src/main/java/com/inhabas/api/domain/contest/usecase/ContestBoardServiceImpl.java b/resource-server/src/main/java/com/inhabas/api/domain/contest/usecase/ContestBoardServiceImpl.java index 040989bd..2492df57 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/contest/usecase/ContestBoardServiceImpl.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/contest/usecase/ContestBoardServiceImpl.java @@ -36,8 +36,6 @@ public class ContestBoardServiceImpl implements ContestBoardService { private final ContestBoardRepository contestBoardRepository; - private final ContestFieldRepository contestFieldRepository; - private final BoardSecurityChecker boardSecurityChecker; private final MemberRepository memberRepository; @@ -67,6 +65,7 @@ public List getContestBoardsByType( return contestBoardList.stream() .map( contestBoard -> { + //첨부파일들 중 첫번째 이미지 = 썸네일 FileDownloadDto thumbnail = contestBoard.getFiles().stream() .filter(file -> isImageFile(file.getName()))