-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from Nawabali-project/feature/34/cicdNotifica…
…tion FIX : 메세지 전송 수정
- Loading branch information
Showing
5 changed files
with
119 additions
and
53 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
32 changes: 23 additions & 9 deletions
32
src/main/java/com/nawabali/nawabali/controller/ChatController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,53 @@ | ||
package com.nawabali.nawabali.controller; | ||
|
||
import com.nawabali.nawabali.dto.ChatDto; | ||
//import com.nawabali.nawabali.dto.ChattingRequest; | ||
import com.nawabali.nawabali.service.ChatMessageService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.messaging.handler.annotation.DestinationVariable; | ||
import org.springframework.messaging.handler.annotation.MessageMapping; | ||
import org.springframework.messaging.handler.annotation.Payload; | ||
import org.springframework.messaging.simp.SimpMessageSendingOperations; | ||
import org.springframework.messaging.simp.SimpMessagingTemplate; | ||
import org.springframework.stereotype.Controller; | ||
|
||
import java.util.List; | ||
|
||
@Tag(name = "채팅 API", description = "채팅 관련 API 입니다.") | ||
@RequiredArgsConstructor | ||
@Controller | ||
@Slf4j (topic = "채팅방 로그!!!") | ||
public class ChatController { | ||
|
||
private final ChatMessageService chatMessageService; | ||
private final SimpMessageSendingOperations messagingTemplate; | ||
|
||
// @Operation(summary = "채팅방(DM) 입장" , description = "MessageType : ENTER _ 입장") | ||
// @MessageMapping("/chat/enter/message") | ||
// public void enterMessage(ChatDto.ChatMessageDto message) { | ||
// | ||
// chatMessageService.enterMessage(message); | ||
// | ||
// } | ||
private final SimpMessagingTemplate simpMessagingTemplate; | ||
|
||
@Operation(summary = "채팅방(DM) 입장" , description = "MessageType : ENTER _ 입장") | ||
@MessageMapping("/chat/enter/message/{chatRoomId}") | ||
public void enterMessage(@DestinationVariable Long chatRoomId, ChatDto.ChatMessageDto message) { | ||
|
||
chatMessageService.enterMessage(chatRoomId, message); | ||
|
||
} | ||
|
||
@Operation(summary = "채팅(DM) 전송" , description = "MessageType : TALK _ 메세지 전송") | ||
@MessageMapping("/chat/message/{chatRoomId}") | ||
public void message(@DestinationVariable Long chatRoomId, @Payload ChatDto.ChatMessageDto message) { | ||
// roomid 따로 받을지 이렇게 할지 물어보기 | ||
chatMessageService.message(chatRoomId, message); | ||
log.info("정보확인 {} 이 방에서 {} 이 반환값", chatRoomId, message.getMessage()); | ||
|
||
} // sender command | ||
|
||
// @MessageMapping ("/chat/message/{chatRoomId}") | ||
// public void chat (@DestinationVariable Long chatRoomId, ChattingRequest chattingRequest) { | ||
// simpMessagingTemplate.convertAndSend("/sub/chat/room/" + chatRoomId, chattingRequest.getMessage()); | ||
// log.info("Message [{}] send by member : {} to chatting room:{}",chattingRequest.getMessage(), chattingRequest.getUserId(), chatRoomId); | ||
// } | ||
|
||
|
||
|
||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/nawabali/nawabali/dto/ChattingRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//package com.nawabali.nawabali.dto; | ||
// | ||
//import lombok.*; | ||
// | ||
//@Getter | ||
//@Builder | ||
//@AllArgsConstructor (access = AccessLevel.PROTECTED) | ||
//@NoArgsConstructor (access = AccessLevel.PROTECTED) | ||
//public class ChattingRequest { | ||
// | ||
// private Long id; | ||
// private Long userId; | ||
// private String sender; | ||
// private String message; | ||
// | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters