From 9128c14bc5c74681085f5bab21c1f5c43ec178f6 Mon Sep 17 00:00:00 2001 From: david-parkk Date: Sat, 2 Nov 2024 00:14:22 +0900 Subject: [PATCH 1/2] feat: TagGameEndResponse --- .../dto/response/TagGameEndResponse.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/main/java/kutaverse/game/websocket/taggame/dto/response/TagGameEndResponse.java diff --git a/src/main/java/kutaverse/game/websocket/taggame/dto/response/TagGameEndResponse.java b/src/main/java/kutaverse/game/websocket/taggame/dto/response/TagGameEndResponse.java new file mode 100644 index 0000000..afec314 --- /dev/null +++ b/src/main/java/kutaverse/game/websocket/taggame/dto/response/TagGameEndResponse.java @@ -0,0 +1,19 @@ +package kutaverse.game.websocket.taggame.dto.response; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; + +@AllArgsConstructor +@Builder +@Getter +public class TagGameEndResponse { + + private String message; + + public static TagGameEndResponse toDto(String message){ + return TagGameEndResponse.builder() + .message(message) + .build(); + } +} From 8832684c3f80639c2856bd7d2a97de79331568c7 Mon Sep 17 00:00:00 2001 From: david-parkk Date: Sat, 2 Nov 2024 00:14:52 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20tagGameEndResponse=20=EB=B0=98?= =?UTF-8?q?=ED=99=98=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../game/websocket/taggame/handler/TagGameEndHandler.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/kutaverse/game/websocket/taggame/handler/TagGameEndHandler.java b/src/main/java/kutaverse/game/websocket/taggame/handler/TagGameEndHandler.java index 04d2801..3068470 100644 --- a/src/main/java/kutaverse/game/websocket/taggame/handler/TagGameEndHandler.java +++ b/src/main/java/kutaverse/game/websocket/taggame/handler/TagGameEndHandler.java @@ -8,6 +8,7 @@ import kutaverse.game.websocket.taggame.dto.request.TagGameEndRequest; import kutaverse.game.websocket.taggame.dto.request.TagGameRequest; import kutaverse.game.websocket.taggame.dto.request.TagGameResultStatus; +import kutaverse.game.websocket.taggame.dto.response.TagGameEndResponse; import kutaverse.game.websocket.taggame.util.TagGameRoom; import kutaverse.game.websocket.taggame.util.TagGameRoomManager; import lombok.RequiredArgsConstructor; @@ -66,8 +67,9 @@ private void playerWin(TagGameRoom tagGameRoom) { private void sendWinMessage(WebSocketSession webSocketSession) { String winMessage = "승리하였습니다."; + TagGameEndResponse tagGameEndResponse = TagGameEndResponse.toDto(winMessage); try { - String jsonMessage = objectMapper.writeValueAsString(winMessage); + String jsonMessage = objectMapper.writeValueAsString(tagGameEndResponse); WebSocketMessage webSocketMessage = webSocketSession.textMessage(jsonMessage); webSocketSession.send(Mono.just(webSocketMessage)).subscribe(); } catch (JsonProcessingException e) {} @@ -75,8 +77,9 @@ private void sendWinMessage(WebSocketSession webSocketSession) { private void sendLoseMessage(WebSocketSession webSocketSession) { String winMessage = "패배하였습니다."; + TagGameEndResponse tagGameEndResponse = TagGameEndResponse.toDto(winMessage); try { - String jsonMessage = objectMapper.writeValueAsString(winMessage); + String jsonMessage = objectMapper.writeValueAsString(tagGameEndResponse); WebSocketMessage webSocketMessage = webSocketSession.textMessage(jsonMessage); webSocketSession.send(Mono.just(webSocketMessage)).subscribe(); } catch (JsonProcessingException e) {}