Skip to content

Commit

Permalink
#61 [feat] 키워드를 카테고리로 가져오는 서비스 로직 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
parkheeddong committed Jan 11, 2024
1 parent 23136e0 commit e7b292f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
10 changes: 10 additions & 0 deletions module-domain/src/main/java/com/mile/moim/serivce/MoimService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -66,4 +69,11 @@ private Moim findById(
() -> new NotFoundException(ErrorMessage.MOIM_NOT_FOUND)
);
}

public CategoryListResponse getCategoryList(
final Long moimId
) {
List<CategoryResponse> categoryList = topicService.getKeywordsFromMoim(moimId);
return CategoryListResponse.of(categoryList);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -61,4 +62,16 @@ public Topic findById(
() -> new NotFoundException(ErrorMessage.TOPIC_NOT_FOUND)
);
}

public List<CategoryResponse> getKeywordsFromMoim(
final Long moimId
) {
List<Topic> topicList = findByMoimId(moimId);
return topicList
.stream()
.map(CategoryResponse::of)
.collect(Collectors.toList());
}


}

0 comments on commit e7b292f

Please sign in to comment.