Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] 특정 데일리 질문에 대한 친구들의 답변 몰아보기 API 작성 #118

Merged
merged 2 commits into from
Nov 29, 2023

Conversation

bongsh0112
Copy link
Member

📝 PR Summary

특정 데일리 질문에 대한 친구들의 답변 몰아보기 API 작성

🌲 Working Branch

feat/112-neighbor-answer-list

🌲 TODOs

Related Issues

close #112

Comment on lines +36 to +43
public static AnswerInfoVo from(Answer answer) {
return AnswerInfoVo.builder()
.id(Optional.ofNullable(answer).map(Answer::getId).orElse(null))
.questionId(Optional.ofNullable(answer).map(Answer::getQuestionId).orElse(null))
.userId(Optional.ofNullable(answer).map(Answer::getUserId).orElse(null))
.content(Optional.ofNullable(answer).map(Answer::getContent).orElse(null))
.build();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이건 혹시 무슨일이 있었던 거죠?? answer가 없는데 조회 할 일이 있나요??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

내 친구들이 특정 데일리 질문에 답변하지 않았을 때 그 친구들은 answer가 null이기 때문입니닷

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +65 to +77
List<User> neighborList =
neighborAdaptor.queryAllByFromUserId(userId).stream()
.map(Neighbor::getToUserId)
.map(userAdaptor::query)
.toList();
List<Long> blockedIdList =
userBlockAdaptor.queryAllByFromUserId(userId).stream()
.map(UserBlock::getToUserId)
.toList();
List<Long> friendIdList =
neighborAdaptor.queryAllByFromUserId(userId).stream()
.map(Neighbor::getToUserId)
.toList();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neighborList와 friendIdList가 다른게 뭐죠??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neighborList는 User 객체 list고 friendIdList는 User pk list입니다
둘 중에 하나를 지울 수 있을 것 같기도 하네요...?!?!

Copy link
Contributor

@sanbonai06 sanbonai06 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이건 내일 아침에 다시 봐야 할 것 같아요
저 위에 것만 먼저 수정해주세용

Comment on lines 80 to 91
Slice<RetrieveNeighborDTO> neighbors =
neighborAdaptor.searchNeighbors(neighborCondition, pageable);
List<NeighborAnswerInfoDTO> list =
neighbors.stream()
.map(
dto -> {
Optional<Answer> answer =
answerAdaptor.optionalQueryByQuestionAndUser(
questionId, dto.getNeighborId());
return NeighborAnswerInfoDTO.builder()
.neighborInfo(dto)
.answerInfo(AnswerInfoVo.from(answer.orElse(null)))
.build();
})
.toList();
return SliceResponse.of(SliceUtil.valueOf(list, pageable));
List<RetrieveNeighborDTO> neighbors = neighborAdaptor.searchNeighbors(neighborCondition);
return neighbors.stream()
.map(
dto -> {
Optional<Answer> answer =
answerAdaptor.optionalQueryByQuestionAndUser(
questionId, dto.getNeighborId());
return NeighborAnswerInfoDTO.builder()
.neighborInfo(dto)
.answerInfo(AnswerInfoVo.from(answer.orElse(null)))
.build();
})
.toList();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

속이 뻥

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ㅋㅋㅋㅋㅋㅋㅋㅋㅋ

@bongsh0112 bongsh0112 merged commit 22ffb5c into dev Nov 29, 2023
1 check passed
@bongsh0112 bongsh0112 deleted the feat/112-neighbor-answer-list branch November 30, 2023 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] 친구인 유저들의 데일리 답변 리스트 조회 API 작성
2 participants