From c54d0e44ba5bd2b720d6e26d602df0ef286f3ced Mon Sep 17 00:00:00 2001 From: Jung-kr Date: Mon, 7 Jul 2025 17:24:38 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EC=9D=B8=EC=A6=9D=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=EC=97=90=EC=84=9C=20username=20=EC=B6=94=EC=B6=9C?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20API=20=EA=B5=AC=EC=A1=B0=20?= =?UTF-8?q?=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../game/controller/OddEvenController.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/java/dev/codehouse/backend/game/controller/OddEvenController.java b/src/main/java/dev/codehouse/backend/game/controller/OddEvenController.java index 0e0e9b2..80df912 100644 --- a/src/main/java/dev/codehouse/backend/game/controller/OddEvenController.java +++ b/src/main/java/dev/codehouse/backend/game/controller/OddEvenController.java @@ -5,6 +5,7 @@ import dev.codehouse.backend.game.dto.OddEvenRequestDto; import dev.codehouse.backend.game.service.OddEvenService; import lombok.RequiredArgsConstructor; +import org.springframework.security.core.Authentication; import org.springframework.web.bind.annotation.*; @RestController @@ -14,19 +15,16 @@ public class OddEvenController { private final OddEvenService oddEvenService; - @PostMapping("/bet/{username}") - public void bet(@PathVariable String username, @RequestBody OddEvenRequestDto dto) { - oddEvenService.bet(username, dto); + @PostMapping("/bet") + public void bet(Authentication authentication, @RequestBody OddEvenRequestDto dto) { + oddEvenService.bet(authentication.getName(), dto); } - - - @GetMapping("/roundSummary/{username}") - public BetSummaryResponseDto getCurrentRoundSummary(@PathVariable String username) { - return oddEvenService.getCurrentRoundResult(username); + @GetMapping("/roundSummary") + public BetSummaryResponseDto getCurrentRoundSummary(Authentication authentication) { + return oddEvenService.getCurrentRoundResult(authentication.getName()); } - @PostMapping("/calculate") public void calculate() { oddEvenService.calculateResult();