Skip to content

Commit

Permalink
Merge pull request #113 from cussle/weekly/11
Browse files Browse the repository at this point in the history
그룹에 명함을 추가할 때 채팅방 생성/삭제 로직 개선
  • Loading branch information
cussle authored Nov 15, 2024
2 parents cf46f1e + ad17ed8 commit e1c058d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,20 @@ public class CreateRoomRequest {

private List<Long> participantsId;

public <T> CreateRoomRequest(List<T> list) {
// 기본 생성자
public CreateRoomRequest() {
}

// 모든 필드 생성자
public CreateRoomRequest(List<Long> participantsId) {
this.participantsId = participantsId;
}

public List<Long> getParticipantsId() {
return participantsId;
}

public void setParticipantsId(List<Long> participantsId) {
this.participantsId = participantsId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public CreateRoomResponse createChatRoom(CreateRoomRequest createRoomRequest) {
// jpa를 이용해 ChatUser 리스트 가져오기
List<Member> 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로 변환
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e1c058d

Please sign in to comment.