Skip to content

Commit

Permalink
Refactor(Chat) : 채팅 도메인명 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
waterfogSW committed Dec 27, 2024
1 parent 08d4e9c commit a6e0ea3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<ChatMember>,
val members: List<Member>,
val createdAt: LocalDateTime = LocalDateTime.now()
) : AggregateRoot<ChatRoom, ChatRoom.Id>() {
) : AggregateRoot<Channel, Channel.Id>() {

data class Id(override val value: UUID) : TypeId<UUID>(value)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ChatMember, ChatMember.Id>() {
) : DomainEntity<Member, Member.Id>() {

data class Id(override val value: UUID) : TypeId<UUID>(value)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ChatMessage, ChatMessage.Id>() {
) : AggregateRoot<Message, Message.Id>() {

data class Id(override val value: UUID) : TypeId<UUID>(value)

Expand Down Expand Up @@ -44,15 +44,15 @@ data class ChatMessage(
UNKNOWN_ERROR
}

fun markAsRead(): ChatMessage {
fun markAsRead(): Message {
require(status == Status.SENT) { "메시지가 전송된 상태에서만 읽음 처리가 가능합니다" }
return this.copy(
status = Status.READ,
updatedAt = LocalDateTime.now()
)
}

fun markAsFailed(reason: FailureReason): ChatMessage {
fun markAsFailed(reason: FailureReason): Message {
require(status == Status.SENT) { "전송된 상태의 메시지만 실패 처리가 가능합니다" }
return this.copy(
status = Status.FAILED,
Expand Down

0 comments on commit a6e0ea3

Please sign in to comment.