Skip to content

Commit 8eaf4c6

Browse files
committed
slack(article): send message when article is fetched
1 parent d0135a5 commit 8eaf4c6

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

backend/src/main/java/wooteco/prolog/article/ui/ArticleController.java

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package wooteco.prolog.article.ui;
22

33
import lombok.RequiredArgsConstructor;
4+
import org.springframework.beans.factory.annotation.Value;
45
import org.springframework.http.ResponseEntity;
56
import org.springframework.web.bind.annotation.DeleteMapping;
67
import org.springframework.web.bind.annotation.GetMapping;
@@ -29,6 +30,11 @@
2930
public class ArticleController {
3031

3132
private final ArticleService articleService;
33+
@Value("${slack.article.token}")
34+
private String slackToken;
35+
36+
@Value("${slack.article.channel}")
37+
private String slackChannel;
3238

3339
@PostMapping
3440
public ResponseEntity<Void> createArticles(@RequestBody final ArticleRequest articleRequest,
@@ -70,8 +76,8 @@ public ResponseEntity<Void> likeArticle(@PathVariable final Long id,
7076

7177
@GetMapping
7278
public ResponseEntity<List<ArticleResponse>> getFilteredArticles(@AuthMemberPrincipal final LoginMember member,
73-
@RequestParam("course") final ArticleFilterType course,
74-
@RequestParam("onlyBookmarked") boolean onlyBookmarked) {
79+
@RequestParam("course") final ArticleFilterType course,
80+
@RequestParam("onlyBookmarked") boolean onlyBookmarked) {
7581
final List<ArticleResponse> articleResponses = articleService.getFilteredArticles(member, course, onlyBookmarked);
7682

7783
return ResponseEntity.ok(articleResponses);
@@ -89,4 +95,9 @@ public ResponseEntity<List<ArticleResponse>> fetchArticles(@RequestParam(require
8995
List<ArticleResponse> articleResponses = articleService.fetchArticlesOf(username);
9096
return ResponseEntity.ok().body(articleResponses);
9197
}
98+
99+
@GetMapping("/test")
100+
public ResponseEntity<String> test() {
101+
return ResponseEntity.ok().body("result: " + slackChannel + " : " +slackToken);
102+
}
92103
}

backend/src/main/resources/application-local.yml

+4
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ elasticsearch:
2020
manager:
2121
role: GUEST
2222

23+
slack:
24+
article:
25+
token: token
26+
channel: channel

0 commit comments

Comments
 (0)