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]인기글 관련 노티 발생 기능 구현 #207

Merged
merged 1 commit into from
May 9, 2024
Merged

Conversation

Hong0329
Copy link
Contributor

@Hong0329 Hong0329 commented May 8, 2024

📣 Related Issue

📝 Summary

  • 좋아요 개수 * 1 + 댓글 개수 * 1.6 을 통해서 해당 값이 가장 높은 어제 작성된 게시물에 대하여 노티를 발생시키는 기능을 구현했습니다.
  • 작성자에게는 인기글로 선정되었다는 노티 + 인기글 노티 2가지를, delete되지 않은 모든 사용자에게는 인기글 노티1가지를 발생시키도록 하였습니다.

🙏 Question & PR point

📬 Postman

사진 첨부의 경우 DataGrip을 한 눈에 보기 쉽게 찍을 수가 없어서 못올렸습니다. DataGrip에서 dev용 스키마의 notification테이블 참고 부탁드립니다.!!

Comment on lines +54 to +78
Member topContentWriter = topContent.getMember();

Notification popularWriterNotification = Notification.builder()
.notificationTargetMember(topContentWriter)
.notificationTriggerMemberId(-1L)
.notificationTriggerType("popularWriter")
.notificationTriggerId(topContent.getId())
.isNotificationChecked(false)
.notificationText("")
.build();
Notification savedPopularWriterNotification = notificationRepository.save(popularWriterNotification);

List<Member> activeMembers = memberRepository.findAllActiveMembers();

for (Member activeMember : activeMembers) {
Notification popularContentNotification = Notification.builder()
.notificationTargetMember(activeMember)
.notificationTriggerMemberId(-1L)
.notificationTriggerType("popularContent")
.notificationTriggerId(topContent.getId())
.isNotificationChecked(false)
.notificationText(topContent.getContentText())
.build();
Notification savedPopularContentNotification = notificationRepository.save(popularContentNotification);
}
Copy link
Member

Choose a reason for hiding this comment

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

인기글 작성자와 계정을 삭제하지않은 유저에게 따로 노티를 발생시키신 이유가 궁금합니다! 인기글 작성자가 탈퇴했을 경우를 고려하신걸까요?? 인기글 작성자에게 노티가 2번 발생할까하는 생각이 들었습니다 !

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image
위의 와프와 같이 작성자의 경우 해당 작성자의 게시글이 인기게시물로 선정되었다는 노티를 발생시켜야해서 그렇습니다!!

Copy link
Member

Choose a reason for hiding this comment

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

아 notificationTargetMember이 다른 부분을 놓쳤네요 !! 설명 감사합니다~!~!

Comment on lines +46 to +51
Content topContent = contents.stream()
.map(c -> new AbstractMap.SimpleEntry<>(c, contentLikedRepository.countByContent(c) + commentRepository.countByContent(c) * 1.6))
.filter(e -> e.getValue() >= 5)
.max(Comparator.comparingDouble(Map.Entry::getValue))
.map(Map.Entry::getKey)
.orElse(null);
Copy link
Member

Choose a reason for hiding this comment

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

오우..한줄한줄 뜯어봤습니다.. 어렵네요 고생하셨어요!!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ㅎㅎ감사합니다~~!!

Copy link
Member

@bo-ram-bo-ram bo-ram-bo-ram left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!!

@Hong0329 Hong0329 merged commit 8d46de8 into develop May 9, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT] 인기글 관련 노티 발생 기능 개발
2 participants