From 61a0ccbb3e4b8f747d394bef846909934f04ac22 Mon Sep 17 00:00:00 2001 From: cussle Date: Fri, 15 Nov 2024 15:57:25 +0900 Subject: [PATCH 1/2] fix: Add default constructor and accessors to CreateRoomRequest DTO --- .../devcard/devcard/chat/dto/CreateRoomRequest.java | 12 +++++++++++- .../devcard/chat/service/ChatRoomService.java | 1 - 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/devcard/devcard/chat/dto/CreateRoomRequest.java b/src/main/java/com/devcard/devcard/chat/dto/CreateRoomRequest.java index 67b6a49..4a235e1 100644 --- a/src/main/java/com/devcard/devcard/chat/dto/CreateRoomRequest.java +++ b/src/main/java/com/devcard/devcard/chat/dto/CreateRoomRequest.java @@ -6,10 +6,20 @@ public class CreateRoomRequest { private List participantsId; - public CreateRoomRequest(List list) { + // 기본 생성자 + public CreateRoomRequest() { + } + + // 모든 필드 생성자 + public CreateRoomRequest(List participantsId) { + this.participantsId = participantsId; } public List getParticipantsId() { return participantsId; } + + public void setParticipantsId(List participantsId) { + this.participantsId = participantsId; + } } diff --git a/src/main/java/com/devcard/devcard/chat/service/ChatRoomService.java b/src/main/java/com/devcard/devcard/chat/service/ChatRoomService.java index 4788677..87c2f8a 100644 --- a/src/main/java/com/devcard/devcard/chat/service/ChatRoomService.java +++ b/src/main/java/com/devcard/devcard/chat/service/ChatRoomService.java @@ -52,7 +52,6 @@ public CreateRoomResponse createChatRoom(CreateRoomRequest createRoomRequest) { // jpa를 이용해 ChatUser 리스트 가져오기 List participants = memberRepository.findByIdIn(createRoomRequest.getParticipantsId()); ChatRoom chatRoom = new ChatRoom(participants, LocalDateTime.now()); // chatRoom생성 - chatRoom.getParticipants().addAll(participants); chatRoomRepository.save(chatRoom); // db에 저장 return makeCreateChatRoomResponse(chatRoom); // Response로 변환 } From ad17ed8c2fac36db9e931c149a7efd2894649221 Mon Sep 17 00:00:00 2001 From: cussle Date: Fri, 15 Nov 2024 16:07:27 +0900 Subject: [PATCH 2/2] fix: Update MySQL timezone to Asia/Seoul in datasource URL --- src/main/resources/application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 44ccb7a..957d09e 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -13,7 +13,7 @@ spring.jpa.properties.hibernate.format_sql=true spring.jpa.show-sql=true # db -spring.datasource.url=jdbc:mysql://3.34.144.148:3306/devcard_db?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC&characterEncoding=UTF-8 +spring.datasource.url=jdbc:mysql://localhost:3306/devcard_db?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Seoul&characterEncoding=UTF-8 spring.datasource.username=${DB_USERNAME} spring.datasource.password=${DB_PASSWORD} spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver