From a6e0ea3563c934edd1d8253c1da391f7623360d8 Mon Sep 17 00:00:00 2001 From: San Kim Date: Sat, 28 Dec 2024 00:39:12 +0900 Subject: [PATCH] =?UTF-8?q?Refactor(Chat)=20:=20=EC=B1=84=ED=8C=85=20?= =?UTF-8?q?=EB=8F=84=EB=A9=94=EC=9D=B8=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/chat/entity/{ChatRoom.kt => Channel.kt} | 6 +++--- .../domain/chat/entity/{ChatMember.kt => Member.kt} | 4 ++-- .../chat/entity/{ChatMessage.kt => Message.kt} | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) rename domain/src/main/kotlin/com/threedays/domain/chat/entity/{ChatRoom.kt => Channel.kt} (81%) rename domain/src/main/kotlin/com/threedays/domain/chat/entity/{ChatMember.kt => Member.kt} (85%) rename domain/src/main/kotlin/com/threedays/domain/chat/entity/{ChatMessage.kt => Message.kt} (86%) diff --git a/domain/src/main/kotlin/com/threedays/domain/chat/entity/ChatRoom.kt b/domain/src/main/kotlin/com/threedays/domain/chat/entity/Channel.kt similarity index 81% rename from domain/src/main/kotlin/com/threedays/domain/chat/entity/ChatRoom.kt rename to domain/src/main/kotlin/com/threedays/domain/chat/entity/Channel.kt index fa9ffbe..077c052 100644 --- a/domain/src/main/kotlin/com/threedays/domain/chat/entity/ChatRoom.kt +++ b/domain/src/main/kotlin/com/threedays/domain/chat/entity/Channel.kt @@ -6,12 +6,12 @@ import com.threedays.support.common.base.domain.TypeId import java.time.LocalDateTime import java.util.UUID -data class ChatRoom( +data class Channel( override val id: Id, val connectionId: Connection.Id, - val members: List, + val members: List, val createdAt: LocalDateTime = LocalDateTime.now() -) : AggregateRoot() { +) : AggregateRoot() { data class Id(override val value: UUID) : TypeId(value) diff --git a/domain/src/main/kotlin/com/threedays/domain/chat/entity/ChatMember.kt b/domain/src/main/kotlin/com/threedays/domain/chat/entity/Member.kt similarity index 85% rename from domain/src/main/kotlin/com/threedays/domain/chat/entity/ChatMember.kt rename to domain/src/main/kotlin/com/threedays/domain/chat/entity/Member.kt index 74cebd5..498cdbe 100644 --- a/domain/src/main/kotlin/com/threedays/domain/chat/entity/ChatMember.kt +++ b/domain/src/main/kotlin/com/threedays/domain/chat/entity/Member.kt @@ -6,11 +6,11 @@ import com.threedays.support.common.base.domain.TypeId import java.time.LocalDateTime import java.util.* -data class ChatMember( +data class Member( override val id: Id, val userId: User.Id, val joinedAt: LocalDateTime = LocalDateTime.now() -) : DomainEntity() { +) : DomainEntity() { data class Id(override val value: UUID) : TypeId(value) diff --git a/domain/src/main/kotlin/com/threedays/domain/chat/entity/ChatMessage.kt b/domain/src/main/kotlin/com/threedays/domain/chat/entity/Message.kt similarity index 86% rename from domain/src/main/kotlin/com/threedays/domain/chat/entity/ChatMessage.kt rename to domain/src/main/kotlin/com/threedays/domain/chat/entity/Message.kt index 595939f..445297d 100644 --- a/domain/src/main/kotlin/com/threedays/domain/chat/entity/ChatMessage.kt +++ b/domain/src/main/kotlin/com/threedays/domain/chat/entity/Message.kt @@ -5,16 +5,16 @@ import com.threedays.support.common.base.domain.TypeId import java.time.LocalDateTime import java.util.* -data class ChatMessage( +data class Message( override val id: Id, - val chatRoomId: ChatRoom.Id, - val senderId: ChatMember.Id, + val chatRoomId: Channel.Id, + val senderId: Member.Id, val content: Content, val status: Status = Status.SENT, val createdAt: LocalDateTime = LocalDateTime.now(), val updatedAt: LocalDateTime? = null, val failureReason: FailureReason? = null -) : AggregateRoot() { +) : AggregateRoot() { data class Id(override val value: UUID) : TypeId(value) @@ -44,7 +44,7 @@ data class ChatMessage( UNKNOWN_ERROR } - fun markAsRead(): ChatMessage { + fun markAsRead(): Message { require(status == Status.SENT) { "메시지가 전송된 상태에서만 읽음 처리가 가능합니다" } return this.copy( status = Status.READ, @@ -52,7 +52,7 @@ data class ChatMessage( ) } - fun markAsFailed(reason: FailureReason): ChatMessage { + fun markAsFailed(reason: FailureReason): Message { require(status == Status.SENT) { "전송된 상태의 메시지만 실패 처리가 가능합니다" } return this.copy( status = Status.FAILED,