From: Kai Moritz Date: Sat, 22 Apr 2023 10:21:30 +0000 (+0200) Subject: TMP:Holzweg so, Refaktorisierung nötig X-Git-Tag: rebase--2023-08-18-abends~16 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=e479beb42c014762a21fde84da86d37e061877b8;p=demos%2Fkafka%2Fchat TMP:Holzweg so, Refaktorisierung nötig --- 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)