-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
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(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이건 혹시 무슨일이 있었던 거죠?? answer가 없는데 조회 할 일이 있나요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
내 친구들이 특정 데일리 질문에 답변하지 않았을 때 그 친구들은 answer가 null이기 때문입니닷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neighborList와 friendIdList가 다른게 뭐죠??
There was a problem hiding this comment.
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입니다
둘 중에 하나를 지울 수 있을 것 같기도 하네요...?!?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이건 내일 아침에 다시 봐야 할 것 같아요
저 위에 것만 먼저 수정해주세용
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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
속이 뻥
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ㅋㅋㅋㅋㅋㅋㅋㅋㅋ
📝 PR Summary
특정 데일리 질문에 대한 친구들의 답변 몰아보기 API 작성
🌲 Working Branch
feat/112-neighbor-answer-list
🌲 TODOs
Related Issues
close #112