-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] domain module 세팅, matching profile entity 설정 (#33)
* [build] domain 의존성 세팅 * [feat] match, profile 관련 domain entity * [feat] MatchingRepository * [feat] MatchProfileUseCase * [build] project build.gradle에 domain 의존성추가 * [feat/test] Job enum * [feat/test] �Club enum * [feat] Mbti enum * [feat] Blood enum * [feat] Chemistry entity * [chore] MatchingResult -> Matching * [feat] MatchingRepository * [feat] DefaultMatchProfileUseCase * [feat] PR 템플릿에 다음 작업할 거 추가 * [chore] 코리 반영 * [chore] DefaultMatchProfileUseCase -> MatchProfileUseCaseImpl
- Loading branch information
Showing
16 changed files
with
213 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,9 @@ | |
- closed #이슈넘버 | ||
|
||
## 작업한 내용 | ||
- | ||
- | ||
|
||
## PR 포인트 | ||
- | ||
- | ||
|
||
## 🚀Next Feature |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
plugins { | ||
`java-library` | ||
alias(libs.plugins.funch.jvm.library) | ||
alias(libs.plugins.ktlint) | ||
} | ||
|
||
tasks.withType<Test> { | ||
useJUnitPlatform() | ||
} | ||
|
||
dependencies { | ||
implementation(libs.javax.inject) | ||
// test | ||
testImplementation(kotlin("test")) | ||
testImplementation(libs.bundles.junit5) | ||
testImplementation(libs.truth) | ||
testImplementation(libs.kotlin.coroutines.test) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.moya.funch.entity | ||
|
||
enum class Blood { | ||
A, | ||
B, | ||
AB, | ||
O, | ||
IDLE, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
} |
24 changes: 24 additions & 0 deletions
24
core/domain/src/main/java/com/moya/funch/entity/SubwayStation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.moya.funch.entity | ||
|
||
data class SubwayStation( | ||
val name: String = "", | ||
val lines: List<SubwayLine> = emptyList(), | ||
) | ||
|
||
enum class SubwayLine { | ||
ONE, | ||
TWO, | ||
THREE, | ||
FOUR, | ||
FIVE, | ||
SIX, | ||
SEVEN, | ||
EIGHT, | ||
NINE, | ||
AIRPORT, | ||
EVERLINE, | ||
GYEONGCHUN, | ||
GYEONGUI, | ||
SINBUNDANG, | ||
SUIN, | ||
} |
6 changes: 6 additions & 0 deletions
6
core/domain/src/main/java/com/moya/funch/entity/match/Chemistry.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.moya.funch.entity.match | ||
|
||
data class Chemistry( | ||
val title: String, | ||
val description: String, | ||
) |
18 changes: 18 additions & 0 deletions
18
core/domain/src/main/java/com/moya/funch/entity/match/Matching.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Chemistry> = emptyList(), | ||
val recommends: List<Recommend> = emptyList(), | ||
val subways: List<SubwayStation> = emptyList(), | ||
) { | ||
init { | ||
require(similarity in 0..100) { | ||
"similarity must be in 0..100" | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
core/domain/src/main/java/com/moya/funch/entity/match/Recommend.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.moya.funch.entity.match | ||
|
||
data class Recommend( | ||
val title: String, | ||
) |
18 changes: 18 additions & 0 deletions
18
core/domain/src/main/java/com/moya/funch/entity/profile/Profile.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Club> = emptyList(), | ||
val mbti: Mbti = Mbti.IDLE, | ||
val blood: Blood = Blood.IDLE, | ||
val subways: List<SubwayStation> = emptyList(), | ||
) |
10 changes: 10 additions & 0 deletions
10
core/domain/src/main/java/com/moya/funch/repository/MatchingRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
23 changes: 23 additions & 0 deletions
23
core/domain/src/main/java/com/moya/funch/usecase/MatchProfileUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
13 changes: 13 additions & 0 deletions
13
core/domain/src/test/java/com/moya/funch/entity/ClubTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<IllegalArgumentException>("Club : 닭아리 not found") { | ||
Club.of("닭아리") | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
core/domain/src/test/java/com/moya/funch/entity/JobTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<IllegalArgumentException>("Job : 디발자 not found") { | ||
Job.of("디발자") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters