diff --git a/domain/src/main/kotlin/com/studentcenter/weave/domain/chat/entity/ChatMessage.kt b/domain/src/main/kotlin/com/studentcenter/weave/domain/chat/entity/ChatMessage.kt index fdd7a4d9..542bb013 100644 --- a/domain/src/main/kotlin/com/studentcenter/weave/domain/chat/entity/ChatMessage.kt +++ b/domain/src/main/kotlin/com/studentcenter/weave/domain/chat/entity/ChatMessage.kt @@ -1,17 +1,18 @@ package com.studentcenter.weave.domain.chat.entity +import com.studentcenter.weave.domain.common.DomainEntity import com.studentcenter.weave.support.common.uuid.UuidCreator import java.time.LocalDateTime import java.util.* data class ChatMessage( - val id: UUID = UuidCreator.create(), + override val id: UUID = UuidCreator.create(), val roomId: UUID, val senderId: UUID, val senderType: SenderType, val contents: List, val createdAt: LocalDateTime = LocalDateTime.now(), -) { +) : DomainEntity { init { require(contents.isNotEmpty()) { "메시지를 입력해 주세요" } diff --git a/domain/src/main/kotlin/com/studentcenter/weave/domain/chat/entity/ChatRoom.kt b/domain/src/main/kotlin/com/studentcenter/weave/domain/chat/entity/ChatRoom.kt index 14b4bafa..58077879 100644 --- a/domain/src/main/kotlin/com/studentcenter/weave/domain/chat/entity/ChatRoom.kt +++ b/domain/src/main/kotlin/com/studentcenter/weave/domain/chat/entity/ChatRoom.kt @@ -1,17 +1,18 @@ package com.studentcenter.weave.domain.chat.entity +import com.studentcenter.weave.domain.common.AggregateRoot import com.studentcenter.weave.domain.meeting.entity.Meeting import com.studentcenter.weave.support.common.uuid.UuidCreator import java.time.LocalDateTime import java.util.* data class ChatRoom( - val id: UUID = UuidCreator.create(), + override val id: UUID = UuidCreator.create(), val meetingId: UUID, val receivingTeamId: UUID, val requestingTeamId: UUID, val createdAt: LocalDateTime = LocalDateTime.now(), -) { +) : AggregateRoot { companion object { diff --git a/domain/src/main/kotlin/com/studentcenter/weave/domain/meeting/entity/MeetingAttendance.kt b/domain/src/main/kotlin/com/studentcenter/weave/domain/meeting/entity/MeetingAttendance.kt index e048d0b7..0a2a7f35 100644 --- a/domain/src/main/kotlin/com/studentcenter/weave/domain/meeting/entity/MeetingAttendance.kt +++ b/domain/src/main/kotlin/com/studentcenter/weave/domain/meeting/entity/MeetingAttendance.kt @@ -1,17 +1,18 @@ package com.studentcenter.weave.domain.meeting.entity +import com.studentcenter.weave.domain.common.DomainEntity import com.studentcenter.weave.support.common.uuid.UuidCreator import java.time.LocalDateTime import java.util.* data class MeetingAttendance( - val id: UUID = UuidCreator.create(), + override val id: UUID = UuidCreator.create(), val meetingId: UUID, val meetingMemberId: UUID, val isAttend: Boolean, val createdAt: LocalDateTime = LocalDateTime.now(), val updatedAt: LocalDateTime = createdAt, -) { +) : DomainEntity { companion object { diff --git a/domain/src/main/kotlin/com/studentcenter/weave/domain/meetingTeam/entity/MeetingMember.kt b/domain/src/main/kotlin/com/studentcenter/weave/domain/meetingTeam/entity/MeetingMember.kt index b8fcef93..799078a1 100644 --- a/domain/src/main/kotlin/com/studentcenter/weave/domain/meetingTeam/entity/MeetingMember.kt +++ b/domain/src/main/kotlin/com/studentcenter/weave/domain/meetingTeam/entity/MeetingMember.kt @@ -1,14 +1,15 @@ package com.studentcenter.weave.domain.meetingTeam.entity +import com.studentcenter.weave.domain.common.DomainEntity import com.studentcenter.weave.domain.meetingTeam.enums.MeetingMemberRole import com.studentcenter.weave.support.common.uuid.UuidCreator import java.util.* data class MeetingMember( - val id: UUID, + override val id: UUID, val userId: UUID, val role: MeetingMemberRole, -) { +) : DomainEntity { companion object { diff --git a/domain/src/main/kotlin/com/studentcenter/weave/domain/meetingTeam/entity/MeetingTeam.kt b/domain/src/main/kotlin/com/studentcenter/weave/domain/meetingTeam/entity/MeetingTeam.kt index ff176d48..911ece3a 100644 --- a/domain/src/main/kotlin/com/studentcenter/weave/domain/meetingTeam/entity/MeetingTeam.kt +++ b/domain/src/main/kotlin/com/studentcenter/weave/domain/meetingTeam/entity/MeetingTeam.kt @@ -1,5 +1,6 @@ package com.studentcenter.weave.domain.meetingTeam.entity +import com.studentcenter.weave.domain.common.AggregateRoot import com.studentcenter.weave.domain.meetingTeam.enums.Location import com.studentcenter.weave.domain.meetingTeam.enums.MeetingMemberRole import com.studentcenter.weave.domain.meetingTeam.enums.MeetingTeamStatus @@ -10,14 +11,14 @@ import com.studentcenter.weave.support.common.uuid.UuidCreator import java.util.* data class MeetingTeam( - val id: UUID = UuidCreator.create(), + override val id: UUID = UuidCreator.create(), val teamIntroduce: TeamIntroduce, val memberCount: Int, val members: List, val location: Location, val status: MeetingTeamStatus, val gender: Gender, -) { +) : AggregateRoot { val leader: MeetingMember get() = members.first { it.role == MeetingMemberRole.LEADER } diff --git a/domain/src/main/kotlin/com/studentcenter/weave/domain/meetingTeam/entity/MeetingTeamMemberSummary.kt b/domain/src/main/kotlin/com/studentcenter/weave/domain/meetingTeam/entity/MeetingTeamMemberSummary.kt index 546e67a3..504441e8 100644 --- a/domain/src/main/kotlin/com/studentcenter/weave/domain/meetingTeam/entity/MeetingTeamMemberSummary.kt +++ b/domain/src/main/kotlin/com/studentcenter/weave/domain/meetingTeam/entity/MeetingTeamMemberSummary.kt @@ -1,5 +1,6 @@ package com.studentcenter.weave.domain.meetingTeam.entity +import com.studentcenter.weave.domain.common.DomainEntity import com.studentcenter.weave.domain.user.entity.User import com.studentcenter.weave.domain.user.vo.BirthYear import com.studentcenter.weave.domain.user.vo.Mbti @@ -8,13 +9,13 @@ import java.time.LocalDateTime import java.util.* data class MeetingTeamMemberSummary( - val id: UUID = UuidCreator.create(), + override val id: UUID = UuidCreator.create(), val meetingTeamId: UUID, val teamMbti: Mbti, val youngestMemberBirthYear: BirthYear, val oldestMemberBirthYear: BirthYear, val createdAt: LocalDateTime = LocalDateTime.now(), -) { +) : DomainEntity { init { require(youngestMemberBirthYear.value >= oldestMemberBirthYear.value) { @@ -26,7 +27,7 @@ data class MeetingTeamMemberSummary( fun create( meetingTeamId: UUID, - members: List + members: List, ): MeetingTeamMemberSummary { require(members.isNotEmpty()) { "팀에 속한 멤버가 존재해야 합니다." diff --git a/domain/src/main/kotlin/com/studentcenter/weave/domain/university/entity/Major.kt b/domain/src/main/kotlin/com/studentcenter/weave/domain/university/entity/Major.kt index a0ed7af0..62047fd3 100644 --- a/domain/src/main/kotlin/com/studentcenter/weave/domain/university/entity/Major.kt +++ b/domain/src/main/kotlin/com/studentcenter/weave/domain/university/entity/Major.kt @@ -1,20 +1,25 @@ package com.studentcenter.weave.domain.university.entity +import com.studentcenter.weave.domain.common.DomainEntity import com.studentcenter.weave.domain.university.vo.MajorName import com.studentcenter.weave.support.common.uuid.UuidCreator import java.time.LocalDateTime import java.util.* data class Major( - val id: UUID = UuidCreator.create(), - val univId:UUID, + override val id: UUID = UuidCreator.create(), + val univId: UUID, val name: MajorName, val createdAt: LocalDateTime = LocalDateTime.now(), -) { +) : DomainEntity { companion object { - fun create(univId: UUID, name: MajorName): Major { + + fun create( + univId: UUID, + name: MajorName, + ): Major { return Major(univId = univId, name = name) } } diff --git a/domain/src/main/kotlin/com/studentcenter/weave/domain/university/entity/University.kt b/domain/src/main/kotlin/com/studentcenter/weave/domain/university/entity/University.kt index ec3f20ba..7263b67b 100644 --- a/domain/src/main/kotlin/com/studentcenter/weave/domain/university/entity/University.kt +++ b/domain/src/main/kotlin/com/studentcenter/weave/domain/university/entity/University.kt @@ -1,19 +1,20 @@ package com.studentcenter.weave.domain.university.entity +import com.studentcenter.weave.domain.common.AggregateRoot import com.studentcenter.weave.domain.university.vo.UniversityName import com.studentcenter.weave.support.common.uuid.UuidCreator import java.time.LocalDateTime import java.util.* data class University( - val id: UUID = UuidCreator.create(), + override val id: UUID = UuidCreator.create(), val name: UniversityName, val displayName: String, val domainAddress: String, val logoAddress: String?, val createdAt: LocalDateTime = LocalDateTime.now(), val updatedAt: LocalDateTime = LocalDateTime.now(), -) { +) : AggregateRoot { companion object { diff --git a/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/DeletedUserInfo.kt b/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/DeletedUserInfo.kt index a4602a1f..76edace3 100644 --- a/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/DeletedUserInfo.kt +++ b/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/DeletedUserInfo.kt @@ -1,5 +1,6 @@ package com.studentcenter.weave.domain.user.entity +import com.studentcenter.weave.domain.common.DomainEntity import com.studentcenter.weave.domain.user.enums.SocialLoginProvider import com.studentcenter.weave.support.common.uuid.UuidCreator import com.studentcenter.weave.support.common.vo.Email @@ -7,13 +8,13 @@ import java.time.LocalDateTime import java.util.UUID data class DeletedUserInfo( - val id: UUID = UuidCreator.create(), + override val id: UUID = UuidCreator.create(), val email: Email, val socialLoginProvider: SocialLoginProvider, val reason: String? = null, val registeredAt: LocalDateTime, val deletedAt: LocalDateTime = LocalDateTime.now(), -) { +) : DomainEntity { init { require(reason?.isNotBlank()?.let { it && reason.length <= 100 } ?: true) { diff --git a/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/User.kt b/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/User.kt index c85a0df7..14d77bc9 100644 --- a/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/User.kt +++ b/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/User.kt @@ -1,5 +1,6 @@ package com.studentcenter.weave.domain.user.entity +import com.studentcenter.weave.domain.common.AggregateRoot import com.studentcenter.weave.domain.user.enums.AnimalType import com.studentcenter.weave.domain.user.enums.Gender import com.studentcenter.weave.domain.user.vo.BirthYear @@ -16,7 +17,7 @@ import java.time.LocalDateTime import java.util.* data class User( - val id: UUID = UuidCreator.create(), + override val id: UUID = UuidCreator.create(), val nickname: Nickname, val email: Email, val gender: Gender, @@ -31,7 +32,7 @@ data class User( val isUnivVerified: Boolean = false, val registeredAt: LocalDateTime = LocalDateTime.now(), val updatedAt: LocalDateTime = LocalDateTime.now(), -) { +) : AggregateRoot { val avatar: Url? get() = profileImages.firstOrNull()?.imageUrl diff --git a/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/UserAuthInfo.kt b/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/UserAuthInfo.kt index 123b73e4..6d5ce087 100644 --- a/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/UserAuthInfo.kt +++ b/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/UserAuthInfo.kt @@ -1,5 +1,6 @@ package com.studentcenter.weave.domain.user.entity +import com.studentcenter.weave.domain.common.DomainEntity import com.studentcenter.weave.domain.user.enums.SocialLoginProvider import com.studentcenter.weave.support.common.uuid.UuidCreator import com.studentcenter.weave.support.common.vo.Email @@ -7,14 +8,15 @@ import java.time.LocalDateTime import java.util.* data class UserAuthInfo( - val id: UUID = UuidCreator.create(), + override val id: UUID = UuidCreator.create(), val userId: UUID, val email: Email, val socialLoginProvider: SocialLoginProvider, val registeredAt: LocalDateTime, -) { +) : DomainEntity { companion object { + fun create( user: User, socialLoginProvider: SocialLoginProvider, diff --git a/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/UserProfileImage.kt b/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/UserProfileImage.kt index edd91998..a64bb10e 100644 --- a/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/UserProfileImage.kt +++ b/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/UserProfileImage.kt @@ -1,15 +1,16 @@ package com.studentcenter.weave.domain.user.entity +import com.studentcenter.weave.domain.common.DomainEntity import com.studentcenter.weave.domain.user.exception.UserExceptionType import com.studentcenter.weave.support.common.exception.CustomException import com.studentcenter.weave.support.common.vo.Url import java.util.* data class UserProfileImage( - val id: UUID, + override val id: UUID, val extension: Extension, val imageUrl: Url, -) { +) : DomainEntity { enum class Extension(val value: String) { JPG("jpg"), diff --git a/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/UserSil.kt b/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/UserSil.kt index c5fd19e2..37f75208 100644 --- a/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/UserSil.kt +++ b/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/UserSil.kt @@ -1,5 +1,6 @@ package com.studentcenter.weave.domain.user.entity +import com.studentcenter.weave.domain.common.DomainEntity import com.studentcenter.weave.support.common.uuid.UuidCreator import java.util.* @@ -7,10 +8,10 @@ import java.util.* * 유저의 실(재화) 정보 */ data class UserSil( - val id: UUID = UuidCreator.create(), + override val id: UUID = UuidCreator.create(), val userId: UUID, val amount: Long = 0, -) { +) : DomainEntity { init { require(amount >= 0) { "amount는 0 이상이어야 합니다." } diff --git a/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/UserUniversityVerificationInfo.kt b/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/UserUniversityVerificationInfo.kt index 524ca337..c4132336 100644 --- a/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/UserUniversityVerificationInfo.kt +++ b/domain/src/main/kotlin/com/studentcenter/weave/domain/user/entity/UserUniversityVerificationInfo.kt @@ -1,17 +1,18 @@ package com.studentcenter.weave.domain.user.entity +import com.studentcenter.weave.domain.common.DomainEntity import com.studentcenter.weave.support.common.uuid.UuidCreator import com.studentcenter.weave.support.common.vo.Email import java.time.LocalDateTime import java.util.* data class UserUniversityVerificationInfo( - val id: UUID = UuidCreator.create(), + override val id: UUID = UuidCreator.create(), val userId: UUID, val universityId: UUID, val universityEmail: Email, val verifiedAt: LocalDateTime, -) { +) : DomainEntity { companion object { fun create(user: User, universityEmail: Email): UserUniversityVerificationInfo {