Skip to content

Commit

Permalink
Feat: get chat list #102
Browse files Browse the repository at this point in the history
  • Loading branch information
khw18 committed Jul 7, 2024
1 parent 57e2c50 commit 2efe4d8
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class ChatController {
*/
@MessageMapping("/send")
public Mono<Void> message(@Payload ChatDto chatDto) {
simpMessageSendingOperations.convertAndSend("topic" + chatDto.getRoomId(), chatDto);
simpMessageSendingOperations.convertAndSend("/topic/" + chatDto.getRoomId(), chatDto);
return chatService.saveChat(chatDto.toEntity()).then();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;


@RestController
@RequestMapping("/chat")
@RequestMapping("/api/v1/chat")
@RequiredArgsConstructor
public class ChatRestController {
private final ChatService chatService;
Expand All @@ -20,4 +19,4 @@ public class ChatRestController {
public Flux<Chat> getChatsByRoomId(@PathVariable String roomId) {
return chatService.getChatsByRoomId(roomId);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@
@Repository
public interface ChatRepository extends ReactiveMongoRepository<Chat, String> {
Flux<Chat> findByRoomId(String roomId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ public Mono<Chat> saveChat(Chat chat) {
public Flux<Chat> getChatsByRoomId(String roomId) {
return chatRepository.findByRoomId(roomId);
}

}

0 comments on commit 2efe4d8

Please sign in to comment.