This commit is contained in:
Viktoria committed 2022-08-30 09:35:10 +02:00
1 parent 72d0e648f0
commit eba3e0a7fb
2 files changed
+6 -6

No files matched your search

@@ -13,11 +13,11 @@ import java.util.Set;
@Repository @Repository
public interface ProjectRepo extends JpaRepository<Project, Long> { public interface ProjectRepo extends JpaRepository<Project, Long> {
List<Project> findAllByOwner(User owner); List<Project> 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<Project> findAllByTechnology(@Param("technology") String tech); List<Project> findAllByTechnology(@Param("technology") String tech);
List<Project> findAllByCommercialStatus(int commercialStatus); List<Project> findAllByCommercialStatusOrderByCreatedDateAsc(int commercialStatus);
} }
@@ -57,12 +57,12 @@ public class ProjectService {
} }
public List<Project> getAllProjectsWithCommercialStatus(int commercialStatus) { public List<Project> getAllProjectsWithCommercialStatus(int commercialStatus) {
return projectRepo.findAllByCommercialStatus(commercialStatus); return projectRepo.findAllByCommercialStatusOrderByCreatedDateAsc(commercialStatus);
} }
public List<Project> getAllProjectsForUser(Long userId) { public List<Project> getAllProjectsForUser(Long userId) {
User user = userService.getUserById(userId); User user = userService.getUserById(userId);
return projectRepo.findAllByOwner(user); return projectRepo.findAllByOwnerOrderByCreatedDate(user);
} }
public List<Project> getAllProjectsWithTechnology(String technology) { public List<Project> getAllProjectsWithTechnology(String technology) {
@@ -70,7 +70,7 @@ public class ProjectService {
} }
public List<Project> getAllProjectsForCurrentUser(Principal principal) { public List<Project> getAllProjectsForCurrentUser(Principal principal) {
return projectRepo.findAllByOwner(userService.getUserByPrincipal(principal)); return projectRepo.findAllByOwnerOrderByCreatedDate(userService.getUserByPrincipal(principal));
} }
public LinkedHashSet<Project> getAllProjectsWithPosition(String nameOfPosition) { public LinkedHashSet<Project> getAllProjectsWithPosition(String nameOfPosition) {