diff --git a/data/src/main/java/com/dpm/data/datasource/SeatReviewDataSource.kt b/data/src/main/java/com/dpm/data/datasource/SeatReviewDataSource.kt index 65f78f79..7b4f2052 100644 --- a/data/src/main/java/com/dpm/data/datasource/SeatReviewDataSource.kt +++ b/data/src/main/java/com/dpm/data/datasource/SeatReviewDataSource.kt @@ -35,7 +35,6 @@ interface SeatReviewDataSource { suspend fun postSeatReviewData( blockId: Int, - seatNumber: Int, requestSeatReviewDto: RequestSeatReviewDto, ) } diff --git a/data/src/main/java/com/dpm/data/datasource/remote/SeatReviewDataSourceImpl.kt b/data/src/main/java/com/dpm/data/datasource/remote/SeatReviewDataSourceImpl.kt index 56fdb758..c0f22232 100644 --- a/data/src/main/java/com/dpm/data/datasource/remote/SeatReviewDataSourceImpl.kt +++ b/data/src/main/java/com/dpm/data/datasource/remote/SeatReviewDataSourceImpl.kt @@ -58,12 +58,10 @@ class SeatReviewDataSourceImpl @Inject constructor( override suspend fun postSeatReviewData( blockId: Int, - seatNumber: Int, requestSeatReviewDto: RequestSeatReviewDto, ) { return seatReviewService.postSeatReview( blockId, - seatNumber, requestSeatReviewDto, ) } diff --git a/data/src/main/java/com/dpm/data/model/request/seatreview/RequestSeatReviewDto.kt b/data/src/main/java/com/dpm/data/model/request/seatreview/RequestSeatReviewDto.kt index 9ccc851d..5c57f2fb 100644 --- a/data/src/main/java/com/dpm/data/model/request/seatreview/RequestSeatReviewDto.kt +++ b/data/src/main/java/com/dpm/data/model/request/seatreview/RequestSeatReviewDto.kt @@ -6,22 +6,28 @@ import kotlinx.serialization.Serializable @Serializable data class RequestSeatReviewDto( + @SerialName("rowNumber") + val rowNumber: Int?, + @SerialName("seatNumber") + val seatNumber: Int?, @SerialName("images") val images: List, - @SerialName("dateTime") - val dateTime: String, @SerialName("good") val good: List, @SerialName("bad") val bad: List, @SerialName("content") val content: String?, + @SerialName("dateTime") + val dateTime: String, ) fun RequestSeatReview.toSeatReview() = RequestSeatReviewDto( + rowNumber = rowNumber, + seatNumber = seatNumber, images = images, - dateTime = dateTime, good = good, bad = bad, content = content, + dateTime = dateTime, ) diff --git a/data/src/main/java/com/dpm/data/remote/SeatReviewService.kt b/data/src/main/java/com/dpm/data/remote/SeatReviewService.kt index 01996a0b..43a65aea 100644 --- a/data/src/main/java/com/dpm/data/remote/SeatReviewService.kt +++ b/data/src/main/java/com/dpm/data/remote/SeatReviewService.kt @@ -47,10 +47,9 @@ interface SeatReviewService { @Body image: RequestBody, ) - @POST("/api/v1/blocks/{blockId}/seats/{seatNumber}/reviews") + @POST("/api/v1/blocks/{blockId}/reviews") suspend fun postSeatReview( @Path("blockId") blockId: Int, - @Path("seatNumber") seatNumber: Int, @Body requestPostSignupDto: RequestSeatReviewDto, ) } diff --git a/data/src/main/java/com/dpm/data/repository/SeatReviewRepositoryImpl.kt b/data/src/main/java/com/dpm/data/repository/SeatReviewRepositoryImpl.kt index a822fc87..d9d968d4 100644 --- a/data/src/main/java/com/dpm/data/repository/SeatReviewRepositoryImpl.kt +++ b/data/src/main/java/com/dpm/data/repository/SeatReviewRepositoryImpl.kt @@ -76,13 +76,11 @@ class SeatReviewRepositoryImpl @Inject constructor( override suspend fun postSeatReview( blockId: Int, - seatNumber: Int, seatReviewInfo: RequestSeatReview, ): Result { return runCatching { seatReviewDataSource.postSeatReviewData( blockId, - seatNumber, seatReviewInfo.toSeatReview(), ) } diff --git a/domain/src/main/java/com/dpm/domain/entity/request/seatreview/RequestSeatReview.kt b/domain/src/main/java/com/dpm/domain/entity/request/seatreview/RequestSeatReview.kt index 6ec3a419..7bd6fd56 100644 --- a/domain/src/main/java/com/dpm/domain/entity/request/seatreview/RequestSeatReview.kt +++ b/domain/src/main/java/com/dpm/domain/entity/request/seatreview/RequestSeatReview.kt @@ -1,9 +1,11 @@ package com.dpm.domain.entity.request.seatreview data class RequestSeatReview( + val rowNumber: Int?, + val seatNumber: Int?, val images: List, - val dateTime: String, val good: List, val bad: List, val content: String?, + val dateTime: String, ) diff --git a/domain/src/main/java/com/dpm/domain/repository/SeatReviewRepository.kt b/domain/src/main/java/com/dpm/domain/repository/SeatReviewRepository.kt index 1f32994c..d55c21c1 100644 --- a/domain/src/main/java/com/dpm/domain/repository/SeatReviewRepository.kt +++ b/domain/src/main/java/com/dpm/domain/repository/SeatReviewRepository.kt @@ -34,8 +34,7 @@ interface SeatReviewRepository { ): Result suspend fun postSeatReview( - seatId: Int, - seatNumber: Int, + blockId: Int, seatReviewInfo: RequestSeatReview, ): Result } diff --git a/presentation/src/main/java/com/dpm/presentation/seatreview/ReviewViewModel.kt b/presentation/src/main/java/com/dpm/presentation/seatreview/ReviewViewModel.kt index cd15307d..b9c143ea 100644 --- a/presentation/src/main/java/com/dpm/presentation/seatreview/ReviewViewModel.kt +++ b/presentation/src/main/java/com/dpm/presentation/seatreview/ReviewViewModel.kt @@ -334,11 +334,13 @@ class ReviewViewModel @Inject constructor( fun postSeatReview() { viewModelScope.launch { val requestSeatReview = RequestSeatReview( + rowNumber = _selectedColumn.value.toIntOrNull(), + seatNumber = _selectedNumber.value.toIntOrNull(), images = _preSignedUrlImages.value, - dateTime = _selectedDate.value, good = _selectedGoodReview.value, bad = _selectedBadReview.value, content = detailReviewText.value, + dateTime = _selectedDate.value, ) Timber.d("Selected Images: ${_preSignedUrlImages.value}") Timber.d("Selected Date: ${_selectedDate.value}") @@ -347,12 +349,11 @@ class ReviewViewModel @Inject constructor( Timber.d("Detail Review Text: ${detailReviewText.value}") Timber.d("Selected Stadium ID: ${_selectedStadiumId.value}") Timber.d("Selected Block ID: ${_selectedBlockId.value}") + Timber.d("Selected seatColumn: ${selectedColumn.value}") Timber.d("Selected seatNumber: ${selectedNumber.value}") - Timber.d("Selected Number: ${selectedNumber.value}") _postReviewState.value = UiState.Loading seatReviewRepository.postSeatReview( _selectedBlockId.value, - selectedNumber.value.toInt(), requestSeatReview, ) .onSuccess { @@ -361,7 +362,15 @@ class ReviewViewModel @Inject constructor( } .onFailure { t -> if (t is HttpException) { - Timber.e("POST REVIEW FAILURE : $t") + val errorCode = t.code() // HTTP 상태 코드 (403) + val errorBody = t.response()?.errorBody()?.string() // 응답 본문 + val errorHeaders = t.response()?.headers()?.toString() // 응답 헤더 + + Timber.e("POST REVIEW FAILURE: HTTP $errorCode") + Timber.e("Error Body: $errorBody") + Timber.e("Error Headers: $errorHeaders") + } else { + Timber.e("POST REVIEW FAILURE: $t") } } }