-
Notifications
You must be signed in to change notification settings - Fork 4
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
[BE] 체크리스트 좋아요 서비스 구조를 분리한다. #607
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.
크나큰 업적 이루셨습니다!
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.
논의하고 싶은 내용에 적힌 내용이 ChecklistRepository의 findAllByUserAndIsLiked 관련 내용이죠? 저는 좋은 것 같습니다 이 방식이 더 직관적이고 이해하기 쉬운 것 같아요 👍
카피 수고많으셨습니다 😃
private void validateChecklistLike(User user, Checklist checklist) { | ||
validateChecklistOwnership(user, checklist); | ||
validateChecklistAlreadyLiked(checklist); | ||
} |
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.
메서드가 2개면 굳이 묶을 필요없다고 생각해요! createLike() 내에 두면 파악이 좀 더 쉬울 것 같아요~
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.
넵 반영했습니다~
@Transactional | ||
public void deleteLike(User user, Checklist checklist) { | ||
validateChecklistOwnership(user, checklist); | ||
ChecklistLike checklistLike = checklistLikeRepository.getByChecklistId(checklist.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.
repository 메서드 파라미터 타입 long -> Long으로 변경부탁드려요 !
|
||
//then | ||
assertAll( | ||
() -> assertThat(response.checklists().size()).isEqualTo(2), |
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.
() -> assertThat(response.checklists().size()).isEqualTo(2), | |
() -> assertThat(response.checklists().size()).hasSize(2), |
2 상수로 빼면 좋을 것 같아요!
@Autowired | ||
private ChecklistLikeRepository checklistLikeRepository; | ||
|
||
@DisplayName("체크리스트 좋아요 추가 성공") |
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.
카피 꼼꼼히 해 주셔서 리뷰할 게 많지 않네요! ㅎㅎ
@@ -3,6 +3,8 @@ | |||
import com.bang_ggood.checklist.domain.Checklist; | |||
import com.bang_ggood.checklist.dto.request.ChecklistRequest; | |||
import com.bang_ggood.checklist.dto.response.SelectedChecklistResponse; | |||
import com.bang_ggood.checklist.dto.response.UserChecklistPreviewResponse; |
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.
저희가 체크리스트 공유 기능이 있지 않고, 체크리스트에 유저 정보가 포함되지 않을 일이 없는데 user 명명을 쓴 이유가 궁금해요!
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.
예전에 사용하던거 그대로 사용했는데, User 빼도 좋을 것 같아서 이름 변경했습니다!
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController |
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.
제가 마지막 approve네요! 머지하겠습니다 🍀
❗ Issue
✨ 구현한 기능
📢 논의하고 싶은 내용
체크리스트 목록 좋아요 필터링 기능을 다음과 같은 순서로 구현하려고 시도했습니다.
하지만 ChecklistLike가 User를 가지고 있지 않아 Checklist, User와 join을 해야했습니다.
해당 방식도 동일한 join을 해야하기 때문에 기존 코드를 그대로 가져가는게 좋을 것 같아 유지했습니다.
다른 의견 있으시면 말씀해주세요!
🎸 기타