diff --git a/src/main/java/kaboo/kaboochat/chat/domain/dto/request/ChatMessageRequest.java b/src/main/java/kaboo/kaboochat/chat/domain/dto/request/ChatMessageRequest.java index 9b955c6..e57490f 100644 --- a/src/main/java/kaboo/kaboochat/chat/domain/dto/request/ChatMessageRequest.java +++ b/src/main/java/kaboo/kaboochat/chat/domain/dto/request/ChatMessageRequest.java @@ -17,6 +17,6 @@ public class ChatMessageRequest { private String chatRoomUUID; // 채팅방 UUID private String username; // 전송한 사용자의 ID - private String nickname; // 전송한 사용자의 닉네임 + private String koreaName; // 전송한 사용자의 닉네임 private String message; // 메시지 내용 } diff --git a/src/main/java/kaboo/kaboochat/chat/domain/dto/response/ChatMessageResponse.java b/src/main/java/kaboo/kaboochat/chat/domain/dto/response/ChatMessageResponse.java index bf6ed6d..49f589d 100644 --- a/src/main/java/kaboo/kaboochat/chat/domain/dto/response/ChatMessageResponse.java +++ b/src/main/java/kaboo/kaboochat/chat/domain/dto/response/ChatMessageResponse.java @@ -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(); diff --git a/src/main/java/kaboo/kaboochat/chat/domain/entity/ChatMessage.java b/src/main/java/kaboo/kaboochat/chat/domain/entity/ChatMessage.java index a1eb8f4..b7758b0 100644 --- a/src/main/java/kaboo/kaboochat/chat/domain/entity/ChatMessage.java +++ b/src/main/java/kaboo/kaboochat/chat/domain/entity/ChatMessage.java @@ -29,7 +29,7 @@ public class ChatMessage { private String chatRoomUUID; // 채팅방 UUID private String username; // 전송한 사용자의 ID - private String nickname; // 전송한 사용자의 닉네임 + private String koreaName; // 전송한 사용자의 닉네임 private String message; // 메시지 내용 private LocalDateTime sendAt; // 메시지 전송시간 @@ -37,7 +37,7 @@ 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(); diff --git a/src/test/java/kaboo/kaboochat/chat/controller/ChatControllerTest.java b/src/test/java/kaboo/kaboochat/chat/controller/ChatControllerTest.java index 1753bc4..3721bd4 100644 --- a/src/test/java/kaboo/kaboochat/chat/controller/ChatControllerTest.java +++ b/src/test/java/kaboo/kaboochat/chat/controller/ChatControllerTest.java @@ -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("전송 시간") ))); diff --git a/src/test/java/kaboo/kaboochat/chat/repository/ChatMemberRepositoryTest.java b/src/test/java/kaboo/kaboochat/chat/repository/ChatMemberRepositoryTest.java index 3fc3980..77ca747 100644 --- a/src/test/java/kaboo/kaboochat/chat/repository/ChatMemberRepositoryTest.java +++ b/src/test/java/kaboo/kaboochat/chat/repository/ChatMemberRepositoryTest.java @@ -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', 'pjh1@example.com', '1111', 'User One', 'password1', '안녕하세요. 유저1입니다.', 101)"; + String sql2 = "insert into member (username, email, korea_name, english_name, password, introduce, class_num) values ('pjh2', 'pjh2@example.com', '2222', 'User Two', 'password2', '안녕하세요. 유저2입니다.', 102)"; + String sql3 = "insert into member (username, email, korea_name, english_name, password, introduce, class_num) values ('pjh3', 'pjh3@example.com', '3333', 'User Three', 'password3', '안녕하세요. 유저3입니다.', 103)"; + String sql4 = "insert into member (username, email, korea_name, english_name, password, introduce, class_num) values ('pjh4', 'pjh4@example.com', '4444', 'User Four', 'password4', '안녕하세요. 유저4입니다.', 104)"; jdbc.execute(sql1); jdbc.execute(sql2); jdbc.execute(sql3); @@ -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()); } } diff --git a/src/test/java/kaboo/kaboochat/chat/repository/ChatMessageRepositoryTest.java b/src/test/java/kaboo/kaboochat/chat/repository/ChatMessageRepositoryTest.java index afbeb39..90a004e 100644 --- a/src/test/java/kaboo/kaboochat/chat/repository/ChatMessageRepositoryTest.java +++ b/src/test/java/kaboo/kaboochat/chat/repository/ChatMessageRepositoryTest.java @@ -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()); } } diff --git a/src/test/java/kaboo/kaboochat/chat/repository/ChatRoomRepositoryTest.java b/src/test/java/kaboo/kaboochat/chat/repository/ChatRoomRepositoryTest.java index 905cd10..1c78915 100644 --- a/src/test/java/kaboo/kaboochat/chat/repository/ChatRoomRepositoryTest.java +++ b/src/test/java/kaboo/kaboochat/chat/repository/ChatRoomRepositoryTest.java @@ -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', 'pjh1@example.com', '1111', 'User One', 'password1', '안녕하세요. 유저1입니다.', 101)"; + String sql2 = "insert into member (username, email, korea_name, english_name, password, introduce, class_num) values ('pjh2', 'pjh2@example.com', '2222', 'User Two', 'password2', '안녕하세요. 유저2입니다.', 102)"; + String sql3 = "insert into member (username, email, korea_name, english_name, password, introduce, class_num) values ('pjh3', 'pjh3@example.com', '3333', 'User Three', 'password3', '안녕하세요. 유저3입니다.', 103)"; + String sql4 = "insert into member (username, email, korea_name, english_name, password, introduce, class_num) values ('pjh4', 'pjh4@example.com', '4444', 'User Four', 'password4', '안녕하세요. 유저4입니다.', 104)"; jdbc.execute(sql1); jdbc.execute(sql2); jdbc.execute(sql3); diff --git a/src/test/java/kaboo/kaboochat/chat/service/ChatServiceTest.java b/src/test/java/kaboo/kaboochat/chat/service/ChatServiceTest.java index b52c4a8..0734c5b 100644 --- a/src/test/java/kaboo/kaboochat/chat/service/ChatServiceTest.java +++ b/src/test/java/kaboo/kaboochat/chat/service/ChatServiceTest.java @@ -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()); }