diff --git a/src/main/java/umc/meme/shop/domain/portfolio/dto/request/UpdatePortfolioDto.java b/src/main/java/umc/meme/shop/domain/portfolio/dto/request/UpdatePortfolioDto.java index ab52234..346865a 100644 --- a/src/main/java/umc/meme/shop/domain/portfolio/dto/request/UpdatePortfolioDto.java +++ b/src/main/java/umc/meme/shop/domain/portfolio/dto/request/UpdatePortfolioDto.java @@ -20,6 +20,6 @@ public class UpdatePortfolioDto { private String makeupName; private int price; private String info; - private boolean isBlock; + private Boolean isBlock; private PortfolioImgDto portfolioImg; } diff --git a/src/main/java/umc/meme/shop/domain/portfolio/dto/response/PortfolioDto.java b/src/main/java/umc/meme/shop/domain/portfolio/dto/response/PortfolioDto.java index 446b87e..dc67c83 100644 --- a/src/main/java/umc/meme/shop/domain/portfolio/dto/response/PortfolioDto.java +++ b/src/main/java/umc/meme/shop/domain/portfolio/dto/response/PortfolioDto.java @@ -43,10 +43,10 @@ public static PortfolioDto from(Portfolio portfolio) { .stream() .map(portfolioImg -> new PortfolioImgDto(portfolioImg.getPortfolioImgId(), portfolioImg.getSrc(), false)) .toList(); - System.out.println("getPortfolio"); - System.out.println(portfolio.getPortfolioImgList()); - System.out.println(portfolioImgDtoList); - System.out.println("Converting Portfolio ID " + portfolio.getPortfolioId() + " with " + portfolio.getPortfolioImgList().size() + " images"); +// System.out.println("getPortfolio"); +// System.out.println(portfolio.getPortfolioImgList()); +// System.out.println(portfolioImgDtoList); +// System.out.println("Converting Portfolio ID " + portfolio.getPortfolioId() + " with " + portfolio.getPortfolioImgList().size() + " images"); return PortfolioDto.builder() .portfolioId(portfolio.getPortfolioId()) diff --git a/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java b/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java index 8cd2f5b..1833115 100644 --- a/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java +++ b/src/main/java/umc/meme/shop/domain/portfolio/entity/Portfolio.java @@ -72,7 +72,7 @@ public void updatePortfolio(UpdatePortfolioDto request) { this.makeupName = request.getMakeupName(); } - this.isBlock = request.isBlock(); + this.isBlock = request.getIsBlock(); } public void updateReviewList(Review review){ diff --git a/src/main/java/umc/meme/shop/domain/portfolio/service/PortfolioService.java b/src/main/java/umc/meme/shop/domain/portfolio/service/PortfolioService.java index f7035c8..76432c7 100644 --- a/src/main/java/umc/meme/shop/domain/portfolio/service/PortfolioService.java +++ b/src/main/java/umc/meme/shop/domain/portfolio/service/PortfolioService.java @@ -9,7 +9,6 @@ import org.springframework.stereotype.Service; import umc.meme.shop.domain.artist.entity.Artist; import umc.meme.shop.domain.artist.repository.ArtistRepository; -import umc.meme.shop.domain.favorite.entity.FavoritePortfolio; import umc.meme.shop.domain.portfolio.converter.PortfolioConverter; import umc.meme.shop.domain.portfolio.dto.request.CreatePortfolioDto; import umc.meme.shop.domain.portfolio.dto.request.UpdatePortfolioDto; @@ -24,8 +23,8 @@ import umc.meme.shop.global.exception.GlobalException; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; -import java.util.stream.Collectors; @Service @RequiredArgsConstructor @@ -68,8 +67,6 @@ public void createPortfolio(CreatePortfolioDto portfolioDto) { portfolio.getPortfolioImgList().add(portfolioImg); // Portfolio의 이미지 리스트에 추가 } - System.out.println(portfolio.getPortfolioImgList()); - artist.updatePortfolioList(portfolio); portfolioRepository.save(portfolio); } @@ -80,8 +77,18 @@ public PortfolioPageDto getPortfolio(Long artistId, int page) { Artist artist = artistRepository.findById(artistId) .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_ARTIST)); - //page List portfolioList = artist.getPortfolioList(); + + //isblock이면 리스트에서 제거 + Iterator iterator = portfolioList.iterator(); + while (iterator.hasNext()) { + Portfolio portfolio = iterator.next(); + if (portfolio.isBlock()) { + iterator.remove(); + } + } + + //page로 mapping Pageable pageable = PageRequest.of(page, 30); int start = (int) pageable.getOffset(); int end = Math.min((start + pageable.getPageSize()), portfolioList.size()); @@ -98,6 +105,9 @@ public PortfolioDto getPortfolioDetails(Long portfolioId) { Portfolio portfolio = portfolioRepository.findById(portfolioId) .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_PORTFOLIO)); + if(portfolio.isBlock()) + throw new GlobalException(ErrorStatus.BLOCKED_PORTFOLIO); + return PortfolioDto.from(portfolio); } diff --git a/src/main/java/umc/meme/shop/global/ErrorStatus.java b/src/main/java/umc/meme/shop/global/ErrorStatus.java index 3f0ce69..d43437a 100644 --- a/src/main/java/umc/meme/shop/global/ErrorStatus.java +++ b/src/main/java/umc/meme/shop/global/ErrorStatus.java @@ -40,6 +40,7 @@ public enum ErrorStatus { //portfolio ALREADY_EXIST_PORTFOLIO(400, "해당 포트폴리오 제목이 이미 존재합니다"), INVALID_SORT_CRITERIA(400, "잘못된 정렬 기준입니다"), + BLOCKED_PORTFOLIO(400, "숨김 처리된 포트폴리오입니다"), //review ALREADY_REVIEWED(400, "이미 리뷰 작성이 완료된 예약입니다."),