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: wip~77 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=97984a15c5c2e62bb92ba8cfc4b06166f7586c41;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) {