diff --git a/shared/data/detail/src/commonMain/kotlin/com/kus/kustaurant/detail/api/DetailApi.kt b/shared/data/detail/src/commonMain/kotlin/com/kus/kustaurant/detail/api/DetailApi.kt index 6f18cd57..b9e492fd 100644 --- a/shared/data/detail/src/commonMain/kotlin/com/kus/kustaurant/detail/api/DetailApi.kt +++ b/shared/data/detail/src/commonMain/kotlin/com/kus/kustaurant/detail/api/DetailApi.kt @@ -22,14 +22,14 @@ class DetailApi( private val client: HttpClient, ) { suspend fun getRestaurantDetail(restaurantId: Long): DetailResponse { - return client.get("/api/v2/restaurants/$restaurantId").body() + return client.get("/api/v3/restaurants/$restaurantId").body() } suspend fun getRestaurantReviews( restaurantId: Long, sort: String = "POPULARITY" ): List { - return client.get("/api/v2/restaurants/$restaurantId/comments") { + return client.get("/api/v3/restaurants/$restaurantId/comments") { parameter("sort", sort) }.body() } @@ -38,7 +38,7 @@ class DetailApi( evaluationId: Int, reaction: String?, ): EvaluationReactionResponse { - return client.put("/api/v2/auth/restaurants/evaluations/$evaluationId/reaction") { + return client.put("/api/v3/auth/restaurants/evaluations/$evaluationId/reaction") { reaction?.let { parameter("reaction", it) } }.body() } @@ -47,17 +47,17 @@ class DetailApi( evalCommentId: Int, reaction: String?, ): CommentReactionResponse { - return client.put("/api/v2/auth/eval-comments/$evalCommentId") { + return client.put("/api/v3/auth/eval-comments/$evalCommentId") { reaction?.let { parameter("reaction", it) } }.body() } suspend fun putRestaurantFavorite(restaurantId: Long): FavoriteResponse { - return client.put("/api/v2/auth/restaurants/$restaurantId/favorite").body() + return client.put("/api/v3/auth/restaurants/$restaurantId/favorite").body() } suspend fun deleteRestaurantFavorite(restaurantId: Long): FavoriteResponse { - return client.delete("/api/v2/auth/restaurants/$restaurantId/favorite").body() + return client.delete("/api/v3/auth/restaurants/$restaurantId/favorite").body() } suspend fun postComment( @@ -65,7 +65,7 @@ class DetailApi( evalId: Int, body: String, ): ReviewCommentResponse { - return client.post("/api/v2/auth/restaurants/$restaurantId/comments/$evalId") { + return client.post("/api/v3/auth/restaurants/$restaurantId/comments/$evalId") { contentType(ContentType.Application.Json) setBody(PostCommentRequest(body)) }.body() @@ -75,6 +75,6 @@ class DetailApi( restaurantId: Long, evalCommentId: Int, ) { - client.delete("/api/v2/auth/restaurants/$restaurantId/comments/$evalCommentId").body() + client.delete("/api/v3/auth/restaurants/$restaurantId/comments/$evalCommentId").body() } } diff --git a/shared/data/evaluate/src/commonMain/kotlin/com/kus/kustaurant/evaluate/api/EvaluateApi.kt b/shared/data/evaluate/src/commonMain/kotlin/com/kus/kustaurant/evaluate/api/EvaluateApi.kt index a9a9f9cb..f9ced1be 100644 --- a/shared/data/evaluate/src/commonMain/kotlin/com/kus/kustaurant/evaluate/api/EvaluateApi.kt +++ b/shared/data/evaluate/src/commonMain/kotlin/com/kus/kustaurant/evaluate/api/EvaluateApi.kt @@ -4,6 +4,7 @@ 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.InputProvider import io.ktor.client.request.forms.MultiPartFormDataContent import io.ktor.client.request.forms.formData import io.ktor.client.request.get @@ -11,6 +12,7 @@ import io.ktor.client.request.post import io.ktor.client.request.setBody import io.ktor.http.Headers import io.ktor.http.HttpHeaders +import io.ktor.utils.io.core.ByteReadPacket class EvaluateApi( private val client: HttpClient, @@ -38,13 +40,13 @@ class EvaluateApi( append("evaluationComment", it) } - imageBytes?.let { + imageBytes?.let { bytes -> append( key = "newImage", - value = it, + value = InputProvider(bytes.size.toLong()) { ByteReadPacket(bytes) }, headers = Headers.build { append(HttpHeaders.ContentType, "image/jpeg") - append(HttpHeaders.ContentDisposition, "filename=evaluation.jpg") + append(HttpHeaders.ContentDisposition, "filename=\"evaluation.jpg\"") } ) } diff --git a/shared/feature/detail/src/commonMain/kotlin/com/kus/feature/detail/component/DetailRestInfo.kt b/shared/feature/detail/src/commonMain/kotlin/com/kus/feature/detail/component/DetailRestInfo.kt index 8e62bdc3..ad73135a 100644 --- a/shared/feature/detail/src/commonMain/kotlin/com/kus/feature/detail/component/DetailRestInfo.kt +++ b/shared/feature/detail/src/commonMain/kotlin/com/kus/feature/detail/component/DetailRestInfo.kt @@ -169,12 +169,12 @@ fun DetailRestInfo( modifier = Modifier.padding(top = 20.dp) ) -// DetailRestInfoMore( -// title = "제휴정보", -// content = partnershipInfo, -// enableSeeMore = true, -// modifier = Modifier.padding(top = 12.dp) -// ) + DetailRestInfoMore( + title = "제휴정보", + content = partnershipInfo.ifBlank { "제휴 정보 없음" }, + enableSeeMore = true, + modifier = Modifier.padding(top = 12.dp) + ) } Text(