Skip to content

Commit e58a8d3

Browse files
authored
프로젝트 생성 날짜 기준 내림차순으로 조회 수정
프로젝트 생성을 날짜 기준으로 조회하지않아 메인 화면에 보이는 값이 문제가 생겨 내림차순으로 수정합니다
2 parents b8e9c18 + 2406865 commit e58a8d3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/main/java/hs/kr/backend/devpals/domain/project/repository/ProjectRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import java.util.List;
1010

1111
public interface ProjectRepository extends JpaRepository<ProjectEntity, Long> {
12-
List<ProjectEntity> findAll();
12+
List<ProjectEntity> findAllByOrderByCreatedAtDesc();
1313

1414
@Query("SELECT p FROM ProjectEntity p WHERE p.recruitmentEndDate = :tomorrow AND p.isDone = false")
1515
List<ProjectEntity> findProjectsEndingTomorrow(@Param("tomorrow") LocalDate tomorrow);

src/main/java/hs/kr/backend/devpals/domain/project/service/ProjectService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class ProjectService {
4747
@Qualifier("emailExecutor")
4848
private final Executor emailExecutor;
4949

50-
private final Map<Long, ProjectAllDto> projectAllCache = new HashMap<>();
50+
private final Map<Long, ProjectAllDto> projectAllCache = new LinkedHashMap<>();
5151

5252
// 프로젝트 목록 조회
5353
@Transactional
@@ -57,7 +57,7 @@ public ResponseEntity<ApiResponse<ProjectListResponse>> getProjectAll(
5757
String keyword, int page) {
5858

5959
if (projectAllCache.isEmpty()) {
60-
List<ProjectEntity> projects = projectRepository.findAll();
60+
List<ProjectEntity> projects = projectRepository.findAllByOrderByCreatedAtDesc();
6161
projects.forEach(project -> {
6262
if (!projectAllCache.containsKey(project.getId())) {
6363
projectAllCache.put(project.getId(), convertToDto(project));

0 commit comments

Comments
 (0)