-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: 팔로우 추가 / 취소 기능 #191
feat: 팔로우 추가 / 취소 기능 #191
Conversation
|
||
public void createFollow(FollowCreateRequest request) { | ||
final Member currentMember = memberUtil.getCurrentMember(); | ||
Member targetMember = |
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.
중복로직이라면 어떤 부분일까용?
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.
targetMember 쿼리하는 부분이 겹치는 것 같아서요~
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.
확인했슴니당
ErrorCode.FOLLOW_TARGET_MEMBER_NOT_FOUND)); | ||
|
||
memberRelationRepository | ||
.findByFollowerIdAndFollowingId(currentMember.getId(), targetMember.getId()) |
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.
existBy
쓰는 건 어떨까요?
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.
MemberRelation memberRelation =
memberRelationRepository
.findByFollowerIdAndFollowingId(currentMember.getId(), targetMember.getId())
.orElseThrow(() -> new CustomException(ErrorCode.FOLLOW_NOT_EXIST));
memberRelationRepository.delete(memberRelation);
현재 코드가 MemberRelation이 존재하지 않을 때 예외를 발생시키는데, 존재할때 해당 객체로 바로 삭제를 진행하는데
existBy로 값이 없다면 예외를 터트리고, 있을 때 MemberRelation을 조회하는 쿼리가 한번 더 나가게되는데
요거에 대해서는 어떻게 생각하시나용?
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.
말씀하신대로 delete는 그렇고, save는 exist 써도 문제 없지 않나요?
Quality Gate passedThe SonarCloud Quality Gate passed, but some issues were introduced. 38 New issues |
🌱 관련 이슈
📌 작업 내용 및 특이사항
팔로우 추가할 때 예외상황
팔로우를 취소할 때 예외상황