From fd0904f95d87e73e07bd51c0913dba8eb6837b88 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Mon, 4 Sep 2023 22:17:47 +0200 Subject: [PATCH] refactor: Renamed `ChatRoom` into `ChatRoomData` - Aligned Code --- .../kafka/chat/backend/api/ChatBackendController.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 ac77debf..c39869cc 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 @@ -131,7 +131,14 @@ public class ChatBackendController @PostMapping("/store") public void store() { - storageStrategy.writeChatRoomInfo(chatHome.getChatRoomInfo()); - storageStrategy.writeChatRoomData(chatHome.getChatRoomData()); + storageStrategy.writeChatRoomInfo( + chatHome + .getChatRoomInfo() + .doOnNext(chatRoomInfo -> + storageStrategy.writeChatRoomData( + chatRoomInfo.getId(), + chatHome + .getChatRoomData(chatRoomInfo.getId()) + .flatMapMany(chatRoomData -> chatRoomData.getMessages())))); } } -- 2.20.1