-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: article 배치 실행 api에 인증 추가 (#166)
- Loading branch information
1 parent
a4d917b
commit d109230
Showing
2 changed files
with
16 additions
and
6 deletions.
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