Skip to content
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

[feat] domain module 세팅, matching profile entity 설정 #33

Merged
merged 17 commits into from
Feb 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
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
ham2174 marked this conversation as resolved.
Show resolved Hide resolved
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 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

지하철 라인이 피그마에서 23개입니다!

  • 미포함 라인 : 인천1호선, 인천2호선, 의정부, 우이신설, 김포골드, 신림, 경강, 서해

Copy link
Member Author

Choose a reason for hiding this comment

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

이 부분 서버랑 네이밍 맞추면 좋을 거 같아서 일단 보류해 둘게유~
서버 enum 긁어온건디 지하철 api 아직 구현 전인거 같넹

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 {
ham2174 marked this conversation as resolved.
Show resolved Hide resolved
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
Loading