diff --git a/app/src/main/java/com/teumteum/teumteum/presentation/group/review/ReviewViewModel.kt b/app/src/main/java/com/teumteum/teumteum/presentation/group/review/ReviewViewModel.kt index fc5f4ca2..0009dd5e 100644 --- a/app/src/main/java/com/teumteum/teumteum/presentation/group/review/ReviewViewModel.kt +++ b/app/src/main/java/com/teumteum/teumteum/presentation/group/review/ReviewViewModel.kt @@ -36,6 +36,7 @@ class ReviewViewModel @Inject constructor( } fun addSelectDetailFriendList(selectFriendDetail: ReviewFriend) { + _selectDetailFriendList.removeAll { it.id == selectFriendDetail.id } _selectDetailFriendList.add(selectFriendDetail) } diff --git a/core/data/src/main/java/com/teumteum/data/datasource/remote/RemoteGroupDataSource.kt b/core/data/src/main/java/com/teumteum/data/datasource/remote/RemoteGroupDataSource.kt index 35ee5335..fbd9a954 100644 --- a/core/data/src/main/java/com/teumteum/data/datasource/remote/RemoteGroupDataSource.kt +++ b/core/data/src/main/java/com/teumteum/data/datasource/remote/RemoteGroupDataSource.kt @@ -1,6 +1,6 @@ package com.teumteum.data.datasource.remote -import com.teumteum.data.model.request.RequestReviewFriend +import com.teumteum.data.model.request.RequestReviewFriends import com.teumteum.data.model.response.ResponseGroup import com.teumteum.data.model.response.ResponseMeeting import com.teumteum.data.model.response.ResponseReviewFriend @@ -91,7 +91,7 @@ class RemoteGroupDataSource @Inject constructor( suspend fun postRegisterReview( meetingId: Long, - requestReviewFriends: List + requestReviewFriends: RequestReviewFriends ): Boolean { return service.postRegisterReview(meetingId, requestReviewFriends).isSuccessful } diff --git a/core/data/src/main/java/com/teumteum/data/model/request/RequestReviewFriend.kt b/core/data/src/main/java/com/teumteum/data/model/request/RequestReviewFriend.kt index 3461be89..1f591509 100644 --- a/core/data/src/main/java/com/teumteum/data/model/request/RequestReviewFriend.kt +++ b/core/data/src/main/java/com/teumteum/data/model/request/RequestReviewFriend.kt @@ -3,6 +3,11 @@ package com.teumteum.data.model.request import com.teumteum.domain.entity.ReviewFriend import kotlinx.serialization.Serializable +@Serializable +data class RequestReviewFriends( + val reviews: List +) + @Serializable data class RequestReviewFriend( val id: Long, diff --git a/core/data/src/main/java/com/teumteum/data/repository/GroupRepositoryImpl.kt b/core/data/src/main/java/com/teumteum/data/repository/GroupRepositoryImpl.kt index f4bd591e..cfac34f9 100644 --- a/core/data/src/main/java/com/teumteum/data/repository/GroupRepositoryImpl.kt +++ b/core/data/src/main/java/com/teumteum/data/repository/GroupRepositoryImpl.kt @@ -3,9 +3,9 @@ package com.teumteum.data.repository import android.util.Log import com.google.gson.Gson import com.teumteum.data.datasource.remote.RemoteGroupDataSource +import com.teumteum.data.model.request.RequestReviewFriends import com.teumteum.data.model.request.toBody import com.teumteum.data.model.request.toRequestReviewFriend -import com.teumteum.domain.TeumTeumDataStore import com.teumteum.domain.entity.Meeting import com.teumteum.domain.entity.MoimEntity import com.teumteum.domain.entity.ReviewFriend @@ -107,7 +107,7 @@ class GroupRepositoryImpl @Inject constructor( request: List ): Result { return runCatching { - dataSource.postRegisterReview(meetingId, request.map { it.toRequestReviewFriend() }) + dataSource.postRegisterReview(meetingId, RequestReviewFriends(request.map { it.toRequestReviewFriend() })) } } override suspend fun saveBookmark(meetingId: Long): Result { diff --git a/core/data/src/main/java/com/teumteum/data/service/GroupService.kt b/core/data/src/main/java/com/teumteum/data/service/GroupService.kt index 1a12f892..90d2bccd 100644 --- a/core/data/src/main/java/com/teumteum/data/service/GroupService.kt +++ b/core/data/src/main/java/com/teumteum/data/service/GroupService.kt @@ -1,6 +1,6 @@ package com.teumteum.data.service -import com.teumteum.data.model.request.RequestReviewFriend +import com.teumteum.data.model.request.RequestReviewFriends import com.teumteum.data.model.response.ResponseGroup import com.teumteum.data.model.response.ResponseMeeting import com.teumteum.data.model.response.ResponseReviewFriend @@ -89,6 +89,6 @@ interface GroupService { @POST("users/reviews") suspend fun postRegisterReview( @Query("meetingId") meetingsId: Long, - @Body request: List + @Body request: RequestReviewFriends ):Response } \ No newline at end of file