-
Notifications
You must be signed in to change notification settings - Fork 6
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
[User] 친구 신청 조회 API 구현 #174
Conversation
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.
고생하셨어요!
val friendRequests: MutableList<GetFriendRequestResponse> = mutableListOf() | ||
|
||
for (friendRelation in friendRelations) { | ||
val friend = friendRelation.friend | ||
friendRequests.add(GetFriendRequestResponse(friend.id!!, friend.username)) | ||
} |
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.
stream api 사용하면 좀 더 가독성 좋은 코드가 될 것 같아요!
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.
넵 stream api 사용해 코드 수정해보겠습니다~!
"data.friendRequests" type JsonDataType.Arrays mean "친구신청한 사용자 리스트" | ||
"data.friendRequests[].friendId" type Strings mean "친구신청한 사용자 아이디" | ||
"data.friendRequests[].username" type Strings mean "친구신청한 사용자 닉네임" | ||
} |
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.
frinedRequest는 무슨의미로 사용한 건가요?
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.
friendReuqests는 로그인한 사용자가 받은 친구신청 목록을 의미합니다!
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.
고생많으셨어요1!!👍😉
@PostMapping("/user/{userId}/friend/{friendId}") | ||
fun addFriend( | ||
@RequestHeader("Authorization") token: String, | ||
@PathVariable userId: Long, |
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.
이건 토큰에서 뽑을 수 있는 userId랑은 다른 정보일까요?! 제가 생각하기에는 요청하는 user의 id를 토큰에서 뽑아와서 사용하면 될 것 같은데..! 입력을 따로 받는 이유가 있나요?! 궁금합니다 😽
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.
토큰에서 뽑을 수 있는 userId랑 같은 정보입니다! 기존에 작성되어 있던 코드들이 pathVariable로 userId를 받아와서 동일하게 코드 작성했었는데, user쪽 기능 구현 다 하면 수정해봐도 좋을 것 같아요! 추후에 수정하겠습니다~!
|
||
data class GetFriendRequestsResponse( | ||
val userId: Long, | ||
var friendRequests: MutableList<GetFriendRequestResponse>, |
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.
immutable한 타입을 사용하는것은 어떻게 생각하시낭요??
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.
가져온 친구 신청 목록 담는 용도라 immutable한 타입이 좋겠네요!! 해당 코드 수정하겠습니다~!
#️⃣연관된 이슈
📝작업 내용