Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: 엔티티 필드명 수정 #11

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ public class ChatMessageRequest {

private String chatRoomUUID; // 채팅방 UUID
private String username; // 전송한 사용자의 ID
private String nickname; // 전송한 사용자의 닉네임
private String koreaName; // 전송한 사용자의 닉네임
private String message; // 메시지 내용
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
public class ChatMessageResponse {

private String username; // 전송한 사용자의 ID
private String nickname; // 전송한 사용자의 닉네임
private String koreaName; // 전송한 사용자의 닉네임
private String message; // 메시지 내용
private LocalDateTime sendAt; // 메시지 전송시간

public static ChatMessageResponse fromEntity(ChatMessage chatMessage) {
return ChatMessageResponse.builder()
.username(chatMessage.getUsername())
.nickname(chatMessage.getNickname())
.koreaName(chatMessage.getKoreaName())
.message(chatMessage.getMessage())
.sendAt(chatMessage.getSendAt())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ public class ChatMessage {

private String chatRoomUUID; // 채팅방 UUID
private String username; // 전송한 사용자의 ID
private String nickname; // 전송한 사용자의 닉네임
private String koreaName; // 전송한 사용자의 닉네임
private String message; // 메시지 내용
private LocalDateTime sendAt; // 메시지 전송시간

public static ChatMessage createMessage(ChatMessageRequest dto) {
return ChatMessage.builder()
.chatRoomUUID(dto.getChatRoomUUID())
.username(dto.getUsername())
.nickname(dto.getNickname())
.koreaName(dto.getKoreaName())
.message(dto.getMessage())
.sendAt(LocalDateTime.now())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ void findChatMessageTest() throws Exception {
fieldWithPath("message").description("응답 메시지"),
fieldWithPath("data[]").description("채팅내역 리스트"),
fieldWithPath("data[].username").description("참여자 ID"),
fieldWithPath("data[].nickname").description("참여자 닉네임"),
fieldWithPath("data[].koreaName").description("참여자 닉네임"),
fieldWithPath("data[].message").description("채팅 내용"),
fieldWithPath("data[].sendAt").description("전송 시간")
)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ void setUp() {
chatRoom = ChatRoom.createRoom("채팅방1");
chatRoomRepository.save(chatRoom);
JdbcTemplate jdbc = new JdbcTemplate(dataSource);
String sql1 = "insert into member(username, nickname, password) values ('pjh1', '1111', 'pw111')";
String sql2 = "insert into member(username, nickname, password) values ('pjh2', '2222', 'pw222')";
String sql3 = "insert into member(username, nickname, password) values ('pjh3', '3333', 'pw333')";
String sql4 = "insert into member(username, nickname, password) values ('pjh4', '4444', 'pw444')";
String sql1 = "insert into member (username, email, korea_name, english_name, password, introduce, class_num) values ('pjh1', '[email protected]', '1111', 'User One', 'password1', '안녕하세요. 유저1입니다.', 101)";
String sql2 = "insert into member (username, email, korea_name, english_name, password, introduce, class_num) values ('pjh2', '[email protected]', '2222', 'User Two', 'password2', '안녕하세요. 유저2입니다.', 102)";
String sql3 = "insert into member (username, email, korea_name, english_name, password, introduce, class_num) values ('pjh3', '[email protected]', '3333', 'User Three', 'password3', '안녕하세요. 유저3입니다.', 103)";
String sql4 = "insert into member (username, email, korea_name, english_name, password, introduce, class_num) values ('pjh4', '[email protected]', '4444', 'User Four', 'password4', '안녕하세요. 유저4입니다.', 104)";
jdbc.execute(sql1);
jdbc.execute(sql2);
jdbc.execute(sql3);
Expand Down Expand Up @@ -77,6 +77,6 @@ void findByChatUUIDTest() {
assertEquals(4, result.size());
assertEquals("pjh3", result.get(2).getMember().getUsername());
assertEquals("2222", result.get(1).getMember().getKoreaName());
assertEquals("pw444", result.get(3).getMember().getPassword());
assertEquals("password4", result.get(3).getMember().getPassword());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ void findByUUIDTest() {
assertEquals(3, result.getTotalPages());
assertEquals("안녕6!", result.getContent().get(0).getMessage());
assertEquals("user3", result.getContent().get(1).getUsername());
assertEquals("nick2", result.getContent().get(2).getNickname());
assertEquals("nick2", result.getContent().get(2).getKoreaName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ void setUp() {
chatRoom = ChatRoom.createRoom("채팅방1");
chatRoomRepository.save(chatRoom);
JdbcTemplate jdbc = new JdbcTemplate(dataSource);
String sql1 = "insert into member(username, nickname, password) values ('pjh1', '1111', 'pw111')";
String sql2 = "insert into member(username, nickname, password) values ('pjh2', '2222', 'pw222')";
String sql3 = "insert into member(username, nickname, password) values ('pjh3', '3333', 'pw333')";
String sql4 = "insert into member(username, nickname, password) values ('pjh4', '4444', 'pw444')";
String sql1 = "insert into member (username, email, korea_name, english_name, password, introduce, class_num) values ('pjh1', '[email protected]', '1111', 'User One', 'password1', '안녕하세요. 유저1입니다.', 101)";
String sql2 = "insert into member (username, email, korea_name, english_name, password, introduce, class_num) values ('pjh2', '[email protected]', '2222', 'User Two', 'password2', '안녕하세요. 유저2입니다.', 102)";
String sql3 = "insert into member (username, email, korea_name, english_name, password, introduce, class_num) values ('pjh3', '[email protected]', '3333', 'User Three', 'password3', '안녕하세요. 유저3입니다.', 103)";
String sql4 = "insert into member (username, email, korea_name, english_name, password, introduce, class_num) values ('pjh4', '[email protected]', '4444', 'User Four', 'password4', '안녕하세요. 유저4입니다.', 104)";
jdbc.execute(sql1);
jdbc.execute(sql2);
jdbc.execute(sql3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ void findMessageTest1() {
assertEquals(4, result.size());
assertEquals("메시지1", result.get(0).getMessage());
assertEquals("user2", result.get(2).getUsername());
assertEquals("nick1", result.get(3).getNickname());
assertEquals("nick1", result.get(3).getKoreaName());
verify(chatMessageRepository).findByChatRoomUUIDOrderBySendAtDesc(any(), any());
}

Expand Down
Loading