Skip to content
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] #20 인플루언서 좋아요와 반영하여 반환하도록 했어요 #72

Merged
merged 14 commits into from
Oct 18, 2024

Conversation

wndlthsk
Copy link
Contributor

@wndlthsk wndlthsk commented Oct 17, 2024

✨ 작업 내용

  • 로그인 했을 때 좋아요한 인플루언서 먼저 반환되도록 구현
  • 인플루언서 좋아요/ 좋아요 취소 기능

✨ 참고 사항

  • db에 favorite_influencer 테이블이 없어서 추가돼야 할듯합니다

⏰ 현재 버그


✏ Git Close

@wndlthsk wndlthsk added the ✨ Feature 기능 개발 label Oct 17, 2024
@wndlthsk wndlthsk self-assigned this Oct 17, 2024
Copy link
Contributor

@sanghee0820 sanghee0820 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰 작성했습니다.

List<FavoriteInfluencer> findByUserId(Long userId);

Optional<FavoriteInfluencer> findByUserAndInfluencer(User user, Influencer influencer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

왜 객체로 호출하는지 여줘봐도 될까요?

Comment on lines 44 to 48
Set<Long> likedInfluencerIds = favoriteRepository.findByUserId(userId).stream()
.filter(FavoriteInfluencer::isLiked)
.map(FavoriteInfluencer::getInfluencer)
.map(Influencer::getId)
.collect(Collectors.toSet());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set으로 하신 이유가 있을까요?

FavoriteInfluencer favorite = favoriteRepository.findByUserAndInfluencer(user, influencer)
.orElseGet(() -> new FavoriteInfluencer(user, influencer)); // 존재하지 않으면 새로 생성

favorite.updateLike(param.likes());
favoriteRepository.save(favorite);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transaction이 있는데 save가 필요할까요?

Copy link
Contributor Author

@wndlthsk wndlthsk Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.orElseGet(() -> new FavoriteInfluencer(user, influencer)) 여기서 새 객체 생성되는 경우에는 save 필요하지 않나요?!?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 저 부분을 놓쳤네요! 굳입니다.

Copy link
Contributor

@dong-yxxn dong-yxxn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고많으셨습니다! approve 하겠습니다.

Copy link
Contributor

@sanghee0820 sanghee0820 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정사항 반영해주셔서 감사합니다 고생하셧어요!

@sanghee0820 sanghee0820 merged commit adc7074 into weekly/7 Oct 18, 2024
@sanghee0820 sanghee0820 deleted the feat/#20-influencer branch October 31, 2024 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature 기능 개발
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants