TMP:Holzweg so, Refaktorisierung nötig rebase--2023-08-18
authorKai Moritz <kai@juplo.de>
Sat, 22 Apr 2023 10:21:30 +0000 (12:21 +0200)
committerKai Moritz <kai@juplo.de>
Sat, 22 Apr 2023 10:21:30 +0000 (12:21 +0200)
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 f0ee1df..e161122 100644 (file)
@@ -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<ChatRoom> chatroomFlux)
+  public void write(Flux<ChatRoomInfo> chatroomFlux)
   {
     Path path = chatroomsPath();
     log.info("Writing chatrooms to {}", path);
index 1ad8d17..c29d4f7 100644 (file)
@@ -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<MessageTo> messages;
 
-  public static ChatRoomTo from(ChatRoom chatroom)
+  public static ChatRoomTo from(ChatRoomInfo chatroom)
   {
     return new ChatRoomTo(
         chatroom.getId().toString(),
index d21fe2b..8318c6c 100644 (file)
@@ -24,7 +24,7 @@ public class MongoDbStorageStrategy implements StorageStrategy
 
 
   @Override
-  public void write(Flux<ChatRoom> chatroomFlux)
+  public void write(Flux<ChatRoomInfo> chatroomFlux)
   {
     chatroomFlux
         .map(ChatRoomTo::from)