Skip to content
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 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
}
Comment on lines +20 to +23
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

query param은 일반적으로 GET 요청에서만 사용(조회할 데이터에 대한 상세 구분)하는 것이 일반적입니다. 헤더나 바디로 뺄 수. ㅣㅆ는지 검토필요해보입니다

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 저도 동의합니다!
파람으로 해둔 것은 제가 아직 파이어베이스 function에 익숙하지 않아서 post 보다는 get으로 처리할 수 있는 방법으로 구현했어요!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#171 에서 수정하겠습니다!

batchSendArticleEmailService.execute()
}
}
11 changes: 8 additions & 3 deletions api/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${AUTH_BATCH:0518} 이 필드는 어디서가져오나요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

환경 변수로?!


log:
file:
path: ${LOGS_ABSOLUTE_PATH:./var/log/api}
Loading