diff --git a/module-domain/src/main/java/com/mile/moim/serivce/MoimService.java b/module-domain/src/main/java/com/mile/moim/serivce/MoimService.java index 044c1259..323b8a96 100644 --- a/module-domain/src/main/java/com/mile/moim/serivce/MoimService.java +++ b/module-domain/src/main/java/com/mile/moim/serivce/MoimService.java @@ -5,12 +5,15 @@ import com.mile.exception.model.NotFoundException; import com.mile.moim.domain.Moim; import com.mile.moim.repository.MoimRepository; +import com.mile.moim.serivce.dto.CategoryListResponse; import com.mile.moim.serivce.dto.ContentListResponse; import com.mile.moim.serivce.dto.MoimAuthenticateResponse; import com.mile.moim.serivce.dto.MoimInfoResponse; import com.mile.topic.serivce.TopicService; +import com.mile.topic.serivce.dto.CategoryResponse; import com.mile.utils.DateUtil; import com.mile.writerName.serivce.WriterNameService; +import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -66,4 +69,11 @@ private Moim findById( () -> new NotFoundException(ErrorMessage.MOIM_NOT_FOUND) ); } + + public CategoryListResponse getCategoryList( + final Long moimId + ) { + List categoryList = topicService.getKeywordsFromMoim(moimId); + return CategoryListResponse.of(categoryList); + } } diff --git a/module-domain/src/main/java/com/mile/topic/serivce/TopicService.java b/module-domain/src/main/java/com/mile/topic/serivce/TopicService.java index 16f055a4..4c82bd52 100644 --- a/module-domain/src/main/java/com/mile/topic/serivce/TopicService.java +++ b/module-domain/src/main/java/com/mile/topic/serivce/TopicService.java @@ -3,6 +3,7 @@ import com.mile.config.BaseTimeEntity; import com.mile.exception.message.ErrorMessage; import com.mile.exception.model.NotFoundException; +import com.mile.topic.serivce.dto.CategoryResponse; import com.mile.topic.domain.Topic; import com.mile.topic.repository.TopicRepository; import com.mile.topic.serivce.dto.ContentResponse; @@ -61,4 +62,16 @@ public Topic findById( () -> new NotFoundException(ErrorMessage.TOPIC_NOT_FOUND) ); } + + public List getKeywordsFromMoim( + final Long moimId + ) { + List topicList = findByMoimId(moimId); + return topicList + .stream() + .map(CategoryResponse::of) + .collect(Collectors.toList()); + } + + }