From bbc43f7ddc7073fb9eb52ccc54a18dab083ac0ec Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 22 Apr 2023 12:21:30 +0200 Subject: [PATCH] =?utf8?q?TMP:Holzweg=20so,=20Refaktorisierung=20n=C3=B6ti?= =?utf8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../persistence/storage/files/FilesStorageStrategy.java | 3 ++- .../chat/backend/persistence/storage/mongodb/ChatRoomTo.java | 3 ++- .../persistence/storage/mongodb/MongoDbStorageStrategy.java | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/files/FilesStorageStrategy.java b/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/files/FilesStorageStrategy.java index f0ee1dfb..e1611225 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/files/FilesStorageStrategy.java +++ b/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/files/FilesStorageStrategy.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.ObjectMapper; import de.juplo.kafka.chat.backend.api.ChatRoomInfoTo; import de.juplo.kafka.chat.backend.api.MessageTo; +import de.juplo.kafka.chat.backend.domain.ChatRoomInfo; import de.juplo.kafka.chat.backend.domain.ShardingStrategy; import de.juplo.kafka.chat.backend.domain.ChatRoom; import de.juplo.kafka.chat.backend.domain.Message; @@ -39,7 +40,7 @@ public class FilesStorageStrategy implements StorageStrategy @Override - public void write(Flux chatroomFlux) + public void write(Flux chatroomFlux) { Path path = chatroomsPath(); log.info("Writing chatrooms to {}", path); diff --git a/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/ChatRoomTo.java b/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/ChatRoomTo.java index 1ad8d178..c29d4f72 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/ChatRoomTo.java +++ b/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/ChatRoomTo.java @@ -1,6 +1,7 @@ package de.juplo.kafka.chat.backend.persistence.storage.mongodb; import de.juplo.kafka.chat.backend.domain.ChatRoom; +import de.juplo.kafka.chat.backend.domain.ChatRoomInfo; import lombok.*; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; @@ -22,7 +23,7 @@ public class ChatRoomTo private String name; private List messages; - public static ChatRoomTo from(ChatRoom chatroom) + public static ChatRoomTo from(ChatRoomInfo chatroom) { return new ChatRoomTo( chatroom.getId().toString(), diff --git a/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/MongoDbStorageStrategy.java b/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/MongoDbStorageStrategy.java index d21fe2ba..8318c6cf 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/MongoDbStorageStrategy.java +++ b/src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/MongoDbStorageStrategy.java @@ -24,7 +24,7 @@ public class MongoDbStorageStrategy implements StorageStrategy @Override - public void write(Flux chatroomFlux) + public void write(Flux chatroomFlux) { chatroomFlux .map(ChatRoomTo::from) -- 2.20.1