Skip to content

Commit

Permalink
πŸ”€ :: (#35) μžμ‹ μ˜ κ²Œμ‹œλ¬Όμ— μ•ŒλžŒ κ°€λŠ” 버그 μˆ˜μ • (#103)
Browse files Browse the repository at this point in the history
* πŸ› :: μžμ‹ μ˜ κ²Œμ‹œλ¬Όμ— μ•ŒλžŒ κ°€λŠ” 버그 μˆ˜μ •

* ♻️ :: μ½”λ“œ μ •λ ¬
  • Loading branch information
jyk1029 authored Jun 2, 2023
1 parent ebb5be5 commit 03b3842
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,39 @@ public class CommentApiImpl implements CommentApi {
@Override
public void saveComment(CreateCommentDomainRequest request) {
Feed feed = queryFeedSpi.queryFeedById(request.getFeedId());
UUID userId = securitySpi.getCurrentUserId();

commandCommentSpi.saveComment(
Comment.builder()
.content(request.getContent())
.feedId(feed.getId())
.userId(securitySpi.getCurrentUserId())
.userId(userId)
.createAt(LocalDateTime.now())
.updatedAt(LocalDateTime.now())
.build()
);

if (feed.getType().equals(CategoryEnum.NOTICE.getName())) {
sendNotification(FEED_NOTICE_COMMENT, feed);
} else {
sendNotification(FEED_BAMBOO_COMMENT, feed);
if(feed.getUserId().equals(userId)) {
sendNotification(feed);
}
}

private void sendNotification(String topic, Feed feed) {
notificationSpi.sendNotification(
feed.getUserId(),
topic,
CONTENT,
feed.getId().toString()
);
private void sendNotification(Feed feed) {
if (feed.getType().equals(CategoryEnum.NOTICE.getName())) {
notificationSpi.sendNotification(
feed.getUserId(),
FEED_NOTICE_COMMENT,
CONTENT,
feed.getId().toString()
);
} else {
notificationSpi.sendNotification(
feed.getUserId(),
FEED_BAMBOO_COMMENT,
CONTENT,
feed.getId().toString()
);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,31 @@ public void saveFeedLike(UUID feedId) {
commandFeedLikeSpi.saveFeedLike(
FeedLike.builder()
.feedId(feed.getId())
.userId(securitySpi.getCurrentUserId())
.userId(userId)
.build()
);

if (feed.getType().equals(CategoryEnum.NOTICE.getName())) {
sendNotification(FEED_NOTICE_LIKE, feed);
} else {
sendNotification(FEED_BAMBOO_LIKE, feed);
if (!feed.getUserId().equals(userId)) {
sendNotification(feed);
}
}

private void sendNotification(String topic, Feed feed) {
notificationSpi.sendNotification(
feed.getUserId(),
topic,
CONTENT,
feed.getId().toString()
);
private void sendNotification(Feed feed) {
if (feed.getType().equals(CategoryEnum.NOTICE.getName())) {
notificationSpi.sendNotification(
feed.getUserId(),
FEED_NOTICE_LIKE,
CONTENT,
feed.getId().toString()
);
} else {
notificationSpi.sendNotification(
feed.getUserId(),
FEED_BAMBOO_LIKE,
CONTENT,
feed.getId().toString()
);
}
}

@Override
Expand Down

0 comments on commit 03b3842

Please sign in to comment.