NG
authorKai Moritz <kai@juplo.de>
Fri, 18 Aug 2023 12:40:43 +0000 (14:40 +0200)
committerKai Moritz <kai@juplo.de>
Fri, 18 Aug 2023 15:18:41 +0000 (17:18 +0200)
src/main/java/de/juplo/kafka/chat/backend/persistence/StorageStrategy.java
src/main/java/de/juplo/kafka/chat/backend/persistence/storage/files/FilesStorageStrategy.java
src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/ChatRoomTo.java
src/main/java/de/juplo/kafka/chat/backend/persistence/storage/mongodb/MongoDbStorageStrategy.java

index 3807680..ab51505 100644 (file)
@@ -7,6 +7,6 @@ import reactor.core.publisher.Flux;
 
 public interface StorageStrategy
 {
-  void write(Flux<ChatRoomInfo> chatroomFlux);
+  void write(Flux<ChatRoom> chatroomFlux);
   Flux<ChatRoom> read();
 }
index e161122..f0ee1df 100644 (file)
@@ -5,7 +5,6 @@ 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;
@@ -40,7 +39,7 @@ public class FilesStorageStrategy implements StorageStrategy
 
 
   @Override
-  public void write(Flux<ChatRoomInfo> chatroomFlux)
+  public void write(Flux<ChatRoom> chatroomFlux)
   {
     Path path = chatroomsPath();
     log.info("Writing chatrooms to {}", path);
index c29d4f7..a6db124 100644 (file)
@@ -23,7 +23,7 @@ public class ChatRoomTo
   private String name;
   private List<MessageTo> messages;
 
-  public static ChatRoomTo from(ChatRoomInfo chatroom)
+  public static ChatRoomTo from(ChatRoom chatroom)
   {
     return new ChatRoomTo(
         chatroom.getId().toString(),
index 8318c6c..d21fe2b 100644 (file)
@@ -24,7 +24,7 @@ public class MongoDbStorageStrategy implements StorageStrategy
 
 
   @Override
-  public void write(Flux<ChatRoomInfo> chatroomFlux)
+  public void write(Flux<ChatRoom> chatroomFlux)
   {
     chatroomFlux
         .map(ChatRoomTo::from)