diff --git a/src/main/java/site/easystartup/web/project/repo/ProjectRepo.java b/src/main/java/site/easystartup/web/project/repo/ProjectRepo.java index f3cd409..745b1be 100644 --- a/src/main/java/site/easystartup/web/project/repo/ProjectRepo.java +++ b/src/main/java/site/easystartup/web/project/repo/ProjectRepo.java @@ -13,11 +13,11 @@ import java.util.Set; @Repository public interface ProjectRepo extends JpaRepository { - List findAllByOwner(User owner); + List findAllByOwnerOrderByCreatedDate(User owner); - @Query(value = "SELECT p from Project p WHERE p.technology LIKE %:technology%") + @Query("SELECT p from Project p WHERE p.technology LIKE %:technology%") List findAllByTechnology(@Param("technology") String tech); - List findAllByCommercialStatus(int commercialStatus); + List findAllByCommercialStatusOrderByCreatedDateAsc(int commercialStatus); } diff --git a/src/main/java/site/easystartup/web/project/service/ProjectService.java b/src/main/java/site/easystartup/web/project/service/ProjectService.java index 46bf4df..5c4efe3 100644 --- a/src/main/java/site/easystartup/web/project/service/ProjectService.java +++ b/src/main/java/site/easystartup/web/project/service/ProjectService.java @@ -57,12 +57,12 @@ public class ProjectService { } public List getAllProjectsWithCommercialStatus(int commercialStatus) { - return projectRepo.findAllByCommercialStatus(commercialStatus); + return projectRepo.findAllByCommercialStatusOrderByCreatedDateAsc(commercialStatus); } public List getAllProjectsForUser(Long userId) { User user = userService.getUserById(userId); - return projectRepo.findAllByOwner(user); + return projectRepo.findAllByOwnerOrderByCreatedDate(user); } public List getAllProjectsWithTechnology(String technology) { @@ -70,7 +70,7 @@ public class ProjectService { } public List getAllProjectsForCurrentUser(Principal principal) { - return projectRepo.findAllByOwner(userService.getUserByPrincipal(principal)); + return projectRepo.findAllByOwnerOrderByCreatedDate(userService.getUserByPrincipal(principal)); } public LinkedHashSet getAllProjectsWithPosition(String nameOfPosition) {