Skip to content

Commit

Permalink
[feat] domain module 세팅, matching profile entity 설정 (#33)
Browse files Browse the repository at this point in the history
* [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
murjune authored Feb 6, 2024
1 parent 4ecd6d1 commit d3d1068
Show file tree
Hide file tree
Showing 16 changed files with 213 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
- closed #이슈넘버

## 작업한 내용
-
-

## PR 포인트
-
-

## 🚀Next Feature
18 changes: 18 additions & 0 deletions core/domain/build.gradle.kts
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)
}
9 changes: 9 additions & 0 deletions core/domain/src/main/java/com/moya/funch/entity/Blood.kt
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,
}
15 changes: 15 additions & 0 deletions core/domain/src/main/java/com/moya/funch/entity/Club.kt
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" }
}
}
}
14 changes: 14 additions & 0 deletions core/domain/src/main/java/com/moya/funch/entity/Job.kt
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" }
}
}
}
21 changes: 21 additions & 0 deletions core/domain/src/main/java/com/moya/funch/entity/Mbti.kt
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 core/domain/src/main/java/com/moya/funch/entity/SubwayStation.kt
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,
}
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 core/domain/src/main/java/com/moya/funch/entity/match/Matching.kt
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"
}
}
}
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 core/domain/src/main/java/com/moya/funch/entity/profile/Profile.kt
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(),
)
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
}
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 core/domain/src/test/java/com/moya/funch/entity/ClubTest.kt
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 core/domain/src/test/java/com/moya/funch/entity/JobTest.kt
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("디발자")
}
}
}
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit d3d1068

Please sign in to comment.