-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#165/refactor]: article 배치 실행 api에 인증 추가 #166
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
11 changes: 8 additions & 3 deletions
11
api/src/main/kotlin/com/few/api/web/controller/batch/BatchController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,26 @@ | ||
package com.few.api.web.controller.batch | ||
|
||
import com.few.batch.service.article.BatchSendArticleEmailService | ||
import org.springframework.beans.factory.annotation.Value | ||
import org.springframework.validation.annotation.Validated | ||
import org.springframework.web.bind.annotation.PostMapping | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RequestParam | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@Validated | ||
@RestController | ||
@RequestMapping("/batch") | ||
class BatchController( | ||
private val batchSendArticleEmailService: BatchSendArticleEmailService | ||
private val batchSendArticleEmailService: BatchSendArticleEmailService, | ||
@Value("\${auth.batch}") private val auth: String | ||
) { | ||
|
||
// todo add check permission | ||
@PostMapping("/article") | ||
fun batchArticle() { | ||
fun batchArticle(@RequestParam(value = "auth") auth: String) { | ||
if (this.auth != auth) { | ||
throw IllegalAccessException("Invalid Permission") | ||
} | ||
batchSendArticleEmailService.execute() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,14 +5,19 @@ spring: | |
profiles: | ||
group: | ||
local: | ||
- client-local | ||
- api-repo-local | ||
- email-local | ||
- storage-local | ||
prd: | ||
- client-prd | ||
- api-repo-prd | ||
- email-prd | ||
- storage-prd | ||
|
||
logging: | ||
level: | ||
root: debug | ||
auth: | ||
batch: ${AUTH_BATCH:0518} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ${AUTH_BATCH:0518} 이 필드는 어디서가져오나요? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 환경 변수로?! |
||
|
||
log: | ||
file: | ||
path: ${LOGS_ABSOLUTE_PATH:./var/log/api} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query param은 일반적으로 GET 요청에서만 사용(조회할 데이터에 대한 상세 구분)하는 것이 일반적입니다. 헤더나 바디로 뺄 수. ㅣㅆ는지 검토필요해보입니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아 저도 동의합니다!
파람으로 해둔 것은 제가 아직 파이어베이스 function에 익숙하지 않아서 post 보다는 get으로 처리할 수 있는 방법으로 구현했어요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#171 에서 수정하겠습니다!