Skip to content

Commit

Permalink
fix(service): 카테고리 전체 조회시 id 오름차순으로 정렬하여 응답하도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
HoeSeong123 committed Aug 8, 2024
1 parent 1c805e2 commit f8c9eda
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package codezap.category.service;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
Expand Down Expand Up @@ -42,7 +46,9 @@ public Long create(CreateCategoryRequest createCategoryRequest, MemberDto member

public FindAllCategoriesResponse findAllByMember(Long memberId) {
Member member = memberJpaRepository.fetchById(memberId);
return FindAllCategoriesResponse.from(categoryRepository.findAllByMember(member));
List<Category> categories = new ArrayList<>(categoryRepository.findAllByMember(member));
categories.sort(Comparator.comparing(Category::getId));
return FindAllCategoriesResponse.from(categories);
}

public FindAllCategoriesResponse findAll() {
Expand Down

0 comments on commit f8c9eda

Please sign in to comment.