diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 4749c979..a3340d77 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -2,7 +2,9 @@ - closed #이슈넘버 ## 작업한 내용 -- +- ## PR 포인트 -- +- + +## 🚀Next Feature diff --git a/core/domain/build.gradle.kts b/core/domain/build.gradle.kts new file mode 100644 index 00000000..df94074b --- /dev/null +++ b/core/domain/build.gradle.kts @@ -0,0 +1,18 @@ +plugins { + `java-library` + alias(libs.plugins.funch.jvm.library) + alias(libs.plugins.ktlint) +} + +tasks.withType { + useJUnitPlatform() +} + +dependencies { + implementation(libs.javax.inject) + // test + testImplementation(kotlin("test")) + testImplementation(libs.bundles.junit5) + testImplementation(libs.truth) + testImplementation(libs.kotlin.coroutines.test) +} diff --git a/core/domain/src/main/java/com/moya/funch/entity/Blood.kt b/core/domain/src/main/java/com/moya/funch/entity/Blood.kt new file mode 100644 index 00000000..1ce0e59e --- /dev/null +++ b/core/domain/src/main/java/com/moya/funch/entity/Blood.kt @@ -0,0 +1,9 @@ +package com.moya.funch.entity + +enum class Blood { + A, + B, + AB, + O, + IDLE, +} diff --git a/core/domain/src/main/java/com/moya/funch/entity/Club.kt b/core/domain/src/main/java/com/moya/funch/entity/Club.kt new file mode 100644 index 00000000..b4ecd27e --- /dev/null +++ b/core/domain/src/main/java/com/moya/funch/entity/Club.kt @@ -0,0 +1,15 @@ +package com.moya.funch.entity + +enum class Club(val label: String) { + NEXTERS("넥스터즈"), + SOPT("SOPT"), + DEPROMEET("Depromeet"), + IDLE("idle"), + ; + + companion object { + fun of(clubName: String): Club { + return requireNotNull(entries.find { it.label == clubName }) { "Club : $clubName not found" } + } + } +} diff --git a/core/domain/src/main/java/com/moya/funch/entity/Job.kt b/core/domain/src/main/java/com/moya/funch/entity/Job.kt new file mode 100644 index 00000000..7232533a --- /dev/null +++ b/core/domain/src/main/java/com/moya/funch/entity/Job.kt @@ -0,0 +1,14 @@ +package com.moya.funch.entity + +enum class Job(val krName: String) { + DEVELOPER("개발자"), + DESIGNER("디자이너"), + IDLE("idle"), + ; + + companion object { + fun of(krName: String): Job { + return requireNotNull(entries.find { it.krName == krName }) { "Job : $krName not found" } + } + } +} diff --git a/core/domain/src/main/java/com/moya/funch/entity/Mbti.kt b/core/domain/src/main/java/com/moya/funch/entity/Mbti.kt new file mode 100644 index 00000000..f69a8b6d --- /dev/null +++ b/core/domain/src/main/java/com/moya/funch/entity/Mbti.kt @@ -0,0 +1,21 @@ +package com.moya.funch.entity + +enum class Mbti { + ENFJ, + ENFP, + ENTJ, + ENTP, + ESFJ, + ESFP, + ESTJ, + ESTP, + INFJ, + INFP, + INTJ, + INTP, + ISFJ, + ISFP, + ISTJ, + ISTP, + IDLE, +} diff --git a/core/domain/src/main/java/com/moya/funch/entity/SubwayStation.kt b/core/domain/src/main/java/com/moya/funch/entity/SubwayStation.kt new file mode 100644 index 00000000..b7c532d2 --- /dev/null +++ b/core/domain/src/main/java/com/moya/funch/entity/SubwayStation.kt @@ -0,0 +1,24 @@ +package com.moya.funch.entity + +data class SubwayStation( + val name: String = "", + val lines: List = emptyList(), +) + +enum class SubwayLine { + ONE, + TWO, + THREE, + FOUR, + FIVE, + SIX, + SEVEN, + EIGHT, + NINE, + AIRPORT, + EVERLINE, + GYEONGCHUN, + GYEONGUI, + SINBUNDANG, + SUIN, +} diff --git a/core/domain/src/main/java/com/moya/funch/entity/match/Chemistry.kt b/core/domain/src/main/java/com/moya/funch/entity/match/Chemistry.kt new file mode 100644 index 00000000..4be4ff0a --- /dev/null +++ b/core/domain/src/main/java/com/moya/funch/entity/match/Chemistry.kt @@ -0,0 +1,6 @@ +package com.moya.funch.entity.match + +data class Chemistry( + val title: String, + val description: String, +) diff --git a/core/domain/src/main/java/com/moya/funch/entity/match/Matching.kt b/core/domain/src/main/java/com/moya/funch/entity/match/Matching.kt new file mode 100644 index 00000000..f093d451 --- /dev/null +++ b/core/domain/src/main/java/com/moya/funch/entity/match/Matching.kt @@ -0,0 +1,18 @@ +package com.moya.funch.entity.match + +import com.moya.funch.entity.SubwayStation +import com.moya.funch.entity.profile.Profile + +data class Matching( + val profile: Profile, + val similarity: Int = 0, + val chemistrys: List = emptyList(), + val recommends: List = emptyList(), + val subways: List = emptyList(), +) { + init { + require(similarity in 0..100) { + "similarity must be in 0..100" + } + } +} diff --git a/core/domain/src/main/java/com/moya/funch/entity/match/Recommend.kt b/core/domain/src/main/java/com/moya/funch/entity/match/Recommend.kt new file mode 100644 index 00000000..7b7d78a8 --- /dev/null +++ b/core/domain/src/main/java/com/moya/funch/entity/match/Recommend.kt @@ -0,0 +1,5 @@ +package com.moya.funch.entity.match + +data class Recommend( + val title: String, +) diff --git a/core/domain/src/main/java/com/moya/funch/entity/profile/Profile.kt b/core/domain/src/main/java/com/moya/funch/entity/profile/Profile.kt new file mode 100644 index 00000000..e817fd26 --- /dev/null +++ b/core/domain/src/main/java/com/moya/funch/entity/profile/Profile.kt @@ -0,0 +1,18 @@ +package com.moya.funch.entity.profile + +import com.moya.funch.entity.Blood +import com.moya.funch.entity.Club +import com.moya.funch.entity.Job +import com.moya.funch.entity.Mbti +import com.moya.funch.entity.SubwayStation + +data class Profile( + val id: String = "", + val code: String = "", + val name: String = "", + val job: Job = Job.IDLE, + val clubs: List = emptyList(), + val mbti: Mbti = Mbti.IDLE, + val blood: Blood = Blood.IDLE, + val subways: List = emptyList(), +) diff --git a/core/domain/src/main/java/com/moya/funch/repository/MatchingRepository.kt b/core/domain/src/main/java/com/moya/funch/repository/MatchingRepository.kt new file mode 100644 index 00000000..f57d832b --- /dev/null +++ b/core/domain/src/main/java/com/moya/funch/repository/MatchingRepository.kt @@ -0,0 +1,10 @@ +package com.moya.funch.repository + +import com.moya.funch.entity.match.Matching + +fun interface MatchingRepository { + suspend fun matchProfile( + userId: String, + targetCode: String, + ): Matching +} diff --git a/core/domain/src/main/java/com/moya/funch/usecase/MatchProfileUseCase.kt b/core/domain/src/main/java/com/moya/funch/usecase/MatchProfileUseCase.kt new file mode 100644 index 00000000..701d8675 --- /dev/null +++ b/core/domain/src/main/java/com/moya/funch/usecase/MatchProfileUseCase.kt @@ -0,0 +1,23 @@ +package com.moya.funch.usecase + +import com.moya.funch.entity.match.Matching +import com.moya.funch.repository.MatchingRepository +import javax.inject.Inject + +class MatchProfileUseCaseImpl + @Inject + constructor( + private val matchingRepository: MatchingRepository, + ) : MatchProfileUseCase { + override suspend operator fun invoke( + userId: String, + targetCode: String, + ): Matching = matchingRepository.matchProfile(userId, targetCode) + } + +fun interface MatchProfileUseCase { + suspend operator fun invoke( + userId: String, + targetCode: String, + ): Matching +} diff --git a/core/domain/src/test/java/com/moya/funch/entity/ClubTest.kt b/core/domain/src/test/java/com/moya/funch/entity/ClubTest.kt new file mode 100644 index 00000000..d3b84ca0 --- /dev/null +++ b/core/domain/src/test/java/com/moya/funch/entity/ClubTest.kt @@ -0,0 +1,13 @@ +package com.moya.funch.entity + +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows + +internal class ClubTest { + @Test + fun `동아리에 포함되지 않는 이름으로 찾을 수 없다`() { + assertThrows("Club : 닭아리 not found") { + Club.of("닭아리") + } + } +} diff --git a/core/domain/src/test/java/com/moya/funch/entity/JobTest.kt b/core/domain/src/test/java/com/moya/funch/entity/JobTest.kt new file mode 100644 index 00000000..5ba20247 --- /dev/null +++ b/core/domain/src/test/java/com/moya/funch/entity/JobTest.kt @@ -0,0 +1,13 @@ +package com.moya.funch.entity + +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows + +internal class JobTest { + @Test + fun `직군에 해당하지 않는 한글 이름으로 찾을 수 없다`() { + assertThrows("Job : 디발자 not found") { + Job.of("디발자") + } + } +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 1030cc3f..8425c4dd 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -24,7 +24,9 @@ include(":core:designsystem") include(":core:testing") include(":core:network") include(":core:datastore") +include(":core:domain") include(":core:data") + // feature include(":feature:profile") include(":feature:home")