-
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
[프로필] [팔로우] 팔로워, 팔로잉 프로필 조회 기능 개발 #26
[프로필] [팔로우] 팔로워, 팔로잉 프로필 조회 기능 개발 #26
Conversation
import org.springframework.stereotype.Controller | ||
import org.springframework.web.bind.annotation.* | ||
|
||
@Controller |
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.
@RestController 를 사용하는건 어떤가요?
ResponseBody가 따로 없어서 안쓰신건가용
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.
아뇨 그냥 생각없이 쓴 것 같아요.. 수정 하겠습니답
|
||
@Table(name = "follow") | ||
@Entity | ||
data class Follow( |
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.
Entity 에 data class 를 사용하신 이유가 있으신가욜? 몰라서
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.
생각없이 썼어서 이유는 없었는데요,
https://velog.io/@heyday_7/JPA-Entity-%EC%8B%AC%EC%B8%B5%ED%83%90%EA%B5%AC-1-Entity%EC%97%90-Kotlin-Data-class%EB%A5%BC-%EC%8D%A8%EB%8F%84-%EB%90%A0%EA%B9%8C
보니깐 없애는게 맞는것 같네요~ 수정 하겠습니다
follower, followee?? |
나름 구글링도 해보고 고민했을때 이게 젤 직관적이긴 한데, @gusah009 도 ok하면 그대로 픽스할게요~ |
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.
테스트까지...ㄷㄷ 👍👍
크게 크리티컬한 커멘트들은 아니라서 approve 하겠습니당~
파일들 전체적으로 파일 맨 마지막에 newline이 없는 것 같아요~
|
||
@RestController | ||
@RequestMapping("/follow") | ||
@RequiredArgsConstructor |
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.
@RequiredArgsConstructor
는 없어도 될 것 같습니당
@Column(name = "follower_number") | ||
var followerNumber: Int, | ||
@Column(name = "following_number") | ||
var followingNumber: Int, |
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.
follower_number
, following_number
는 캐싱용 컬럼인가요?
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.
아뇽 특정 프로필을 팔로우하는 인원 수와 팔로잉하는 인원수를 표시하기 위함입니다.
(팔로워 수만 필요하고, 팔로워 프로필을 조회할 필요가 없을때 사용하기 위함)
|
||
fun update(profileUpdateRequest: ProfileUpdateRequest) { | ||
this.name = profileUpdateRequest.name | ||
} | ||
fun addFollower(follow: Follow) { | ||
followers.add(follow) |
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.
followers.add(follow)
, followings.add(following)
는 객체지향적으로 만들기 위해서 넣은걸까요?
혹시나 그런거라면 지우는게 좋을 것 같습니당. cascade를 사용하는게 아니라면 굳이 싶기도 하고, getFollowers()
를 호출할 때 모든 follower를 가져와서 성능 하락이 올 수도 있을 것 같아요.
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 followers = followRepository.findAllByToProfile(profile).stream() | ||
.map { follows -> follows.fromProfile } | ||
.toList() | ||
return AllProfileResponse().addProfileInfoInFollows(followers) |
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.
생성자에 바로 followers
를 넣지 않고 한 번 더 메서드를 호출해서 넣어주는 이유가 있을까요??
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.
저도 그렇게 하고 싶은데, 생성자 충돌? 난다고 코틀린에서 막아버려서 일단 이렇게 했습니다. (언어 숙달 부족 이슈)
관련 이슈
close #22
변경 사항
참고 사항
변경 사항 좀 많습니다.
restdocs쓸지, swagger 쓸지 안정해서 controller는 아직 테스트 코드를 안짰습니다. (귀찮은거 아님ㅋ)
postman으로 테스트는 완료.
팔로우 Entity에는 [팔로우를 건사람, 팔로우를 당한 사람] 이 2개가 필요한데, 적절한 변수명이 안떠올라서 fromProfile, toProfile로 정의했습니다. 의견 있으면 주세용