Skip to content

Commit

Permalink
refactor: article 배치 실행 api에 인증 추가 (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
belljun3395 authored Jul 8, 2024
1 parent a4d917b commit d109230
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
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()
}
}
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}

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

0 comments on commit d109230

Please sign in to comment.