Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -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<ReviewResponse> {
return client.get("/api/v2/restaurants/$restaurantId/comments") {
return client.get("/api/v3/restaurants/$restaurantId/comments") {
parameter("sort", sort)
}.body()
}
Expand All @@ -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()
}
Expand All @@ -47,25 +47,25 @@ 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(
restaurantId: Long,
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()
Expand All @@ -75,6 +75,6 @@ class DetailApi(
restaurantId: Long,
evalCommentId: Int,
) {
client.delete("/api/v2/auth/restaurants/$restaurantId/comments/$evalCommentId").body<Unit>()
client.delete("/api/v3/auth/restaurants/$restaurantId/comments/$evalCommentId").body<Unit>()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ 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
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,
Expand Down Expand Up @@ -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\"")
}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down