Skip to content

Commit

Permalink
!hotfix: 포트폴리오이미지 업데이트 로직 수정
Browse files Browse the repository at this point in the history
이미지 삭제 로직이 포함되어 있지 않았음.
이미지 업데이트시, 초기화 후, 인풋으로 들어온 이미지들로만 다시 등록하는 로직으로 변경
  • Loading branch information
dbwp031 committed Aug 4, 2024
1 parent 2c0e249 commit e46c766
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ public PortfolioImageCreateResponse uploadPortfolioImages(long portfolioId, List

Portfolio portfolio = portfolioRepository.findById(portfolioId)
.orElseThrow(() -> new PortfolioException(PORTFOLIO_NOT_FOUND));
assert portfolio.getPortfolioImages().isEmpty();

portfolio.removeAllPortfolioImages();

AtomicInteger orderNo = new AtomicInteger(0);
images.forEach(image -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ public void addPortfolioImage(PortfolioImage portfolioImage) {
this.portfolioImages.add(portfolioImage);
}

public void removeAllPortfolioImages() {
this.portfolioImages.clear();
}

public void update(LocalDate startDate, LocalDate endDate, String description) {
this.startDate = startDate == null ? this.startDate : startDate;
this.endDate = endDate == null ? this.endDate : endDate;
Expand Down

0 comments on commit e46c766

Please sign in to comment.