From e70d762f30a99cd3f11607434f746a652259f7b5 Mon Sep 17 00:00:00 2001 From: belljun3395 <195850@jnu.ac.kr> Date: Fri, 5 Jul 2024 23:10:50 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20article=20=EB=B0=B0=EC=B9=98=20?= =?UTF-8?q?=EC=8B=A4=ED=96=89=20api=EC=97=90=20=EC=9D=B8=EC=A6=9D=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../few/api/web/controller/batch/BatchController.kt | 11 ++++++++--- api/src/main/resources/application.yml | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/api/src/main/kotlin/com/few/api/web/controller/batch/BatchController.kt b/api/src/main/kotlin/com/few/api/web/controller/batch/BatchController.kt index a0809154b..0c55aaaf7 100644 --- a/api/src/main/kotlin/com/few/api/web/controller/batch/BatchController.kt +++ b/api/src/main/kotlin/com/few/api/web/controller/batch/BatchController.kt @@ -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() } } \ No newline at end of file diff --git a/api/src/main/resources/application.yml b/api/src/main/resources/application.yml index 89cce7fad..e73c438a1 100644 --- a/api/src/main/resources/application.yml +++ b/api/src/main/resources/application.yml @@ -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}