Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

Commit

Permalink
[WEAV-000] AggregateRoot, Domain Entity 인터페이스 상속 적용 (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
waterfogSW authored Apr 16, 2024
1 parent 9e159f2 commit 997e289
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import com.studentcenter.weave.bootstrap.meeting.dto.MeetingRequestRequest
import com.studentcenter.weave.bootstrap.meeting.dto.MeetingResponse
import com.studentcenter.weave.bootstrap.meeting.dto.PendingMeetingScrollRequest
import com.studentcenter.weave.bootstrap.meeting.dto.PendingMeetingScrollResponse
import com.studentcenter.weave.domain.user.vo.KakaoId
import com.studentcenter.weave.bootstrap.meeting.dto.PreparedMeetingScrollRequest
import com.studentcenter.weave.bootstrap.meeting.dto.PreparedMeetingScrollResponse
import io.swagger.v3.oas.annotations.Operation
Expand All @@ -33,7 +32,7 @@ interface MeetingApi {
@ResponseStatus(HttpStatus.CREATED)
fun requestMeeting(
@RequestBody
request: MeetingRequestRequest
request: MeetingRequestRequest,
)

@Secured
Expand All @@ -42,15 +41,15 @@ interface MeetingApi {
@ResponseStatus(HttpStatus.OK)
fun scrollPendingMeetings(
request: PendingMeetingScrollRequest,
) : PendingMeetingScrollResponse
): PendingMeetingScrollResponse

@Secured
@Operation(summary = "Get all meeting attendances by meeting id")
@GetMapping("/{id}/attendance")
@ResponseStatus(HttpStatus.OK)
fun getMeetingAttendances(
@PathVariable("id") meetingId: UUID,
) : MeetingAttendancesResponse
): MeetingAttendancesResponse

@Secured
@Operation(summary = "Create meeting attendance for attend")
Expand All @@ -75,20 +74,20 @@ interface MeetingApi {
fun findMyRequestMeetingByReceivingTeamId(
@Parameter(description = "receiving team id", required = true, `in` = ParameterIn.QUERY)
receivingTeamId: UUID,
) : MeetingResponse
): MeetingResponse

@Secured
@Operation(summary = "Scroll prepared meetings")
@GetMapping("/status/prepared")
@ResponseStatus(HttpStatus.OK)
fun scrollPreparedMeetings(
request: PreparedMeetingScrollRequest,
) : PreparedMeetingScrollResponse
): PreparedMeetingScrollResponse

@Secured
@Operation(summary = "Get other team member's kakao id by meeting id")
@GetMapping("{id}/other-team/kakao-id")
@ResponseStatus(HttpStatus.OK)
fun getOtherTeamKakaoIds(@PathVariable("id") meetingId: UUID) : KakaoIdResponse
fun getOtherTeamKakaoIds(@PathVariable("id") meetingId: UUID): KakaoIdResponse

}
Original file line number Diff line number Diff line change
@@ -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<Content>,
val createdAt: LocalDateTime = LocalDateTime.now(),
) {
) : DomainEntity {

init {
require(contents.isNotEmpty()) { "메시지를 입력해 주세요" }
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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<MeetingMember>,
val location: Location,
val status: MeetingTeamStatus,
val gender: Gender,
) {
) : AggregateRoot {

val leader: MeetingMember
get() = members.first { it.role == MeetingMemberRole.LEADER }
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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) {
Expand All @@ -26,7 +27,7 @@ data class MeetingTeamMemberSummary(

fun create(
meetingTeamId: UUID,
members: List<User>
members: List<User>,
): MeetingTeamMemberSummary {
require(members.isNotEmpty()) {
"팀에 속한 멤버가 존재해야 합니다."
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
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
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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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,
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
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
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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
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.*

/**
* 유저의 실(재화) 정보
*/
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 이상이어야 합니다." }
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.studentcenter.weave.infrastructure.redis.chat.config

import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import com.studentcenter.weave.infrastructure.redis.chat.adapter.ChatMessageRedisConsumer
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
Expand Down

0 comments on commit 997e289

Please sign in to comment.