From: Kai Moritz Date: Sat, 7 Jan 2023 23:47:22 +0000 (+0100) Subject: feat: Added an endpoint that list all messages of a chatroom X-Git-Tag: TEST~47 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=1f9f2101d9b37fee11ef4b6768bbf1684753a694;p=demos%2Fkafka%2Fchat feat: Added an endpoint that list all messages of a chatroom --- diff --git a/src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendController.java b/src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendController.java index 4ce98b2c..12f8d67f 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendController.java +++ b/src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendController.java @@ -38,6 +38,17 @@ public class ChatBackendController return chatHome.list().map(chatroom -> ChatroomTo.from(chatroom)); } + @GetMapping("list/{chatroomId}") + public Flux list(@PathVariable UUID chatroomId) + { + return chatHome + .getChatroom(chatroomId) + .map(chatroom -> chatroom + .getMessages() + .map(MessageTo::from)) + .get(); + } + @GetMapping("get/{chatroomId}") public Optional get(@PathVariable UUID chatroomId) {