diff --git a/src/main/java/com/example/neoul/service/StoryService.java b/src/main/java/com/example/neoul/service/StoryService.java index 09aa3ba..c41a91a 100644 --- a/src/main/java/com/example/neoul/service/StoryService.java +++ b/src/main/java/com/example/neoul/service/StoryService.java @@ -23,12 +23,27 @@ public class StoryService { private final BrandRepository brandRepository; private final BrandService brandService; + // public List getStoryList() { + // List vCategoryList = categoryVRepository.findAll(); + // List responseList = new ArrayList<>(); + // for (CategoryV vCategory : vCategoryList) { + // Story story = storyRepository.findAllByCategoryV(vCategory).stream().findAny() + // .orElseThrow(() -> new NotFoundException("스토리가 존재하지 않습니다.")); + // StoryRes.StoryListRes StoryListRes = StoryRes.StoryListRes.builder() + // .storyId(story.getId()) + // .categoryVName(story.getCategoryV().getName()) + // .preImg(story.getImg()) + // .title(story.getTitle()) + // .createdAt(story.getCreatedAt()) + // .build(); + // responseList.add(StoryListRes); + // } + // return responseList; + // } public List getStoryList() { - List vCategoryList = categoryVRepository.findAll(); List responseList = new ArrayList<>(); - for (CategoryV vCategory : vCategoryList) { - Story story = storyRepository.findAllByCategoryV(vCategory).stream().findAny() - .orElseThrow(() -> new NotFoundException("스토리가 존재하지 않습니다.")); + List storyList = storyRepository.findAll(); + for (Story story : storyList) { StoryRes.StoryListRes StoryListRes = StoryRes.StoryListRes.builder() .storyId(story.getId()) .categoryVName(story.getCategoryV().getName())