diff --git a/api/src/main/java/hexagonal/api/chat/application/port/out/FindChatPort.java b/api/src/main/java/hexagonal/api/chat/application/port/out/FindChatPort.java new file mode 100644 index 0000000..61d517b --- /dev/null +++ b/api/src/main/java/hexagonal/api/chat/application/port/out/FindChatPort.java @@ -0,0 +1,10 @@ +package hexagonal.api.chat.application.port.out; + +import hexagonal.core.domain.jpa.ChatJpaEntity; + +import java.util.List; + +public interface FindChatPort { + List findChatByRoom(Long roomId); + +} diff --git a/api/src/main/java/hexagonal/api/chat/application/port/out/SaveChatPort.java b/api/src/main/java/hexagonal/api/chat/application/port/out/SaveChatPort.java new file mode 100644 index 0000000..c8f6316 --- /dev/null +++ b/api/src/main/java/hexagonal/api/chat/application/port/out/SaveChatPort.java @@ -0,0 +1,8 @@ +package hexagonal.api.chat.application.port.out; + +import hexagonal.core.domain.jpa.ChatJpaEntity; + +public interface SaveChatPort { + Long saveChat(ChatJpaEntity entity); + +} diff --git a/core/src/main/java/hexagonal/core/domain/Message.java b/core/src/main/java/hexagonal/core/domain/Chat.java similarity index 91% rename from core/src/main/java/hexagonal/core/domain/Message.java rename to core/src/main/java/hexagonal/core/domain/Chat.java index ece6c55..68abe23 100644 --- a/core/src/main/java/hexagonal/core/domain/Message.java +++ b/core/src/main/java/hexagonal/core/domain/Chat.java @@ -6,7 +6,7 @@ @Builder @AllArgsConstructor @NoArgsConstructor(access = AccessLevel.PROTECTED) -public class Message { +public class Chat { private Long id; private String content; diff --git a/core/src/main/java/hexagonal/core/domain/jpa/ChatJpaEntity.java b/core/src/main/java/hexagonal/core/domain/jpa/ChatJpaEntity.java new file mode 100644 index 0000000..33f6ebf --- /dev/null +++ b/core/src/main/java/hexagonal/core/domain/jpa/ChatJpaEntity.java @@ -0,0 +1,30 @@ +package hexagonal.core.domain.jpa; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.persistence.*; + +@Entity +@Table(name = "chat") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ChatJpaEntity { + + @Id + @GeneratedValue + private Long id; + + @Column + private String content; + + @Column + private Long senderId; + + @Column + private Long roomId; +} diff --git a/core/src/main/java/hexagonal/core/repository/ChatRepository.java b/core/src/main/java/hexagonal/core/repository/ChatRepository.java new file mode 100644 index 0000000..4f9c1ff --- /dev/null +++ b/core/src/main/java/hexagonal/core/repository/ChatRepository.java @@ -0,0 +1,10 @@ +package hexagonal.core.repository; + +import hexagonal.core.domain.jpa.ChatJpaEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface ChatRepository extends JpaRepository { + +}