-
Notifications
You must be signed in to change notification settings - Fork 1
[Feat/#31] 평가하기 API 연결 #32
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
Open
imtaejugkim
wants to merge
22
commits into
develop
Choose a base branch
from
feat/#31-evaluate-api
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
d704106
[add/#31] 평가하기 관련 의존성 추가
imtaejugkim 427e63b
[feat/#31] 평가하기 api data 모듈 추가
imtaejugkim 6cfb0e4
[feat/#31] 평가하기 api domain 모듈 추가
imtaejugkim 0f4964f
[feat/#31] 평가하기 api viewmodel 연동 및 UIState 적용
imtaejugkim deeda14
[feat/#31] 평가하기 api koin 연동 및 상태에 따른 ui 로직 변경
imtaejugkim 7d381e5
[feat/#31] 이전 평가 가져오기 api data 모듈 추가
imtaejugkim edf965a
[feat/#31] 이젼 평가 가져오기 api domain 모듈 추가
imtaejugkim 7f7cd90
[mod/#31] 평가 데이터 초기화 데이터 수정 및 UiState, 모델 분리
imtaejugkim 67d22a9
[feat/#31] 이전 평가 가져오기 api viewmodel 연동
imtaejugkim 4f571d6
[feat/#31] 이전 평가 전달 navigation 및 데이터 수정
imtaejugkim c550e7e
[feat/#31] 이전 평가 전달 api 상태에 따른 ui 로직 변경
imtaejugkim b38f775
[fix/#31] 평가 제출 multi-part 분리 로직으로 변경
imtaejugkim e6c51d5
[feat/#31] 티어 화면 식당 id 전달 로직 추가
imtaejugkim 3fb681c
[add/#31] koin 의존성 추가
imtaejugkim 91b6de2
[fix/#31] 식당 id Long형으로 변경
imtaejugkim 263b3ad
[ui/#31] 로딩 시 배경 흰색으로 변경
imtaejugkim 4f9aa9a
[ui/#31] kusbutton 비활성화 인 경우 border 컬러 로직 추가
imtaejugkim 1bac56d
[merge/#31] pulled develop
imtaejugkim 17772f0
[fix/#31] 머지 과정 오류 수정
imtaejugkim ec45b52
[ui/#31] 로딩 및 실패 시도 상단 바 출력되도록 변경
imtaejugkim 16abd92
[chore/#31] 자간 수정
imtaejugkim 18576a6
Merge branch 'develop' into feat/#31-evaluate-api
imtaejugkim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,88 @@ | ||
| plugins { | ||
| alias(libs.plugins.kotlinMultiplatform) | ||
| alias(libs.plugins.androidKotlinMultiplatformLibrary) | ||
| alias(libs.plugins.androidLint) | ||
| alias(libs.plugins.kotlin.serialization) | ||
| } | ||
|
|
||
| kotlin { | ||
| androidLibrary { | ||
| namespace = "com.kus.shared.data.evaluate" | ||
| compileSdk = 36 | ||
| minSdk = 26 | ||
|
|
||
| withHostTestBuilder { | ||
| } | ||
|
|
||
| withDeviceTestBuilder { | ||
| sourceSetTreeName = "test" | ||
| }.configure { | ||
| instrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
| } | ||
| } | ||
|
|
||
| val xcfName = "shared:data:evaluateKit" | ||
|
|
||
| iosX64 { | ||
| binaries.framework { | ||
| baseName = xcfName | ||
| } | ||
| } | ||
|
|
||
| iosArm64 { | ||
| binaries.framework { | ||
| baseName = xcfName | ||
| } | ||
| } | ||
|
|
||
| iosSimulatorArm64 { | ||
| binaries.framework { | ||
| baseName = xcfName | ||
| } | ||
| } | ||
|
|
||
| jvm("desktop") | ||
|
|
||
| sourceSets { | ||
| commonMain { | ||
| dependencies { | ||
| implementation(libs.koin.core) | ||
| implementation(libs.kotlinx.coroutines.core) | ||
|
|
||
| implementation(libs.kotlinx.serialization.json) | ||
| implementation(libs.bundles.ktor) | ||
|
|
||
| implementation(project(":shared:domain:model")) | ||
| implementation(project(":shared:domain:evaluate")) | ||
| implementation(project(":shared:data:network")) | ||
| } | ||
| } | ||
|
|
||
| commonTest { | ||
| dependencies { | ||
| implementation(libs.kotlin.test) | ||
| } | ||
| } | ||
|
|
||
| androidMain { | ||
| dependencies { | ||
| implementation(libs.koin.android) | ||
| implementation(libs.datastore.preferences) | ||
| } | ||
| } | ||
|
|
||
| getByName("androidDeviceTest") { | ||
| dependencies { | ||
| implementation(libs.androidx.runner) | ||
| implementation(libs.androidx.core) | ||
| implementation(libs.androidx.testExt.junit) | ||
| } | ||
| } | ||
|
|
||
| iosMain { | ||
| dependencies { | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } |
This file contains hidden or 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,4 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
|
||
| </manifest> |
56 changes: 56 additions & 0 deletions
56
shared/data/evaluate/src/commonMain/kotlin/com/kus/kustaurant/evaluate/api/EvaluateApi.kt
This file contains hidden or 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,56 @@ | ||
| package com.kus.kustaurant.evaluate.api | ||
|
|
||
| import com.kus.kustaurant.evaluate.remote.request.EvaluationRequest | ||
| import com.kus.kustaurant.evaluate.remote.response.EvaluationResponse | ||
| import io.ktor.client.HttpClient | ||
| import io.ktor.client.call.body | ||
| import io.ktor.client.request.forms.MultiPartFormDataContent | ||
| import io.ktor.client.request.forms.formData | ||
| import io.ktor.client.request.get | ||
| import io.ktor.client.request.post | ||
| import io.ktor.client.request.setBody | ||
| import io.ktor.http.Headers | ||
| import io.ktor.http.HttpHeaders | ||
|
|
||
| class EvaluateApi( | ||
| private val client: HttpClient, | ||
| ) { | ||
| suspend fun getEvaluation(restaurantId: Long): EvaluationResponse { | ||
| return client.get("/api/v2/auth/restaurants/$restaurantId/evaluation").body() | ||
| } | ||
|
|
||
| suspend fun postEvaluation( | ||
| restaurantId: Long, | ||
| request: EvaluationRequest, | ||
| imageBytes: ByteArray?, | ||
| ) { | ||
| client.post("/api/v2/auth/restaurants/$restaurantId/evaluation") { | ||
| setBody( | ||
| MultiPartFormDataContent( | ||
| formData { | ||
| append("evaluationScore", request.evaluationScore.toString()) | ||
|
|
||
| request.evaluationSituations?.forEach { situation -> | ||
| append("evaluationSituations", situation.toString()) | ||
| } | ||
|
|
||
| request.evaluationComment?.let { | ||
| append("evaluationComment", it) | ||
| } | ||
|
|
||
| imageBytes?.let { | ||
| append( | ||
| key = "newImage", | ||
| value = it, | ||
| headers = Headers.build { | ||
| append(HttpHeaders.ContentType, "image/jpeg") | ||
| append(HttpHeaders.ContentDisposition, "filename=evaluation.jpg") | ||
| } | ||
| ) | ||
| } | ||
| } | ||
| ) | ||
| ) | ||
| } | ||
| } | ||
| } |
13 changes: 13 additions & 0 deletions
13
.../data/evaluate/src/commonMain/kotlin/com/kus/kustaurant/evaluate/di/evaluateDataModule.kt
This file contains hidden or 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.kus.kustaurant.evaluate.di | ||
|
|
||
| import com.kus.kustaurant.evaluate.api.EvaluateApi | ||
| import com.kus.kustaurant.evaluate.repositoryimpl.EvaluateRepositoryImpl | ||
| import com.kus.shared.domain.evaluate.repository.EvaluateRepository | ||
| import org.koin.core.module.dsl.singleOf | ||
| import org.koin.dsl.bind | ||
| import org.koin.dsl.module | ||
|
|
||
| val evaluateDataModule = module { | ||
| singleOf(::EvaluateApi) | ||
| singleOf(::EvaluateRepositoryImpl) bind EvaluateRepository::class | ||
| } |
21 changes: 21 additions & 0 deletions
21
...valuate/src/commonMain/kotlin/com/kus/kustaurant/evaluate/remote/mapper/EvaluateMapper.kt
This file contains hidden or 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.kus.kustaurant.evaluate.remote.mapper | ||
|
|
||
| import com.kus.kustaurant.evaluate.remote.response.EvaluationResponse | ||
| import com.kus.kustaurant.evaluate.remote.response.StarCommentResponse | ||
| import com.kus.shared.domain.model.evaluate.PreviousEvaluation | ||
| import com.kus.shared.domain.model.evaluate.PreviousStarComment | ||
|
|
||
| fun EvaluationResponse.toDomain(): PreviousEvaluation = | ||
| PreviousEvaluation( | ||
| evaluationScore = evaluationScore, | ||
| evaluationSituations = evaluationSituations ?: emptyList(), | ||
| evaluationImgUrl = evaluationImgUrl, | ||
| evaluationComment = evaluationComment, | ||
| starComments = starComments.map { it.toDomain() }, | ||
| ) | ||
|
|
||
| fun StarCommentResponse.toDomain(): PreviousStarComment = | ||
| PreviousStarComment( | ||
| star = star, | ||
| comment = comment, | ||
| ) |
10 changes: 10 additions & 0 deletions
10
...ate/src/commonMain/kotlin/com/kus/kustaurant/evaluate/remote/request/EvaluationRequest.kt
This file contains hidden or 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.kus.kustaurant.evaluate.remote.request | ||
|
|
||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class EvaluationRequest( | ||
| val evaluationScore: Double, | ||
| val evaluationSituations: List<Int>? = null, | ||
| val evaluationComment: String? = null, | ||
| ) |
19 changes: 19 additions & 0 deletions
19
...e/src/commonMain/kotlin/com/kus/kustaurant/evaluate/remote/response/EvaluationResponse.kt
This file contains hidden or 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,19 @@ | ||
| package com.kus.kustaurant.evaluate.remote.response | ||
|
|
||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class EvaluationResponse( | ||
| val evaluationScore: Double? = null, | ||
| val evaluationSituations: List<Int>? = null, | ||
| val evaluationImgUrl: String? = null, | ||
| val evaluationComment: String? = null, | ||
| val starComments: List<StarCommentResponse> = emptyList(), | ||
| val newImage: String? = null, | ||
| ) | ||
|
|
||
| @Serializable | ||
| data class StarCommentResponse( | ||
| val star: Double, | ||
| val comment: String, | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
평가 완료 후 이전 화면을 갱신할 결과 전달 경로가 없습니다.
여기서는
Evaluate로 이동만 하고, 이 파일의 evaluate 흐름은onBackClick만 연결돼 있어서 제출 성공 여부나 갱신 신호가Detail/Tier로 돌아오지 않습니다. 같은 파일의tierNavGraph/communityNavGraph처럼savedStateHandle이나 명시적 result callback을 붙이지 않으면, 사용자는 방금 평가한 내용이 즉시 반영되지 않은 화면을 보게 됩니다.원하시면
savedStateHandle기반 결과 전달 키 설계까지 같이 정리해드릴게요.🤖 Prompt for AI Agents