From 8eaf4c6c269b0afdccd9bb595fa2a9976363190e Mon Sep 17 00:00:00 2001 From: gracefulBrown Date: Wed, 29 May 2024 06:23:27 +0900 Subject: [PATCH] slack(article): send message when article is fetched --- .../prolog/article/ui/ArticleController.java | 15 +++++++++++++-- backend/src/main/resources/application-local.yml | 4 ++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/wooteco/prolog/article/ui/ArticleController.java b/backend/src/main/java/wooteco/prolog/article/ui/ArticleController.java index 2118fa194..c30b9cd8c 100644 --- a/backend/src/main/java/wooteco/prolog/article/ui/ArticleController.java +++ b/backend/src/main/java/wooteco/prolog/article/ui/ArticleController.java @@ -1,6 +1,7 @@ package wooteco.prolog.article.ui; import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; @@ -29,6 +30,11 @@ public class ArticleController { private final ArticleService articleService; + @Value("${slack.article.token}") + private String slackToken; + + @Value("${slack.article.channel}") + private String slackChannel; @PostMapping public ResponseEntity createArticles(@RequestBody final ArticleRequest articleRequest, @@ -70,8 +76,8 @@ public ResponseEntity likeArticle(@PathVariable final Long id, @GetMapping public ResponseEntity> getFilteredArticles(@AuthMemberPrincipal final LoginMember member, - @RequestParam("course") final ArticleFilterType course, - @RequestParam("onlyBookmarked") boolean onlyBookmarked) { + @RequestParam("course") final ArticleFilterType course, + @RequestParam("onlyBookmarked") boolean onlyBookmarked) { final List articleResponses = articleService.getFilteredArticles(member, course, onlyBookmarked); return ResponseEntity.ok(articleResponses); @@ -89,4 +95,9 @@ public ResponseEntity> fetchArticles(@RequestParam(require List articleResponses = articleService.fetchArticlesOf(username); return ResponseEntity.ok().body(articleResponses); } + + @GetMapping("/test") + public ResponseEntity test() { + return ResponseEntity.ok().body("result: " + slackChannel + " : " +slackToken); + } } diff --git a/backend/src/main/resources/application-local.yml b/backend/src/main/resources/application-local.yml index cfadb3e90..6b94c3dbf 100644 --- a/backend/src/main/resources/application-local.yml +++ b/backend/src/main/resources/application-local.yml @@ -20,3 +20,7 @@ elasticsearch: manager: role: GUEST +slack: + article: + token: token + channel: channel