From: Kai Moritz Date: Mon, 4 Sep 2023 20:17:47 +0000 (+0200) Subject: refactor: Renamed `ChatRoom` into `ChatRoomData` - Aligned Code X-Git-Tag: rebase--2023-09-05--23-53~17 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=fd0904f95d87e73e07bd51c0913dba8eb6837b88;p=demos%2Fkafka%2Fchat refactor: Renamed `ChatRoom` into `ChatRoomData` - Aligned Code --- 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())))); } }