Skip to content

Commit

Permalink
fix: 버그 픽스
Browse files Browse the repository at this point in the history
  • Loading branch information
KimChanJin97 committed May 17, 2024
1 parent a84c7c2 commit 195c32b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ public void sendMessage(MessageRequest messageRequest, Long senderId) {
// getSender() 는 하트틀 보내는 사람(방 개설자)을 의미
// senderId() 는 메세지를 보내는 사람을 의미
MessageResponse messageResponse = new MessageResponse();

if (chatRoomMember.getSender().equals(findMemberByid(senderId))) {
if (chatRoomMember.getSender().equals(sender)) {
messageResponse.setMethod("receiveChat");
messageResponse.setRoomId(chatMessage.getChatRoom().getId());
messageResponse.setSenderId(senderId);
Expand All @@ -153,7 +152,7 @@ public void sendMessage(MessageRequest messageRequest, Long senderId) {
messageResponse.setIsRead(chatMessage.isRead());
}

if (chatRoomMember.getReceiver().equals(findMemberByid(senderId))) {
if (chatRoomMember.getReceiver().equals(receiver)) {
messageResponse.setMethod("receiveChat");
messageResponse.setRoomId(chatMessage.getChatRoom().getId());
messageResponse.setSenderId(senderId);
Expand All @@ -167,7 +166,9 @@ public void sendMessage(MessageRequest messageRequest, Long senderId) {
}

String topic = channelTopic.getTopic();

redisTemplate.convertAndSend(topic, messageResponse);

}

private ChatRoomMember findChatRoomMember(ChatRoom chatRoom) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ public void onMessage(Message message, byte[] pattern) {
log.info(messageResponse.toString());
GetMessageResponse chatMessageResponse = new GetMessageResponse(messageResponse);
log.info(chatMessageResponse.toString());

if (isExistSubscriber(messageResponse.getReceiveId())) {
messagingTemplate.convertAndSend("/sub/chat/" + messageResponse.getReceiveId(), chatMessageResponse);
} else {
saveUnReadMessage("/sub/chat" + messageResponse.getReceiveId() + "message", messageResponse);
}

messagingTemplate.convertAndSend("/sub/chat/" + messageResponse.getSenderId(), chatMessageResponse);

messagingTemplate.convertAndSend("/sub/chat/" + messageResponse.getReceiveId(), chatMessageResponse);
} else if (publishMessage.contains("Heart")) {
SendHeartResponse sendHeartResponse = objectMapper.readValue(publishMessage, SendHeartResponse.class);

Expand All @@ -57,7 +58,7 @@ public void onMessage(Message message, byte[] pattern) {
saveUnReadHeart("/sub/chat" + sendHeartResponse.getMemberId() + "heart", sendHeartResponse);
}

messagingTemplate.convertAndSend("/sub/chat/" + sendHeartResponse.getMemberId(), chatSendHeartResponse);
messagingTemplate.convertAndSend("/sub/chat/" + sendHeartResponse.getSenderId(), chatSendHeartResponse);
}
} catch (IOException e) {
throw new RuntimeException("Failed to process message", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public Page<ResumeHomeDetailResponse> getResumesByGoodCombi(Long memberId, Pagea
.from(resume)
.leftJoin(resume.member, QMember.member) // left join
.where(builder) // boolean builder
.where(resume.member.ne(me))
.orderBy(resume.id.desc())
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
Expand All @@ -79,10 +80,9 @@ public Page<ResumeHomeDetailResponse> getResumesByGoodCombi(Long memberId, Pagea
return new PageImpl<>(content, pageable, total);
}



// 카테고리별 동적 쿼리
public Page<ResumeHomeDetailResponse> getResumesByCategory(Long memberId, String category, Pageable pageable) {
Member me = findMemberById(memberId);

List<ResumeHomeDetailResponse> content = queryFactory
.select(new QResumeHomeDetailResponse(
Expand All @@ -91,6 +91,7 @@ public Page<ResumeHomeDetailResponse> getResumesByCategory(Long memberId, String
.from(resume)
.leftJoin(resume.member, QMember.member) // left join
.where(resume.categories.contains(Resume.Category.valueOf(category)))
.where(resume.member.ne(me))
.orderBy(resume.id.desc())
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
Expand Down

0 comments on commit 195c32b

Please sign in to comment.