Skip to content

Commit

Permalink
Merge pull request #181 from team-offonoff/fix
Browse files Browse the repository at this point in the history
fix: 토픽 조회 시 stream에서 member 조회하지 않고 한 번만 조회
  • Loading branch information
60jong authored Feb 26, 2024
2 parents c0b94f1 + 7f8c793 commit 2020414
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,16 @@ public Topic findTopic(final Long topicId) {
* @param pageable
* @return
*/
public Slice<TopicResponse> findAll(final Long memberId, final TopicSearchRequest request, final Pageable pageable) {
public Slice<TopicResponse> findAll(final Long retrieverId, final TopicSearchRequest request, final Pageable pageable) {

Slice<Topic> topics = topicRepository.findAll(memberId, request, pageable);
Slice<Topic> topics = topicRepository.findAll(retrieverId, request, pageable);

if (memberId == null) {
if (retrieverId == null) {
return topics.map(TopicResponse::from);
}

return topics.map(topic -> TopicResponse.from(topic, findMember(memberId)));
Member retriever = findMember(retrieverId);
return topics.map(topic -> TopicResponse.from(topic, retriever));
}

//== Hide ==//
Expand Down

0 comments on commit 2020414

Please sign in to comment.