Skip to content

Commit

Permalink
[refact] 프로젝트 순서 변경 (#125)
Browse files Browse the repository at this point in the history
* [refact] 프로젝트 순서 변경 #124

* [refact] spotless 적용 #124

* [refact] 코드 삭제 #124
  • Loading branch information
suhhyun524 authored Aug 5, 2023
1 parent e91f2dc commit 82698fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
import ceos.backend.domain.project.domain.Project;
import java.util.List;
import java.util.Optional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface ProjectRepository extends JpaRepository<Project, Long> {
Page<Project> findAllByOrderByIdDesc(PageRequest pageRequest);

Optional<Project> findByNameAndGeneration(String name, int generation);

List<Project> findByGeneration(int generation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class ProjectService {
@Transactional(readOnly = true)
public GetProjectsResponse getProjects(int pageNum, int limit) {
PageRequest pageRequest = PageRequest.of(pageNum, limit);
Page<Project> projectList = projectRepository.findAll(pageRequest);
Page<Project> projectList = projectRepository.findAllByOrderByIdDesc(pageRequest);
PageInfo pageInfo =
PageInfo.of(
pageNum,
Expand Down

0 comments on commit 82698fe

Please sign in to comment.