-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
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); | ||
} |
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번 발생할까하는 생각이 들었습니다 !
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.
아 notificationTargetMember이 다른 부분을 놓쳤네요 !! 설명 감사합니다~!~!
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); |
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.
고생하셨습니다!!
📣 Related Issue
📝 Summary
좋아요 개수 * 1 + 댓글 개수 * 1.6
을 통해서 해당 값이 가장 높은 어제 작성된 게시물에 대하여 노티를 발생시키는 기능을 구현했습니다.🙏 Question & PR point
📬 Postman
사진 첨부의 경우 DataGrip을 한 눈에 보기 쉽게 찍을 수가 없어서 못올렸습니다. DataGrip에서 dev용 스키마의 notification테이블 참고 부탁드립니다.!!