fix: fixed the return-type of the `listen`-endpoint
authorKai Moritz <kai@juplo.de>
Mon, 26 Dec 2022 12:46:53 +0000 (13:46 +0100)
committerKai Moritz <kai@juplo.de>
Mon, 26 Dec 2022 12:46:53 +0000 (13:46 +0100)
src/main/java/de/juplo/kafka/chatroom/api/ChatroomController.java

index 8ea5540..effeccb 100644 (file)
@@ -1,7 +1,6 @@
 package de.juplo.kafka.chatroom.api;
 
 import de.juplo.kafka.chatroom.domain.Chatroom;
-import de.juplo.kafka.chatroom.domain.Message;
 import lombok.RequiredArgsConstructor;
 import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.*;
@@ -67,8 +66,11 @@ public class ChatroomController
   @GetMapping(
       path = "listen/{chatroomId}",
       produces = MediaType.TEXT_EVENT_STREAM_VALUE)
-  public Flux<Message> listen(@PathVariable UUID chatroomId)
+  public Flux<MessageTo> listen(@PathVariable UUID chatroomId)
   {
-    return chatrooms.get(chatroomId).listen();
+    return chatrooms
+        .get(chatroomId)
+        .listen()
+        .map(message -> MessageTo.from(message));
   }
 }