From 7d65c31eea7c4af10261466985b2e0cdf3042367 Mon Sep 17 00:00:00 2001 From: marooo326 Date: Thu, 22 Feb 2024 10:18:04 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20createGameRoom=20=EC=9D=91=EB=8B=B5?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EB=B3=80=EA=B2=BD=20201=20>=20200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/game/controller/GameRoomController.java | 11 ++--------- .../pgms/api/domain/game/service/GameRoomService.java | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/api/src/main/java/com/pgms/api/domain/game/controller/GameRoomController.java b/api/src/main/java/com/pgms/api/domain/game/controller/GameRoomController.java index 4be8bca..f49148a 100644 --- a/api/src/main/java/com/pgms/api/domain/game/controller/GameRoomController.java +++ b/api/src/main/java/com/pgms/api/domain/game/controller/GameRoomController.java @@ -2,8 +2,6 @@ import static com.pgms.coredomain.response.ResponseCode.*; -import java.net.URI; - import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -11,7 +9,6 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import com.pgms.api.domain.game.dto.request.GameRoomCreateRequest; import com.pgms.api.domain.game.dto.request.GameRoomEnterRequest; @@ -40,12 +37,8 @@ public class GameRoomController { public ResponseEntity> createGameRoom( @CurrentAccount Long memberId, @RequestBody @Valid GameRoomCreateRequest request) { - final Long roomId = gameRoomService.createRoom(memberId, request); - URI location = ServletUriComponentsBuilder.fromCurrentRequest() - .path("/{id}") - .buildAndExpand(roomId) - .toUri(); - return ResponseEntity.created(location).body(ApiResponse.of(CREATE, roomId)); + final Long roomId = gameRoomService.createGameRoom(memberId, request); + return ResponseEntity.ok(ApiResponse.of(CREATE, roomId)); } @Operation(summary = "게임 방 설정 변경") diff --git a/api/src/main/java/com/pgms/api/domain/game/service/GameRoomService.java b/api/src/main/java/com/pgms/api/domain/game/service/GameRoomService.java index dabaaf0..b5046e6 100644 --- a/api/src/main/java/com/pgms/api/domain/game/service/GameRoomService.java +++ b/api/src/main/java/com/pgms/api/domain/game/service/GameRoomService.java @@ -48,7 +48,7 @@ public class GameRoomService { private final Producer producer; // ============================== 게임방 생성 ============================== - public Long createRoom(Long memberId, GameRoomCreateRequest request) { + public Long createGameRoom(Long memberId, GameRoomCreateRequest request) { // 유저 있는지 확인 Member member = getMember(memberId);