Skip to content

Commit

Permalink
HOTFIX: 채팅방 생성 인자 customId로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
koreaioi committed Nov 13, 2024
1 parent 51ccb0f commit a548fe5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

public record FindChatRoomRequestDto(

@NotNull Long user1Id,
@NotNull Long user2Id
@NotNull String custom1Id,
@NotNull String custom2Id
){}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public class ChatRoomService {
private final UserService userService;

public ChatRoomResponseDto saveChatRoom(FindChatRoomRequestDto findChatRoomRequestDto) {
User user1 = userService.find(findChatRoomRequestDto.user1Id());
User user2 = userService.find(findChatRoomRequestDto.user2Id());
User user1 = userService.findByCustomId(findChatRoomRequestDto.custom1Id());
User user2 = userService.findByCustomId(findChatRoomRequestDto.custom2Id());

checkChatRoom(user1.getId(), user2.getId());
ChatRoom savedRoom = chatRoomRepository.save(ChatRoom.of(user1, user2)); // 채팅방 RDB에 저장
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ public User find(Long userId){
.orElseThrow(UserNotFoundException::new);
}

public User findByCustomId(String customId){
return userRepository.findByCustomId(customId)
.orElseThrow(UserNotFoundException::new);
}

public boolean existUser(String email){
return userRepository.existsByEmail(email);
}
Expand Down

0 comments on commit a548fe5

Please sign in to comment.