Skip to content

#11 - 애그리거트 설계에 맞춰 도메인 추가 #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.wespot.message.port.`in`

import org.springframework.stereotype.Service

@Service
interface MessageUseCase {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.wespot.message.port.out

interface MessageStatePort {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.wespot.message.service

import com.wespot.message.port.`in`.MessageUseCase
import com.wespot.message.port.out.MessageStatePort

class MessageService(
private val messageStatePort: MessageStatePort
) : MessageUseCase {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.wespot.notification.port.`in`

import org.springframework.stereotype.Service

@Service
interface NotificationUseCase {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.wespot.notification.port.out

interface NotificationStatePort {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.wespot.notification.service

import com.wespot.notification.port.`in`.NotificationUseCase
import com.wespot.notification.port.out.NotificationStatePort

class NotificationService(
private val notificationStatic: NotificationStatePort
) : NotificationUseCase {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.wespot.report.port.`in`

import org.springframework.stereotype.Service

@Service
interface ReportUseCase {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.wespot.report.port.out

interface ReportStatePort {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.wespot.report.service

import com.wespot.report.port.`in`.ReportUseCase

class ReportService(
private val reportUseCase: ReportUseCase
) : ReportUseCase {
}
7 changes: 7 additions & 0 deletions core/src/main/kotlin/com/wespot/user/port/in/UserUseCase.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.wespot.user.port.`in`

import org.springframework.stereotype.Service

@Service
interface UserUseCase {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.wespot.user.port.out

import org.springframework.stereotype.Repository

@Repository
interface UserStatePort {
}
9 changes: 9 additions & 0 deletions core/src/main/kotlin/com/wespot/user/service/UserService.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.wespot.user.service

import com.wespot.user.port.`in`.UserUseCase
import com.wespot.user.port.out.UserStatePort

class UserService(
private val userStatePort: UserStatePort
) : UserUseCase {
}
7 changes: 7 additions & 0 deletions core/src/main/kotlin/com/wespot/vote/port/in/VoteUseCase.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.wespot.vote.port.`in`

import org.springframework.stereotype.Service

@Service
interface VoteUseCase {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.wespot.vote.port.out

interface VoteStatePort {
}
8 changes: 8 additions & 0 deletions core/src/main/kotlin/com/wespot/vote/service/VoteService.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.wespot.vote.service

import com.wespot.vote.port.`in`.VoteUseCase

class VoteService(
private val voteUseCase: VoteUseCase
) : VoteUseCase {
}
19 changes: 19 additions & 0 deletions domain/src/main/kotlin/com/wespot/message/Message.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.wespot.message

import com.wespot.user.User
import java.time.LocalDateTime

data class Message(
val id: Long,
val content: String,
val sender: User,
val receiver: User,
val isReceiverRead: Boolean,
val readAt: LocalDateTime,
val isSent: Boolean,
val sentAt: LocalDateTime,
val createdAt: LocalDateTime,
val updatedAt: LocalDateTime,
val receivedAt: LocalDateTime,
) {
}
17 changes: 17 additions & 0 deletions domain/src/main/kotlin/com/wespot/notification/Notification.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.wespot.notification

import com.wespot.user.User
import java.time.LocalDateTime

data class Notification(
val id: Long,
val user: User,
val type: NotificationType,
val targetId: Long,
val content: String,
val isRead: Boolean,
val readAt: LocalDateTime,
val isEnabled: Boolean,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isEnabled 는 어떤 것일까요?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거는 새로 추가된 알림 비활성화에요! 사용자가 클릭 못하게 하는 것!

val createdAt: LocalDateTime,
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.wespot.notification

enum class NotificationType {
MESSAGE, VOTE
}
13 changes: 13 additions & 0 deletions domain/src/main/kotlin/com/wespot/report/Report.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.wespot.report

import com.wespot.user.User

data class Report(
val id: Long,
val type: ReportType,
val reporter: User,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

targetId 도 추가해주세요! message나 vote의 id 값도 있어야 신고 받았을 떄 추적하기 더 쉬울 것 같아요!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 그 타겟 id 였군요~! 추가하도록 하겠습니당

val reported: User,
val isApprove: Boolean
) {

}
5 changes: 5 additions & 0 deletions domain/src/main/kotlin/com/wespot/report/ReportType.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.wespot.report

enum class ReportType {
MESSAGE, VOTE
}
4 changes: 4 additions & 0 deletions domain/src/main/kotlin/com/wespot/school/EstType.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.wespot.school

enum class EstType { // TODO : 이 부분은 같이 이야기하면서 구체화 해나가 보시죠!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EstType이 국립인지 공립, 사립 구분이여서 이 내용 도메인에서 제거하는거 어떠신가요?

}
12 changes: 12 additions & 0 deletions domain/src/main/kotlin/com/wespot/school/School.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.wespot.school

data class School(
val id: Long,
val name: String,
val category: SchoolCategory,
val schoolType: SchoolType,
val estType: EstType,
val region: String,
val address: String,
) {
}
6 changes: 6 additions & 0 deletions domain/src/main/kotlin/com/wespot/school/SchoolCategory.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.wespot.school

enum class SchoolCategory {
MIDDLE,
HIGH,
}
4 changes: 4 additions & 0 deletions domain/src/main/kotlin/com/wespot/school/SchoolType.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.wespot.school

enum class SchoolType { // TODO : 이 부분은 같이 이야기하면서 구체화 해나가 보시죠!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분 없어도 될 것 같아요!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EstType, SchoolType 둘 다 wespotERD 따라서 진행하기는 했는데, 그래서 저도 감이 안왔거든요.

그래서 말씀하신대로 지우는게 좋을 것 같아요

}
10 changes: 10 additions & 0 deletions domain/src/main/kotlin/com/wespot/user/FCM.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.wespot.user

import java.time.LocalDateTime

data class FCM(
val id: Long,
val fcmToken: String,
val createdAt: LocalDateTime,
) {
}
7 changes: 7 additions & 0 deletions domain/src/main/kotlin/com/wespot/user/Profile.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.wespot.user

data class Profile(
val backgroundColor: String,
val iconUrl: String,
) {
}
6 changes: 6 additions & 0 deletions domain/src/main/kotlin/com/wespot/user/Setting.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.wespot.user

data class Setting(
val isEnableNotification: Boolean,
) {
}
7 changes: 7 additions & 0 deletions domain/src/main/kotlin/com/wespot/user/Social.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.wespot.user

data class Social(
val socialType: SocialType,
val socialId: Long,
) {
}
5 changes: 5 additions & 0 deletions domain/src/main/kotlin/com/wespot/user/SocialType.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.wespot.user

enum class SocialType {
APPLE, KAKAO
}
19 changes: 19 additions & 0 deletions domain/src/main/kotlin/com/wespot/user/User.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.wespot.user

import com.wespot.school.School
import java.time.LocalDateTime

data class User(
val id: Long,
val school: School,
val grade: Int,
val group: Int,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

group 이 반을 의미를 하는거죠? class는 어떠신가요?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class 하려다가... class는 키워드라서..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헛 그러네요! group 으로 가시죠!

val setting: Setting,
val profile: Profile,
val fcm: FCM,
val social: Social,
val createdAt: LocalDateTime,
val updatedAt: LocalDateTime,
val withdrawAt: LocalDateTime,
) {
}
15 changes: 15 additions & 0 deletions domain/src/main/kotlin/com/wespot/vote/Ballot.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.wespot.vote

import com.wespot.user.User
import com.wespot.voteoption.VoteOption
import java.time.LocalDateTime

data class Ballot(
val id: Long,
val voteOption: VoteOption,
val sender: User,
val receiver: User,
val createdAt: LocalDateTime,
val isReceiverRead: Boolean,
) {
}
13 changes: 13 additions & 0 deletions domain/src/main/kotlin/com/wespot/vote/Vote.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.wespot.vote

import java.time.LocalDateTime

data class Vote(
val id: Long,
val schoolName: String,
val grade: Int,
val group: Int,
val date: LocalDateTime,
val ballots: List<Ballot>
) {
}
11 changes: 11 additions & 0 deletions domain/src/main/kotlin/com/wespot/voteoption/VoteOption.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.wespot.voteoption

import java.time.LocalDateTime

data class VoteOption(
val id: Long,
val content: String,
val createdAt: LocalDateTime,
val updatedAt: LocalDateTime,
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.wespot.common

import jakarta.persistence.Column
import jakarta.persistence.Embeddable
import jakarta.persistence.EntityListeners
import org.springframework.data.annotation.CreatedDate
import org.springframework.data.annotation.LastModifiedDate
import org.springframework.data.jpa.domain.support.AuditingEntityListener
import java.time.LocalDateTime

@EntityListeners(AuditingEntityListener::class)
@Embeddable
class BaseEntity {

@CreatedDate
@Column(updatable = false, nullable = false)
val createdAt: LocalDateTime? = null

@LastModifiedDate
@Column(nullable = false)
val updatedAt: LocalDateTime? = null

}
Loading
Loading