From e46c766629d0490512a772bc4f47ec47c8e06fab Mon Sep 17 00:00:00 2001 From: Yuje Lee Date: Sun, 4 Aug 2024 16:41:31 +0900 Subject: [PATCH] =?UTF-8?q?!hotfix:=20=ED=8F=AC=ED=8A=B8=ED=8F=B4=EB=A6=AC?= =?UTF-8?q?=EC=98=A4=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 이미지 삭제 로직이 포함되어 있지 않았음. 이미지 업데이트시, 초기화 후, 인풋으로 들어온 이미지들로만 다시 등록하는 로직으로 변경 --- .../sponusbe/domain/portfolio/service/PortfolioService.java | 3 ++- .../com/sponus/coredomain/domain/portfolio/Portfolio.java | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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;