Skip to content

Commit

Permalink
[#197] feat: deletePortfolio 예외 처리 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jinnxyoung committed Sep 9, 2024
1 parent d1e078b commit 6587c9f
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ public PortfolioRes updatePortfolio(Member member, Long portfolioId, PortfolioRe
public void deletePortfolio(Member member, Long portfolioId) {
Portfolio portfolio = portfolioRepository.findById(portfolioId)
.orElseThrow(() -> new ApplicationException(ErrorCode.PORTFOLIO_NOT_FOUND_EXCEPTION));
if (portfolio.getDeletedAt() != null) {
throw new ApplicationException(ErrorCode.ALREADY_DELETE_EXCEPTION);
}
if (!portfolio.getMember().getId().equals(member.getId())) {
throw new ApplicationException(ErrorCode.FORBIDDEN_EXCEPTION);
}
Expand Down

0 comments on commit 6587c9f

Please sign in to comment.