Skip to content

Commit

Permalink
refactor: add exception about portfolio list read
Browse files Browse the repository at this point in the history
- 포트폴리오 리스트 조회시 탈퇴한 플래너의 포트폴리오는 제외하도록 예외처리
  • Loading branch information
chaee813 committed Oct 19, 2023
1 parent 4738fba commit b90ce98
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ public PageCursor<List<PortfolioResponse.FindAllDTO>> getPortfolios(CursorReques
Pageable pageable = PageRequest
.ofSize(request.size())
.withSort(Sort.by("id").descending());
List<Portfolio> portfolios = search(request, pageable);
List<Portfolio> portfoliosPS = search(request, pageable);

// 탈퇴한 플래너의 포트폴리오는 제외
List<Portfolio> portfolios = portfoliosPS.stream()
.filter(portfolio -> portfolio.getPlanner() != null)
.toList();

if (portfolios.isEmpty()) return new PageCursor<>(null, CursorRequest.NONE_KEY);

Expand Down

0 comments on commit b90ce98

Please sign in to comment.