From ea19f692658541722b6f32797845ae1fd11a5033 Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sat, 6 Jul 2024 02:10:25 +0900 Subject: [PATCH 01/16] =?UTF-8?q?feat:=20School=20Domain=20=EA=B0=9D?= =?UTF-8?q?=EC=B2=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- domain/src/main/kotlin/com/wespot/school/EstType.kt | 4 ++++ domain/src/main/kotlin/com/wespot/school/School.kt | 12 ++++++++++++ .../main/kotlin/com/wespot/school/SchoolCategory.kt | 6 ++++++ .../src/main/kotlin/com/wespot/school/SchoolType.kt | 4 ++++ 4 files changed, 26 insertions(+) create mode 100644 domain/src/main/kotlin/com/wespot/school/EstType.kt create mode 100644 domain/src/main/kotlin/com/wespot/school/School.kt create mode 100644 domain/src/main/kotlin/com/wespot/school/SchoolCategory.kt create mode 100644 domain/src/main/kotlin/com/wespot/school/SchoolType.kt diff --git a/domain/src/main/kotlin/com/wespot/school/EstType.kt b/domain/src/main/kotlin/com/wespot/school/EstType.kt new file mode 100644 index 00000000..2e245296 --- /dev/null +++ b/domain/src/main/kotlin/com/wespot/school/EstType.kt @@ -0,0 +1,4 @@ +package com.wespot.school + +enum class EstType { // TODO : 이 부분은 같이 이야기하면서 구체화 해나가 보시죠! +} \ No newline at end of file diff --git a/domain/src/main/kotlin/com/wespot/school/School.kt b/domain/src/main/kotlin/com/wespot/school/School.kt new file mode 100644 index 00000000..1a0d30ec --- /dev/null +++ b/domain/src/main/kotlin/com/wespot/school/School.kt @@ -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, +) { +} \ No newline at end of file diff --git a/domain/src/main/kotlin/com/wespot/school/SchoolCategory.kt b/domain/src/main/kotlin/com/wespot/school/SchoolCategory.kt new file mode 100644 index 00000000..82635849 --- /dev/null +++ b/domain/src/main/kotlin/com/wespot/school/SchoolCategory.kt @@ -0,0 +1,6 @@ +package com.wespot.school + +enum class SchoolCategory { + MIDDLE, + HIGH +} \ No newline at end of file diff --git a/domain/src/main/kotlin/com/wespot/school/SchoolType.kt b/domain/src/main/kotlin/com/wespot/school/SchoolType.kt new file mode 100644 index 00000000..93d883ee --- /dev/null +++ b/domain/src/main/kotlin/com/wespot/school/SchoolType.kt @@ -0,0 +1,4 @@ +package com.wespot.school + +enum class SchoolType { // TODO : 이 부분은 같이 이야기하면서 구체화 해나가 보시죠! +} \ No newline at end of file From 93dd8c0568d18310478a39a07854609c11c5bf56 Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sat, 6 Jul 2024 02:18:21 +0900 Subject: [PATCH 02/16] =?UTF-8?q?feat:=20User=20Domain=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/kotlin/com/wespot/message/Message.kt | 8 ++++++++ .../kotlin/com/wespot/school/SchoolCategory.kt | 2 +- domain/src/main/kotlin/com/wespot/user/FCM.kt | 10 ++++++++++ .../src/main/kotlin/com/wespot/user/Profile.kt | 7 +++++++ .../src/main/kotlin/com/wespot/user/Setting.kt | 6 ++++++ .../src/main/kotlin/com/wespot/user/Social.kt | 7 +++++++ .../main/kotlin/com/wespot/user/SocialType.kt | 5 +++++ domain/src/main/kotlin/com/wespot/user/User.kt | 18 ++++++++++++++++++ 8 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 domain/src/main/kotlin/com/wespot/message/Message.kt create mode 100644 domain/src/main/kotlin/com/wespot/user/FCM.kt create mode 100644 domain/src/main/kotlin/com/wespot/user/Profile.kt create mode 100644 domain/src/main/kotlin/com/wespot/user/Setting.kt create mode 100644 domain/src/main/kotlin/com/wespot/user/Social.kt create mode 100644 domain/src/main/kotlin/com/wespot/user/SocialType.kt create mode 100644 domain/src/main/kotlin/com/wespot/user/User.kt diff --git a/domain/src/main/kotlin/com/wespot/message/Message.kt b/domain/src/main/kotlin/com/wespot/message/Message.kt new file mode 100644 index 00000000..baf99841 --- /dev/null +++ b/domain/src/main/kotlin/com/wespot/message/Message.kt @@ -0,0 +1,8 @@ +package com.wespot.message + +data class Message( +// val sender:User +// val id: String, +// val text: String +){ +} \ No newline at end of file diff --git a/domain/src/main/kotlin/com/wespot/school/SchoolCategory.kt b/domain/src/main/kotlin/com/wespot/school/SchoolCategory.kt index 82635849..e9d3184f 100644 --- a/domain/src/main/kotlin/com/wespot/school/SchoolCategory.kt +++ b/domain/src/main/kotlin/com/wespot/school/SchoolCategory.kt @@ -2,5 +2,5 @@ package com.wespot.school enum class SchoolCategory { MIDDLE, - HIGH + HIGH, } \ No newline at end of file diff --git a/domain/src/main/kotlin/com/wespot/user/FCM.kt b/domain/src/main/kotlin/com/wespot/user/FCM.kt new file mode 100644 index 00000000..40168a5d --- /dev/null +++ b/domain/src/main/kotlin/com/wespot/user/FCM.kt @@ -0,0 +1,10 @@ +package com.wespot.user + +import java.time.LocalDateTime + +data class FCM( + val id: Long, + val fcmToken: String, + val createdAt: LocalDateTime, +) { +} \ No newline at end of file diff --git a/domain/src/main/kotlin/com/wespot/user/Profile.kt b/domain/src/main/kotlin/com/wespot/user/Profile.kt new file mode 100644 index 00000000..b932098c --- /dev/null +++ b/domain/src/main/kotlin/com/wespot/user/Profile.kt @@ -0,0 +1,7 @@ +package com.wespot.user + +data class Profile( + val backgroundColor: String, + val iconUrl: String, +) { +} \ No newline at end of file diff --git a/domain/src/main/kotlin/com/wespot/user/Setting.kt b/domain/src/main/kotlin/com/wespot/user/Setting.kt new file mode 100644 index 00000000..d6b9b8e7 --- /dev/null +++ b/domain/src/main/kotlin/com/wespot/user/Setting.kt @@ -0,0 +1,6 @@ +package com.wespot.user + +data class Setting( + val isEnableNotification: Boolean, +) { +} \ No newline at end of file diff --git a/domain/src/main/kotlin/com/wespot/user/Social.kt b/domain/src/main/kotlin/com/wespot/user/Social.kt new file mode 100644 index 00000000..aa232c76 --- /dev/null +++ b/domain/src/main/kotlin/com/wespot/user/Social.kt @@ -0,0 +1,7 @@ +package com.wespot.user + +data class Social( + val socialType: SocialType, + val socialId: Long, +) { +} \ No newline at end of file diff --git a/domain/src/main/kotlin/com/wespot/user/SocialType.kt b/domain/src/main/kotlin/com/wespot/user/SocialType.kt new file mode 100644 index 00000000..88019126 --- /dev/null +++ b/domain/src/main/kotlin/com/wespot/user/SocialType.kt @@ -0,0 +1,5 @@ +package com.wespot.user + +enum class SocialType { + APPLE, KAKAO +} \ No newline at end of file diff --git a/domain/src/main/kotlin/com/wespot/user/User.kt b/domain/src/main/kotlin/com/wespot/user/User.kt new file mode 100644 index 00000000..f5935f81 --- /dev/null +++ b/domain/src/main/kotlin/com/wespot/user/User.kt @@ -0,0 +1,18 @@ +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, + val setting: Setting, + val profile: Profile, + val fcm: FCM, + val social: Social, + val createdAt: LocalDateTime, + val updatedAt: LocalDateTime, +) { +} \ No newline at end of file From 2256708419370920230350629eb44fb2fe361c68 Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sat, 6 Jul 2024 02:21:09 +0900 Subject: [PATCH 03/16] =?UTF-8?q?feat:=20Message=20Domain=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/kotlin/com/wespot/message/Message.kt | 19 +++++++++++++++---- .../src/main/kotlin/com/wespot/user/User.kt | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/domain/src/main/kotlin/com/wespot/message/Message.kt b/domain/src/main/kotlin/com/wespot/message/Message.kt index baf99841..58ea15d3 100644 --- a/domain/src/main/kotlin/com/wespot/message/Message.kt +++ b/domain/src/main/kotlin/com/wespot/message/Message.kt @@ -1,8 +1,19 @@ package com.wespot.message +import com.wespot.user.User +import java.time.LocalDateTime + data class Message( -// val sender:User -// val id: String, -// val text: String -){ + 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, +) { } \ No newline at end of file diff --git a/domain/src/main/kotlin/com/wespot/user/User.kt b/domain/src/main/kotlin/com/wespot/user/User.kt index f5935f81..d086518d 100644 --- a/domain/src/main/kotlin/com/wespot/user/User.kt +++ b/domain/src/main/kotlin/com/wespot/user/User.kt @@ -14,5 +14,6 @@ data class User( val social: Social, val createdAt: LocalDateTime, val updatedAt: LocalDateTime, + val withdrawAt: LocalDateTime, ) { } \ No newline at end of file From 3a68af04c9432640508af41e72939f0f7debe73d Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sat, 6 Jul 2024 02:24:57 +0900 Subject: [PATCH 04/16] =?UTF-8?q?feat:=20Notification=20Domain=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/wespot/notification/Notification.kt | 17 +++++++++++++++++ .../com/wespot/notification/NotificationType.kt | 5 +++++ 2 files changed, 22 insertions(+) create mode 100644 domain/src/main/kotlin/com/wespot/notification/Notification.kt create mode 100644 domain/src/main/kotlin/com/wespot/notification/NotificationType.kt diff --git a/domain/src/main/kotlin/com/wespot/notification/Notification.kt b/domain/src/main/kotlin/com/wespot/notification/Notification.kt new file mode 100644 index 00000000..677ec706 --- /dev/null +++ b/domain/src/main/kotlin/com/wespot/notification/Notification.kt @@ -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, + val createdAt: LocalDateTime, +) { +} \ No newline at end of file diff --git a/domain/src/main/kotlin/com/wespot/notification/NotificationType.kt b/domain/src/main/kotlin/com/wespot/notification/NotificationType.kt new file mode 100644 index 00000000..e3726825 --- /dev/null +++ b/domain/src/main/kotlin/com/wespot/notification/NotificationType.kt @@ -0,0 +1,5 @@ +package com.wespot.notification + +enum class NotificationType { + MESSAGE, VOTE +} \ No newline at end of file From ae624bf989808dc7e24cccb348f716745a7019bb Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sat, 6 Jul 2024 02:26:49 +0900 Subject: [PATCH 05/16] =?UTF-8?q?feat:=20Report=20Domain=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- domain/src/main/kotlin/com/wespot/report/Report.kt | 12 ++++++++++++ .../src/main/kotlin/com/wespot/report/ReportType.kt | 5 +++++ 2 files changed, 17 insertions(+) create mode 100644 domain/src/main/kotlin/com/wespot/report/Report.kt create mode 100644 domain/src/main/kotlin/com/wespot/report/ReportType.kt diff --git a/domain/src/main/kotlin/com/wespot/report/Report.kt b/domain/src/main/kotlin/com/wespot/report/Report.kt new file mode 100644 index 00000000..29557188 --- /dev/null +++ b/domain/src/main/kotlin/com/wespot/report/Report.kt @@ -0,0 +1,12 @@ +package com.wespot.report + +import com.wespot.user.User + +data class Report( + val type: ReportType, + val reporter: User, + val reported: User, + val isApprove: Boolean +) { + +} diff --git a/domain/src/main/kotlin/com/wespot/report/ReportType.kt b/domain/src/main/kotlin/com/wespot/report/ReportType.kt new file mode 100644 index 00000000..af6abb42 --- /dev/null +++ b/domain/src/main/kotlin/com/wespot/report/ReportType.kt @@ -0,0 +1,5 @@ +package com.wespot.report + +enum class ReportType { + MESSAGE, VOTE +} \ No newline at end of file From 2ac9fc819d304fbe60fe0ece6c2936e2ea2bf255 Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sat, 6 Jul 2024 02:28:20 +0900 Subject: [PATCH 06/16] =?UTF-8?q?feat:=20VoteOption=20Domain=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- domain/src/main/kotlin/com/wespot/report/Report.kt | 1 + .../main/kotlin/com/wespot/voteoption/VoteOption.kt | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 domain/src/main/kotlin/com/wespot/voteoption/VoteOption.kt diff --git a/domain/src/main/kotlin/com/wespot/report/Report.kt b/domain/src/main/kotlin/com/wespot/report/Report.kt index 29557188..28576c15 100644 --- a/domain/src/main/kotlin/com/wespot/report/Report.kt +++ b/domain/src/main/kotlin/com/wespot/report/Report.kt @@ -3,6 +3,7 @@ package com.wespot.report import com.wespot.user.User data class Report( + val id: Long, val type: ReportType, val reporter: User, val reported: User, diff --git a/domain/src/main/kotlin/com/wespot/voteoption/VoteOption.kt b/domain/src/main/kotlin/com/wespot/voteoption/VoteOption.kt new file mode 100644 index 00000000..1ba223c1 --- /dev/null +++ b/domain/src/main/kotlin/com/wespot/voteoption/VoteOption.kt @@ -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, +) { +} \ No newline at end of file From a704a258f79f3205c4d3b32c44666624af72aac0 Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sat, 6 Jul 2024 02:31:53 +0900 Subject: [PATCH 07/16] =?UTF-8?q?feat:=20Vote=20Domain=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- domain/src/main/kotlin/com/wespot/vote/Ballot.kt | 15 +++++++++++++++ domain/src/main/kotlin/com/wespot/vote/Vote.kt | 13 +++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 domain/src/main/kotlin/com/wespot/vote/Ballot.kt create mode 100644 domain/src/main/kotlin/com/wespot/vote/Vote.kt diff --git a/domain/src/main/kotlin/com/wespot/vote/Ballot.kt b/domain/src/main/kotlin/com/wespot/vote/Ballot.kt new file mode 100644 index 00000000..4a62ba58 --- /dev/null +++ b/domain/src/main/kotlin/com/wespot/vote/Ballot.kt @@ -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, +) { +} \ No newline at end of file diff --git a/domain/src/main/kotlin/com/wespot/vote/Vote.kt b/domain/src/main/kotlin/com/wespot/vote/Vote.kt new file mode 100644 index 00000000..4ed7c7aa --- /dev/null +++ b/domain/src/main/kotlin/com/wespot/vote/Vote.kt @@ -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 +) { +} \ No newline at end of file From 221ef0bf7c4f8e3ef7668f52b772dbc073f7ffc6 Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sat, 6 Jul 2024 23:11:35 +0900 Subject: [PATCH 08/16] =?UTF-8?q?feat:=20Message=20Core,=20Infra=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wespot/message/port/in/MessageUseCase.kt | 4 ++ .../message/port/out/MessageStatePort.kt | 4 ++ .../wespot/message/service/MessageService.kt | 11 ++++++ .../kotlin/com/wespot/common/BaseEntity.kt | 20 ++++++++++ .../com/wespot/message/MessageJpaEntity.kt | 37 +++++++++++++++++++ .../wespot/message/MessageJpaRepository.kt | 6 +++ .../message/MessagePersistenceAdapter.kt | 9 +++++ 7 files changed, 91 insertions(+) create mode 100644 core/src/main/kotlin/com/wespot/message/port/in/MessageUseCase.kt create mode 100644 core/src/main/kotlin/com/wespot/message/port/out/MessageStatePort.kt create mode 100644 core/src/main/kotlin/com/wespot/message/service/MessageService.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/common/BaseEntity.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/message/MessageJpaEntity.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/message/MessageJpaRepository.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/message/MessagePersistenceAdapter.kt diff --git a/core/src/main/kotlin/com/wespot/message/port/in/MessageUseCase.kt b/core/src/main/kotlin/com/wespot/message/port/in/MessageUseCase.kt new file mode 100644 index 00000000..746fd794 --- /dev/null +++ b/core/src/main/kotlin/com/wespot/message/port/in/MessageUseCase.kt @@ -0,0 +1,4 @@ +package com.wespot.message.port.`in` + +interface MessageUseCase { +} \ No newline at end of file diff --git a/core/src/main/kotlin/com/wespot/message/port/out/MessageStatePort.kt b/core/src/main/kotlin/com/wespot/message/port/out/MessageStatePort.kt new file mode 100644 index 00000000..220b8c91 --- /dev/null +++ b/core/src/main/kotlin/com/wespot/message/port/out/MessageStatePort.kt @@ -0,0 +1,4 @@ +package com.wespot.message.port.out + +interface MessageStatePort { +} \ No newline at end of file diff --git a/core/src/main/kotlin/com/wespot/message/service/MessageService.kt b/core/src/main/kotlin/com/wespot/message/service/MessageService.kt new file mode 100644 index 00000000..4360d1e4 --- /dev/null +++ b/core/src/main/kotlin/com/wespot/message/service/MessageService.kt @@ -0,0 +1,11 @@ +package com.wespot.message.service + +import com.wespot.message.port.`in`.MessageUseCase +import com.wespot.message.port.out.MessageStatePort +import org.springframework.stereotype.Service + +@Service +class MessageService( + val messageStatePort: MessageStatePort +) : MessageUseCase { +} \ No newline at end of file diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/common/BaseEntity.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/common/BaseEntity.kt new file mode 100644 index 00000000..e893a0c4 --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/common/BaseEntity.kt @@ -0,0 +1,20 @@ +package com.wespot.common + +import jakarta.persistence.Column +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) +class BaseEntity { + + @CreatedDate + @Column(updatable = false) + val createdAt: LocalDateTime? = null + + @LastModifiedDate + val updatedAt: LocalDateTime? = null + +} \ No newline at end of file diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/message/MessageJpaEntity.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/message/MessageJpaEntity.kt new file mode 100644 index 00000000..b4c8e71a --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/message/MessageJpaEntity.kt @@ -0,0 +1,37 @@ +package com.wespot.message + +import com.wespot.common.BaseEntity +import com.wespot.user.User +import jakarta.persistence.* +import java.time.LocalDateTime + +@Entity(name = "message") +class MessageJpaEntity( + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + val id: Long, + + val content: String, + + @ManyToOne + @JoinColumn(name = "sender_id") + val sender: User, + + @ManyToOne + @JoinColumn(name = "receiver_id") + val receiver: User, + + val isReceiverRead: Boolean, + + val readAt: LocalDateTime, + + val isSent: Boolean, + + val sentAt: LocalDateTime, + + val receivedAt: LocalDateTime, + + @Embedded + val baseEntity: BaseEntity, +) { +} diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/message/MessageJpaRepository.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/message/MessageJpaRepository.kt new file mode 100644 index 00000000..fc99eaf8 --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/message/MessageJpaRepository.kt @@ -0,0 +1,6 @@ +package com.wespot.message + +import org.springframework.data.jpa.repository.JpaRepository + +interface MessageJpaRepository : JpaRepository { +} \ No newline at end of file diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/message/MessagePersistenceAdapter.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/message/MessagePersistenceAdapter.kt new file mode 100644 index 00000000..c3932a25 --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/message/MessagePersistenceAdapter.kt @@ -0,0 +1,9 @@ +package com.wespot.message + +import org.springframework.stereotype.Repository + +@Repository +class MessagePersistenceAdapter( + val messageJpaRepository: MessageJpaRepository +) { +} \ No newline at end of file From 611587182cf92e0072ea1c250a00c2efcf649231 Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sat, 6 Jul 2024 23:26:24 +0900 Subject: [PATCH 09/16] =?UTF-8?q?feat:=20Notification=20Core,=20Infra=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wespot/message/port/in/MessageUseCase.kt | 3 ++ .../wespot/message/service/MessageService.kt | 4 +-- .../port/in/NotificationUseCase.kt | 7 ++++ .../port/out/NotificationStatePort.kt | 4 +++ .../service/NotificationService.kt | 9 +++++ .../com/wespot/message/MessageJpaEntity.kt | 12 +++---- .../notification/NotificationJpaEntity.kt | 35 +++++++++++++++++++ .../wespot/notification/NotificationType.kt | 5 +++ .../kotlin/com/wespot/user/UserJpaEntity.kt | 15 ++++++++ 9 files changed, 85 insertions(+), 9 deletions(-) create mode 100644 core/src/main/kotlin/com/wespot/notification/port/in/NotificationUseCase.kt create mode 100644 core/src/main/kotlin/com/wespot/notification/port/out/NotificationStatePort.kt create mode 100644 core/src/main/kotlin/com/wespot/notification/service/NotificationService.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationJpaEntity.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationType.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/user/UserJpaEntity.kt diff --git a/core/src/main/kotlin/com/wespot/message/port/in/MessageUseCase.kt b/core/src/main/kotlin/com/wespot/message/port/in/MessageUseCase.kt index 746fd794..b7ae1496 100644 --- a/core/src/main/kotlin/com/wespot/message/port/in/MessageUseCase.kt +++ b/core/src/main/kotlin/com/wespot/message/port/in/MessageUseCase.kt @@ -1,4 +1,7 @@ package com.wespot.message.port.`in` +import org.springframework.stereotype.Service + +@Service interface MessageUseCase { } \ No newline at end of file diff --git a/core/src/main/kotlin/com/wespot/message/service/MessageService.kt b/core/src/main/kotlin/com/wespot/message/service/MessageService.kt index 4360d1e4..294ed897 100644 --- a/core/src/main/kotlin/com/wespot/message/service/MessageService.kt +++ b/core/src/main/kotlin/com/wespot/message/service/MessageService.kt @@ -2,10 +2,8 @@ package com.wespot.message.service import com.wespot.message.port.`in`.MessageUseCase import com.wespot.message.port.out.MessageStatePort -import org.springframework.stereotype.Service -@Service class MessageService( - val messageStatePort: MessageStatePort + private val messageStatePort: MessageStatePort ) : MessageUseCase { } \ No newline at end of file diff --git a/core/src/main/kotlin/com/wespot/notification/port/in/NotificationUseCase.kt b/core/src/main/kotlin/com/wespot/notification/port/in/NotificationUseCase.kt new file mode 100644 index 00000000..ee75f8bf --- /dev/null +++ b/core/src/main/kotlin/com/wespot/notification/port/in/NotificationUseCase.kt @@ -0,0 +1,7 @@ +package com.wespot.notification.port.`in` + +import org.springframework.stereotype.Service + +@Service +interface NotificationUseCase { +} \ No newline at end of file diff --git a/core/src/main/kotlin/com/wespot/notification/port/out/NotificationStatePort.kt b/core/src/main/kotlin/com/wespot/notification/port/out/NotificationStatePort.kt new file mode 100644 index 00000000..2a2f6772 --- /dev/null +++ b/core/src/main/kotlin/com/wespot/notification/port/out/NotificationStatePort.kt @@ -0,0 +1,4 @@ +package com.wespot.notification.port.out + +interface NotificationStatePort { +} \ No newline at end of file diff --git a/core/src/main/kotlin/com/wespot/notification/service/NotificationService.kt b/core/src/main/kotlin/com/wespot/notification/service/NotificationService.kt new file mode 100644 index 00000000..cfd019a6 --- /dev/null +++ b/core/src/main/kotlin/com/wespot/notification/service/NotificationService.kt @@ -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 { +} \ No newline at end of file diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/message/MessageJpaEntity.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/message/MessageJpaEntity.kt index b4c8e71a..cdc36887 100644 --- a/infrastructure/mysql/src/main/kotlin/com/wespot/message/MessageJpaEntity.kt +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/message/MessageJpaEntity.kt @@ -1,7 +1,7 @@ package com.wespot.message import com.wespot.common.BaseEntity -import com.wespot.user.User +import com.wespot.user.UserJpaEntity import jakarta.persistence.* import java.time.LocalDateTime @@ -15,11 +15,11 @@ class MessageJpaEntity( @ManyToOne @JoinColumn(name = "sender_id") - val sender: User, + val sender: UserJpaEntity, @ManyToOne @JoinColumn(name = "receiver_id") - val receiver: User, + val receiver: UserJpaEntity, val isReceiverRead: Boolean, @@ -32,6 +32,6 @@ class MessageJpaEntity( val receivedAt: LocalDateTime, @Embedded - val baseEntity: BaseEntity, -) { -} + val baseEntity: BaseEntity + +) \ No newline at end of file diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationJpaEntity.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationJpaEntity.kt new file mode 100644 index 00000000..3edc063d --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationJpaEntity.kt @@ -0,0 +1,35 @@ +package com.wespot.notification + +import com.wespot.common.BaseEntity +import com.wespot.user.UserJpaEntity +import jakarta.persistence.* +import java.time.LocalDateTime + +@Entity(name = "notification") +class NotificationJpaEntity( + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + val id: Long, + + @ManyToOne + @JoinColumn(name = "sender_id") + val user: UserJpaEntity, + + @Enumerated(value = EnumType.STRING) + val type: NotificationType, + + val targetId: Long, + + val content: String, + + val isRead: Boolean, + + val readAt: LocalDateTime, + + val isEnabled: Boolean, + + @Embedded + val baseEntity: BaseEntity + +) diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationType.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationType.kt new file mode 100644 index 00000000..e3726825 --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationType.kt @@ -0,0 +1,5 @@ +package com.wespot.notification + +enum class NotificationType { + MESSAGE, VOTE +} \ No newline at end of file diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/user/UserJpaEntity.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/user/UserJpaEntity.kt new file mode 100644 index 00000000..049aac1b --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/user/UserJpaEntity.kt @@ -0,0 +1,15 @@ +package com.wespot.user + +import jakarta.persistence.Entity +import jakarta.persistence.GeneratedValue +import jakarta.persistence.GenerationType +import jakarta.persistence.Id + +@Entity +class UserJpaEntity( + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + val id: Long = 0 + +) \ No newline at end of file From dc65fe679dbbb8bf7c69c31f9df64ae3a17f7563 Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sun, 7 Jul 2024 01:20:28 +0900 Subject: [PATCH 10/16] =?UTF-8?q?feat:=20Vote=20Core,=20Infra=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/wespot/vote/port/in/VoteUseCase.kt | 7 ++++ .../com/wespot/vote/port/out/VoteStatePort.kt | 4 +++ .../com/wespot/vote/service/VoteService.kt | 8 +++++ .../kotlin/com/wespot/vote/VoteJpaEntity.kt | 32 +++++++++++++++++++ .../com/wespot/vote/VoteJpaRepository.kt | 6 ++++ .../com/wespot/vote/VotePersistenceAdapter.kt | 10 ++++++ 6 files changed, 67 insertions(+) create mode 100644 core/src/main/kotlin/com/wespot/vote/port/in/VoteUseCase.kt create mode 100644 core/src/main/kotlin/com/wespot/vote/port/out/VoteStatePort.kt create mode 100644 core/src/main/kotlin/com/wespot/vote/service/VoteService.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/vote/VoteJpaEntity.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/vote/VoteJpaRepository.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/vote/VotePersistenceAdapter.kt diff --git a/core/src/main/kotlin/com/wespot/vote/port/in/VoteUseCase.kt b/core/src/main/kotlin/com/wespot/vote/port/in/VoteUseCase.kt new file mode 100644 index 00000000..f6ed04c1 --- /dev/null +++ b/core/src/main/kotlin/com/wespot/vote/port/in/VoteUseCase.kt @@ -0,0 +1,7 @@ +package com.wespot.vote.port.`in` + +import org.springframework.stereotype.Service + +@Service +interface VoteUseCase { +} \ No newline at end of file diff --git a/core/src/main/kotlin/com/wespot/vote/port/out/VoteStatePort.kt b/core/src/main/kotlin/com/wespot/vote/port/out/VoteStatePort.kt new file mode 100644 index 00000000..bf2923d2 --- /dev/null +++ b/core/src/main/kotlin/com/wespot/vote/port/out/VoteStatePort.kt @@ -0,0 +1,4 @@ +package com.wespot.vote.port.out + +interface VoteStatePort { +} \ No newline at end of file diff --git a/core/src/main/kotlin/com/wespot/vote/service/VoteService.kt b/core/src/main/kotlin/com/wespot/vote/service/VoteService.kt new file mode 100644 index 00000000..fc366bdc --- /dev/null +++ b/core/src/main/kotlin/com/wespot/vote/service/VoteService.kt @@ -0,0 +1,8 @@ +package com.wespot.vote.service + +import com.wespot.vote.port.`in`.VoteUseCase + +class VoteService( + private val voteUseCase: VoteUseCase +) : VoteUseCase { +} \ No newline at end of file diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/vote/VoteJpaEntity.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/vote/VoteJpaEntity.kt new file mode 100644 index 00000000..abd9d872 --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/vote/VoteJpaEntity.kt @@ -0,0 +1,32 @@ +package com.wespot.vote + +import jakarta.persistence.* +import org.jetbrains.annotations.NotNull +import java.time.LocalDateTime + +@Entity +@Table(name = "vote") +class VoteJpaEntity( + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + val id: Long, + + @field: NotNull + val schoolName: String, + + @field: NotNull + val grade: Int, + + @field: NotNull + val group: Int, + + @field: NotNull + val date: LocalDateTime, + + @field: NotNull + @OneToMany(mappedBy = "vote", cascade = [CascadeType.PERSIST]) + val ballots: List + +) + diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/vote/VoteJpaRepository.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/vote/VoteJpaRepository.kt new file mode 100644 index 00000000..cbc5293e --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/vote/VoteJpaRepository.kt @@ -0,0 +1,6 @@ +package com.wespot.vote + +import org.springframework.data.jpa.repository.JpaRepository + +interface VoteJpaRepository : JpaRepository { +} \ No newline at end of file diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/vote/VotePersistenceAdapter.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/vote/VotePersistenceAdapter.kt new file mode 100644 index 00000000..f19807ee --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/vote/VotePersistenceAdapter.kt @@ -0,0 +1,10 @@ +package com.wespot.vote + +import com.wespot.vote.port.out.VoteStatePort +import org.springframework.stereotype.Repository + +@Repository +class VotePersistenceAdapter( + private val voteJpaRepository: VoteJpaRepository +) : VoteStatePort { +} \ No newline at end of file From b42a90405df6dde57c870915915fa9f66cda9c29 Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sun, 7 Jul 2024 01:21:04 +0900 Subject: [PATCH 11/16] =?UTF-8?q?feat:=20User=20Core,=20Infra=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/wespot/user/port/in/UserUseCase.kt | 7 +++ .../com/wespot/user/port/out/UserStatePort.kt | 7 +++ .../com/wespot/user/service/UserService.kt | 9 ++++ .../kotlin/com/wespot/user/FCMJpaEntity.kt | 21 ++++++++ .../com/wespot/user/ProfileJpaEntity.kt | 25 +++++++++ .../com/wespot/user/SettingJpaEntity.kt | 22 ++++++++ .../kotlin/com/wespot/user/SocialJpaEntity.kt | 18 +++++++ .../kotlin/com/wespot/user/UserJpaEntity.kt | 54 ++++++++++++++++--- .../com/wespot/user/UserJpaRepository.kt | 6 +++ .../com/wespot/user/UserPersistenceAdapter.kt | 10 ++++ 10 files changed, 173 insertions(+), 6 deletions(-) create mode 100644 core/src/main/kotlin/com/wespot/user/port/in/UserUseCase.kt create mode 100644 core/src/main/kotlin/com/wespot/user/port/out/UserStatePort.kt create mode 100644 core/src/main/kotlin/com/wespot/user/service/UserService.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/user/FCMJpaEntity.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/user/ProfileJpaEntity.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/user/SettingJpaEntity.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/user/SocialJpaEntity.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/user/UserJpaRepository.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/user/UserPersistenceAdapter.kt diff --git a/core/src/main/kotlin/com/wespot/user/port/in/UserUseCase.kt b/core/src/main/kotlin/com/wespot/user/port/in/UserUseCase.kt new file mode 100644 index 00000000..3976e4ee --- /dev/null +++ b/core/src/main/kotlin/com/wespot/user/port/in/UserUseCase.kt @@ -0,0 +1,7 @@ +package com.wespot.user.port.`in` + +import org.springframework.stereotype.Service + +@Service +interface UserUseCase { +} \ No newline at end of file diff --git a/core/src/main/kotlin/com/wespot/user/port/out/UserStatePort.kt b/core/src/main/kotlin/com/wespot/user/port/out/UserStatePort.kt new file mode 100644 index 00000000..b483318e --- /dev/null +++ b/core/src/main/kotlin/com/wespot/user/port/out/UserStatePort.kt @@ -0,0 +1,7 @@ +package com.wespot.user.port.out + +import org.springframework.stereotype.Repository + +@Repository +interface UserStatePort { +} \ No newline at end of file diff --git a/core/src/main/kotlin/com/wespot/user/service/UserService.kt b/core/src/main/kotlin/com/wespot/user/service/UserService.kt new file mode 100644 index 00000000..550dcc71 --- /dev/null +++ b/core/src/main/kotlin/com/wespot/user/service/UserService.kt @@ -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 { +} \ No newline at end of file diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/user/FCMJpaEntity.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/user/FCMJpaEntity.kt new file mode 100644 index 00000000..81ed8c57 --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/user/FCMJpaEntity.kt @@ -0,0 +1,21 @@ +package com.wespot.user + +import com.wespot.common.BaseEntity +import jakarta.persistence.* +import org.jetbrains.annotations.NotNull + +@Entity +class FCMJpaEntity( + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + val id: Long, + + @field: NotNull + val fcmToken: String, + + @Embedded + @field: NotNull + val baseEntity: BaseEntity + +) diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/user/ProfileJpaEntity.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/user/ProfileJpaEntity.kt new file mode 100644 index 00000000..31774776 --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/user/ProfileJpaEntity.kt @@ -0,0 +1,25 @@ +package com.wespot.user + +import jakarta.persistence.Entity +import jakarta.persistence.GeneratedValue +import jakarta.persistence.GenerationType +import jakarta.persistence.Id +import org.jetbrains.annotations.NotNull + +@Entity +class ProfileJpaEntity( + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + val id: Long, + + @field: NotNull + val userId: Long, + + @field: NotNull + val backgroundColor: String, + + @field: NotNull + val imageUrl: String + +) diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/user/SettingJpaEntity.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/user/SettingJpaEntity.kt new file mode 100644 index 00000000..ca5b43fb --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/user/SettingJpaEntity.kt @@ -0,0 +1,22 @@ +package com.wespot.user + +import jakarta.persistence.Entity +import jakarta.persistence.GeneratedValue +import jakarta.persistence.GenerationType +import jakarta.persistence.Id +import org.jetbrains.annotations.NotNull + +@Entity +class SettingJpaEntity( + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + val id: Long, + + @field: NotNull + val userId: Long, + + @field: NotNull + val isEnableNotification: Boolean + +) \ No newline at end of file diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/user/SocialJpaEntity.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/user/SocialJpaEntity.kt new file mode 100644 index 00000000..eb8267c3 --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/user/SocialJpaEntity.kt @@ -0,0 +1,18 @@ +package com.wespot.user + +import jakarta.persistence.Embeddable +import org.jetbrains.annotations.NotNull + +@Embeddable +class SocialJpaEntity( + + @field: NotNull + val socialId: Long, + + @field: NotNull + val socialType: Long, + + @field: NotNull + val socialRefreshToken: String + +) \ No newline at end of file diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/user/UserJpaEntity.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/user/UserJpaEntity.kt index 049aac1b..b42aaa0c 100644 --- a/infrastructure/mysql/src/main/kotlin/com/wespot/user/UserJpaEntity.kt +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/user/UserJpaEntity.kt @@ -1,15 +1,57 @@ package com.wespot.user -import jakarta.persistence.Entity -import jakarta.persistence.GeneratedValue -import jakarta.persistence.GenerationType -import jakarta.persistence.Id +import com.wespot.common.BaseEntity +import jakarta.persistence.* +import org.jetbrains.annotations.NotNull +import java.time.LocalDateTime @Entity +@Table(name = "user") class UserJpaEntity( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - val id: Long = 0 + val id: Long, -) \ No newline at end of file + @field: NotNull + val schoolId: Long, + + @field: NotNull + val grade: Int, + + @field: NotNull + val group: Int, + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn( + name = "setting_id", foreignKey = ForeignKey(name = "fk_user_setting_id") + ) + @field: NotNull + val setting: SettingJpaEntity, + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn( + name = "profile_id", foreignKey = ForeignKey(name = "fk_user_profile_id") + ) + @field: NotNull + val profile: ProfileJpaEntity, + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn( + name = "fcm_id", foreignKey = ForeignKey(name = "fk_user_fcm_id") + ) + val fcm: FCMJpaEntity, + + @Embedded + @field: NotNull + val social: SocialJpaEntity, + + @Embedded + @field: NotNull + val baseEntity: BaseEntity, + + val withdrawAt: LocalDateTime + +) { + +} diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/user/UserJpaRepository.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/user/UserJpaRepository.kt new file mode 100644 index 00000000..bdff76b0 --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/user/UserJpaRepository.kt @@ -0,0 +1,6 @@ +package com.wespot.user + +import org.springframework.data.jpa.repository.JpaRepository + +interface UserJpaRepository : JpaRepository { +} \ No newline at end of file diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/user/UserPersistenceAdapter.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/user/UserPersistenceAdapter.kt new file mode 100644 index 00000000..a9f01cd9 --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/user/UserPersistenceAdapter.kt @@ -0,0 +1,10 @@ +package com.wespot.user + +import com.wespot.user.port.out.UserStatePort +import org.springframework.stereotype.Repository + +@Repository +class UserPersistenceAdapter( + private val userJpaRepository: UserJpaRepository +) : UserStatePort { +} \ No newline at end of file From c834dbe516719ad173f219116b0d133d06944792 Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sun, 7 Jul 2024 01:21:21 +0900 Subject: [PATCH 12/16] =?UTF-8?q?feat:=20School=20Vote,=20Infra=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wespot/notification/NotificationType.kt | 5 ---- .../com/wespot/school/SchoolJpaEntity.kt | 26 +++++++++++++++++++ .../com/wespot/school/SchoolJpaRepository.kt | 6 +++++ .../wespot/voteoption/VoteOptionJpaEntity.kt | 22 ++++++++++++++++ 4 files changed, 54 insertions(+), 5 deletions(-) delete mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationType.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/school/SchoolJpaEntity.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/school/SchoolJpaRepository.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/voteoption/VoteOptionJpaEntity.kt diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationType.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationType.kt deleted file mode 100644 index e3726825..00000000 --- a/infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationType.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.wespot.notification - -enum class NotificationType { - MESSAGE, VOTE -} \ No newline at end of file diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/school/SchoolJpaEntity.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/school/SchoolJpaEntity.kt new file mode 100644 index 00000000..ee9f263f --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/school/SchoolJpaEntity.kt @@ -0,0 +1,26 @@ +package com.wespot.school + +import jakarta.persistence.* +import org.jetbrains.annotations.NotNull + +@Entity +@Table(name = "school") +class SchoolJpaEntity( + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + val id: Long, + + @field:NotNull + val name: String, + + @field:NotNull + val category: SchoolCategory, + + @field:NotNull + val region: String, + + @field:NotNull + val address: String + +) diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/school/SchoolJpaRepository.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/school/SchoolJpaRepository.kt new file mode 100644 index 00000000..4b0611e0 --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/school/SchoolJpaRepository.kt @@ -0,0 +1,6 @@ +package com.wespot.school + +import org.springframework.data.jpa.repository.JpaRepository + +interface SchoolJpaRepository : JpaRepository { +} \ No newline at end of file diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/voteoption/VoteOptionJpaEntity.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/voteoption/VoteOptionJpaEntity.kt new file mode 100644 index 00000000..196533f8 --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/voteoption/VoteOptionJpaEntity.kt @@ -0,0 +1,22 @@ +package com.wespot.voteoption + +import com.wespot.common.BaseEntity +import jakarta.persistence.* +import org.jetbrains.annotations.NotNull + +@Entity +@Table(name = "vote_option") +class VoteOptionJpaEntity( + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + val id: Long, + + @field: NotNull + val content: String, + + @field: NotNull + @Embedded + val baseEntity: BaseEntity + +) \ No newline at end of file From 231d7154394ada6788ec8cad590f6636e2e91b02 Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sun, 7 Jul 2024 01:22:08 +0900 Subject: [PATCH 13/16] =?UTF-8?q?feat:=20Notification=20Vote,=20Infra=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wespot/notification/NotificationJpaEntity.kt | 14 +++++++++----- .../notification/NotificationJpaRepository.kt | 6 ++++++ .../notification/NotificationPersistenceAdapter.kt | 10 ++++++++++ 3 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationJpaRepository.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationPersistenceAdapter.kt diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationJpaEntity.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationJpaEntity.kt index 3edc063d..bc9d68f3 100644 --- a/infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationJpaEntity.kt +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationJpaEntity.kt @@ -1,32 +1,36 @@ package com.wespot.notification import com.wespot.common.BaseEntity -import com.wespot.user.UserJpaEntity import jakarta.persistence.* +import org.jetbrains.annotations.NotNull import java.time.LocalDateTime -@Entity(name = "notification") +@Entity +@Table(name = "notification") class NotificationJpaEntity( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val id: Long, - @ManyToOne - @JoinColumn(name = "sender_id") - val user: UserJpaEntity, + @field: NotNull + val userId: Long, @Enumerated(value = EnumType.STRING) val type: NotificationType, + @field: NotNull val targetId: Long, + @field: NotNull val content: String, + @field: NotNull val isRead: Boolean, val readAt: LocalDateTime, + @field: NotNull val isEnabled: Boolean, @Embedded diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationJpaRepository.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationJpaRepository.kt new file mode 100644 index 00000000..21ab9e69 --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationJpaRepository.kt @@ -0,0 +1,6 @@ +package com.wespot.notification + +import org.springframework.data.jpa.repository.JpaRepository + +interface NotificationJpaRepository : JpaRepository { +} \ No newline at end of file diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationPersistenceAdapter.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationPersistenceAdapter.kt new file mode 100644 index 00000000..2aef6e71 --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/notification/NotificationPersistenceAdapter.kt @@ -0,0 +1,10 @@ +package com.wespot.notification + +import com.wespot.notification.port.out.NotificationStatePort +import org.springframework.stereotype.Repository + +@Repository +class NotificationPersistenceAdapter( + private val notificationJpaRepository: NotificationJpaRepository +) : NotificationStatePort { +} \ No newline at end of file From fdd50357748a030e83497b25d3a540f0f2799480 Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sun, 7 Jul 2024 01:22:19 +0900 Subject: [PATCH 14/16] =?UTF-8?q?feat:=20Report=20Vote,=20Infra=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wespot/report/port/in/ReportUseCase.kt | 7 +++++ .../wespot/report/port/out/ReportStatePort.kt | 4 +++ .../wespot/report/service/ReportService.kt | 8 ++++++ .../com/wespot/report/ReportJpaEntity.kt | 28 +++++++++++++++++++ .../com/wespot/report/ReportJpaRepository.kt | 6 ++++ .../wespot/report/ReportPersistenceAdapter.kt | 8 ++++++ 6 files changed, 61 insertions(+) create mode 100644 core/src/main/kotlin/com/wespot/report/port/in/ReportUseCase.kt create mode 100644 core/src/main/kotlin/com/wespot/report/port/out/ReportStatePort.kt create mode 100644 core/src/main/kotlin/com/wespot/report/service/ReportService.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/report/ReportJpaEntity.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/report/ReportJpaRepository.kt create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/report/ReportPersistenceAdapter.kt diff --git a/core/src/main/kotlin/com/wespot/report/port/in/ReportUseCase.kt b/core/src/main/kotlin/com/wespot/report/port/in/ReportUseCase.kt new file mode 100644 index 00000000..3cf70732 --- /dev/null +++ b/core/src/main/kotlin/com/wespot/report/port/in/ReportUseCase.kt @@ -0,0 +1,7 @@ +package com.wespot.report.port.`in` + +import org.springframework.stereotype.Service + +@Service +interface ReportUseCase { +} \ No newline at end of file diff --git a/core/src/main/kotlin/com/wespot/report/port/out/ReportStatePort.kt b/core/src/main/kotlin/com/wespot/report/port/out/ReportStatePort.kt new file mode 100644 index 00000000..600f224a --- /dev/null +++ b/core/src/main/kotlin/com/wespot/report/port/out/ReportStatePort.kt @@ -0,0 +1,4 @@ +package com.wespot.report.port.out + +interface ReportStatePort { +} \ No newline at end of file diff --git a/core/src/main/kotlin/com/wespot/report/service/ReportService.kt b/core/src/main/kotlin/com/wespot/report/service/ReportService.kt new file mode 100644 index 00000000..3346fa35 --- /dev/null +++ b/core/src/main/kotlin/com/wespot/report/service/ReportService.kt @@ -0,0 +1,8 @@ +package com.wespot.report.service + +import com.wespot.report.port.`in`.ReportUseCase + +class ReportService( + private val reportUseCase: ReportUseCase +) : ReportUseCase { +} \ No newline at end of file diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/report/ReportJpaEntity.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/report/ReportJpaEntity.kt new file mode 100644 index 00000000..0ba2f950 --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/report/ReportJpaEntity.kt @@ -0,0 +1,28 @@ +package com.wespot.report + +import jakarta.persistence.* +import org.jetbrains.annotations.NotNull + +@Entity +@Table(name = "report") +class ReportJpaEntity( + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @field:NotNull + val id: Long, + + @Enumerated(value = EnumType.STRING) + @field:NotNull + val type: ReportType, + + @field:NotNull + val reporterId: Long, + + @field:NotNull + val reportedId: Long, + + @field:NotNull + val isApprove: Boolean + +) diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/report/ReportJpaRepository.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/report/ReportJpaRepository.kt new file mode 100644 index 00000000..dea4b284 --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/report/ReportJpaRepository.kt @@ -0,0 +1,6 @@ +package com.wespot.report + +import org.springframework.data.jpa.repository.JpaRepository + +interface ReportJpaRepository:JpaRepository { +} \ No newline at end of file diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/report/ReportPersistenceAdapter.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/report/ReportPersistenceAdapter.kt new file mode 100644 index 00000000..0159c979 --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/report/ReportPersistenceAdapter.kt @@ -0,0 +1,8 @@ +package com.wespot.report + +import com.wespot.report.port.out.ReportStatePort + +class ReportPersistenceAdapter( + private val reportJpaRepository: ReportJpaRepository +) : ReportStatePort { +} \ No newline at end of file From 7de3d198e5ddfa2c5d893e4badf15945fab9473f Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sun, 7 Jul 2024 01:22:30 +0900 Subject: [PATCH 15/16] =?UTF-8?q?feat:=20Message=20Vote,=20Infra=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/wespot/common/BaseEntity.kt | 5 ++++- .../com/wespot/message/MessageJpaEntity.kt | 19 +++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/common/BaseEntity.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/common/BaseEntity.kt index e893a0c4..c67510fa 100644 --- a/infrastructure/mysql/src/main/kotlin/com/wespot/common/BaseEntity.kt +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/common/BaseEntity.kt @@ -1,6 +1,7 @@ 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 @@ -8,13 +9,15 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener import java.time.LocalDateTime @EntityListeners(AuditingEntityListener::class) +@Embeddable class BaseEntity { @CreatedDate - @Column(updatable = false) + @Column(updatable = false, nullable = false) val createdAt: LocalDateTime? = null @LastModifiedDate + @Column(nullable = false) val updatedAt: LocalDateTime? = null } \ No newline at end of file diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/message/MessageJpaEntity.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/message/MessageJpaEntity.kt index cdc36887..eec3d852 100644 --- a/infrastructure/mysql/src/main/kotlin/com/wespot/message/MessageJpaEntity.kt +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/message/MessageJpaEntity.kt @@ -1,30 +1,32 @@ package com.wespot.message import com.wespot.common.BaseEntity -import com.wespot.user.UserJpaEntity import jakarta.persistence.* +import org.jetbrains.annotations.NotNull import java.time.LocalDateTime -@Entity(name = "message") +@Entity +@Table(name = "message") class MessageJpaEntity( + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val id: Long, + @field: NotNull val content: String, - @ManyToOne - @JoinColumn(name = "sender_id") - val sender: UserJpaEntity, + @field: NotNull + val senderId: Long, - @ManyToOne - @JoinColumn(name = "receiver_id") - val receiver: UserJpaEntity, + @field: NotNull + val receiverId: Long, val isReceiverRead: Boolean, val readAt: LocalDateTime, + @field: NotNull val isSent: Boolean, val sentAt: LocalDateTime, @@ -32,6 +34,7 @@ class MessageJpaEntity( val receivedAt: LocalDateTime, @Embedded + @field: NotNull val baseEntity: BaseEntity ) \ No newline at end of file From b41bad7a429b3832008133e8325bd1b8aa588f4a Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Sun, 7 Jul 2024 01:22:36 +0900 Subject: [PATCH 16/16] =?UTF-8?q?feat:=20Ballot=20Vote,=20Infra=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/wespot/vote/BallotJpaEntity.kt | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 infrastructure/mysql/src/main/kotlin/com/wespot/vote/BallotJpaEntity.kt diff --git a/infrastructure/mysql/src/main/kotlin/com/wespot/vote/BallotJpaEntity.kt b/infrastructure/mysql/src/main/kotlin/com/wespot/vote/BallotJpaEntity.kt new file mode 100644 index 00000000..7b49bb32 --- /dev/null +++ b/infrastructure/mysql/src/main/kotlin/com/wespot/vote/BallotJpaEntity.kt @@ -0,0 +1,31 @@ +package com.wespot.vote + +import com.wespot.common.BaseEntity +import jakarta.persistence.* +import org.jetbrains.annotations.NotNull + +@Entity +@Table(name = "ballot") +class BallotJpaEntity( + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + val id: Long, + + @field: NotNull + val voteId: Long, + + @field: NotNull + val senderId: Long, + + @field: NotNull + val receiverId: Long, + + @field: NotNull + @Embedded + val baseEntity: BaseEntity, + + @field: NotNull + val isReceiverRead: Boolean + +)