diff --git a/api/src/main/java/com/sponus/sponusbe/domain/portfolio/service/PortfolioService.java b/api/src/main/java/com/sponus/sponusbe/domain/portfolio/service/PortfolioService.java index 84dafc1..da76758 100644 --- a/api/src/main/java/com/sponus/sponusbe/domain/portfolio/service/PortfolioService.java +++ b/api/src/main/java/com/sponus/sponusbe/domain/portfolio/service/PortfolioService.java @@ -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 -> { diff --git a/core/core-domain/src/main/java/com/sponus/coredomain/domain/portfolio/Portfolio.java b/core/core-domain/src/main/java/com/sponus/coredomain/domain/portfolio/Portfolio.java index bea29f8..e7e9421 100644 --- a/core/core-domain/src/main/java/com/sponus/coredomain/domain/portfolio/Portfolio.java +++ b/core/core-domain/src/main/java/com/sponus/coredomain/domain/portfolio/Portfolio.java @@ -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;