Skip to content

Commit

Permalink
๐Ÿ”€ :: (#31) ์นดํ…Œ๊ณ ๋ฆฌ์— ๋”ฐ๋ผ ์ข‹์•„์š”, ๋Œ“๊ธ€ topic ๋ถ„๋ฆฌ (#102)
Browse files Browse the repository at this point in the history
* โ™ป๏ธ :: ๊ณต์ง€์‚ฌํ•ญ ์ข‹์•„์š”, ๋Œ“๊ธ€ topic ๋ถ„๋ฆฌ

* โ™ป๏ธ :: ๋ฉ”์†Œ๋“œ๋กœ ๋ถ„๋ฆฌ
  • Loading branch information
jyk1029 authored Jun 1, 2023
1 parent bb088d5 commit ebb5be5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.xquare.v1servicefeed.comment.spi.CommandCommentSpi;
import com.xquare.v1servicefeed.comment.spi.QueryCommentSpi;
import com.xquare.v1servicefeed.configuration.spi.SecuritySpi;
import com.xquare.v1servicefeed.feed.CategoryEnum;
import com.xquare.v1servicefeed.feed.Feed;
import com.xquare.v1servicefeed.feed.spi.QueryFeedSpi;
import com.xquare.v1servicefeed.notification.NotificationSpi;
Expand All @@ -35,7 +36,8 @@ public class CommentApiImpl implements CommentApi {
private final QueryCommentSpi queryCommentSpi;
private final SecuritySpi securitySpi;
private final NotificationSpi notificationSpi;
private static final String FEED_COMMENT = "FEED_COMMENT";
private static final String FEED_NOTICE_COMMENT = "FEED_NOTICE_COMMENT";
private static final String FEED_BAMBOO_COMMENT = "FEED_BAMBOO_COMMENT";
private static final String CONTENT = "๋Œ“๊ธ€์ด ๋‹ฌ๋ ธ์Šต๋‹ˆ๋‹ค.";

@Override
Expand All @@ -52,9 +54,17 @@ public void saveComment(CreateCommentDomainRequest request) {
.build()
);

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

private void sendNotification(String topic, Feed feed) {
notificationSpi.sendNotification(
feed.getUserId(),
FEED_COMMENT,
topic,
CONTENT,
feed.getId().toString()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.xquare.v1servicefeed.annotation.DomainService;
import com.xquare.v1servicefeed.configuration.spi.SecuritySpi;
import com.xquare.v1servicefeed.feed.CategoryEnum;
import com.xquare.v1servicefeed.feed.Feed;
import com.xquare.v1servicefeed.feed.spi.QueryFeedSpi;
import com.xquare.v1servicefeed.feedlike.FeedLike;
Expand All @@ -23,6 +24,9 @@ public class FeedLikeApiImpl implements FeedLikeApi {
private final QueryFeedLikeSpi queryFeedLikeSpi;
private final SecuritySpi securitySpi;
private final NotificationSpi notificationSpi;
private static final String FEED_NOTICE_LIKE = "FEED_NOTICE_COMMENT";
private static final String FEED_BAMBOO_LIKE = "FEED_BAMBOO_COMMENT";
private static final String CONTENT = "์ข‹์•„์š”๊ฐ€ ๋‹ฌ๋ ธ์Šต๋‹ˆ๋‹ค.";

@Override
public void saveFeedLike(UUID feedId) {
Expand All @@ -40,10 +44,18 @@ public void saveFeedLike(UUID feedId) {
.build()
);

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

private void sendNotification(String topic, Feed feed) {
notificationSpi.sendNotification(
feed.getUserId(),
"FEED_LIKE",
"์ข‹์•„์š”๊ฐ€ ๋‹ฌ๋ ธ์Šต๋‹ˆ๋‹ค.",
topic,
CONTENT,
feed.getId().toString()
);
}
Expand Down

0 comments on commit ebb5be5

Please sign in to comment.