feat: add daily chess puzzle api
All checks were successful
Deploy Blog Backend / test (push) Successful in 1m33s
Deploy Blog Backend / deploy (push) Successful in 1m23s

This commit is contained in:
wypark
2026-05-29 00:18:42 +09:00
parent c14d123fcc
commit b47258ea53
8 changed files with 360 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
package me.wypark.blogbackend.api.controller
import me.wypark.blogbackend.api.common.ApiResponse
import me.wypark.blogbackend.api.dto.ChessPuzzleResponse
import me.wypark.blogbackend.domain.chess.ChessPuzzleService
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("/api/chess-puzzles")
class ChessPuzzleController(
private val chessPuzzleService: ChessPuzzleService
) {
@GetMapping("/today")
fun getTodayPuzzle(
@RequestParam(defaultValue = "Asia/Seoul") timezone: String
): ResponseEntity<ApiResponse<ChessPuzzleResponse>> {
val puzzle = chessPuzzleService.getTodayPuzzle(timezone)
?: return ResponseEntity
.status(HttpStatus.NOT_FOUND)
.body(ApiResponse("CHESS_PUZZLE_NOT_FOUND", "오늘의 체스 퍼즐이 준비되지 않았습니다.", null))
return ResponseEntity.ok(ApiResponse.success(puzzle))
}
}