Skip to content

Commit

Permalink
slack(article): send message when article is fetched
Browse files Browse the repository at this point in the history
  • Loading branch information
gracefulBrown committed May 28, 2024
1 parent d0135a5 commit 8eaf4c6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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<Void> createArticles(@RequestBody final ArticleRequest articleRequest,
Expand Down Expand Up @@ -70,8 +76,8 @@ public ResponseEntity<Void> likeArticle(@PathVariable final Long id,

@GetMapping
public ResponseEntity<List<ArticleResponse>> 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<ArticleResponse> articleResponses = articleService.getFilteredArticles(member, course, onlyBookmarked);

return ResponseEntity.ok(articleResponses);
Expand All @@ -89,4 +95,9 @@ public ResponseEntity<List<ArticleResponse>> fetchArticles(@RequestParam(require
List<ArticleResponse> articleResponses = articleService.fetchArticlesOf(username);
return ResponseEntity.ok().body(articleResponses);
}

@GetMapping("/test")
public ResponseEntity<String> test() {
return ResponseEntity.ok().body("result: " + slackChannel + " : " +slackToken);
}
}
4 changes: 4 additions & 0 deletions backend/src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ elasticsearch:
manager:
role: GUEST

slack:
article:
token: token
channel: channel

0 comments on commit 8eaf4c6

Please sign in to comment.