-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: ping과 message 전송시 사용되는 data를 Dto로 변환하여 사용하도록 수정
- Loading branch information
Showing
11 changed files
with
154 additions
and
93 deletions.
There are no files selected for viewing
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
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
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
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
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
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
18 changes: 18 additions & 0 deletions
18
backend/ddang/src/main/java/com/ddang/ddang/chat/handler/dto/MessageDataDto.java
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.ddang.ddang.chat.handler.dto; | ||
|
||
import java.util.Map; | ||
|
||
public record MessageDataDto(long chatRoomId, long receiverId, String contents) { | ||
|
||
private static final String CHAT_ROOM_ID_KEY = "chatRoomId"; | ||
private static final String RECEIVER_ID_KEY = "receiverId"; | ||
private static final String CONTENTS_ID_KEY = "contents"; | ||
|
||
public static MessageDataDto from(final Map<String, String> data) { | ||
return new MessageDataDto( | ||
Long.parseLong(data.get(CHAT_ROOM_ID_KEY)), | ||
Long.parseLong(data.get(RECEIVER_ID_KEY)), | ||
data.get(CONTENTS_ID_KEY) | ||
); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
backend/ddang/src/main/java/com/ddang/ddang/chat/handler/dto/PingDataDto.java
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.ddang.ddang.chat.handler.dto; | ||
|
||
import java.util.Map; | ||
|
||
public record PingDataDto(long chatRoomId, long lastMessageId) { | ||
|
||
private static final String CHAT_ROOM_ID_KEY = "chatRoomId"; | ||
private static final String LAST_MESSAGE_ID = "lastMessageId"; | ||
|
||
public static PingDataDto from(final Map<String, String> chatPingData) { | ||
return new PingDataDto(Long.parseLong(chatPingData.get(CHAT_ROOM_ID_KEY)), | ||
Long.parseLong(chatPingData.get(LAST_MESSAGE_ID)) | ||
); | ||
} | ||
} |
Oops, something went wrong.