Skip to content
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

[FEAT/#130] 지도 리스트의 특정 리뷰 삭제 API 연결 #136

Merged
merged 2 commits into from
Jan 23, 2025
Merged
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
@@ -7,4 +7,5 @@ interface PostRemoteDataSource {
suspend fun postScoopPost(postId: Int, userId: Int): BaseResponse<Boolean>
suspend fun getPostData(postId: Int, userId: Int): BaseResponse<GetPostResponseDto>
suspend fun postAddMapData(postId: Int, userId: Int): BaseResponse<Boolean>
suspend fun deletePinMap(postId: Int, userId: Int): BaseResponse<Boolean>
}
Original file line number Diff line number Diff line change
@@ -19,6 +19,12 @@ class PostRemoteDataSourceImpl @Inject constructor(
PostScoopRequestDto(postId = postId, userId = userId)
)

override suspend fun deletePinMap(postId: Int, userId: Int): BaseResponse<Boolean> =
postService.deletePinMap(
postId = postId,
userId = userId
)

override suspend fun postAddMapData(postId: Int, userId: Int): BaseResponse<Boolean> =
postService.postAddMapPost(
AddMapRequestDto(postId = postId, userId = userId)
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ class PostRepositoryImpl @Inject constructor(
}

override suspend fun deletePinMap(postId: Int, userId: Int): Result<Boolean> =
Result.success(
true
)
runCatching {
postRemoteDataSource.deletePinMap(postId = postId, userId = userId).success
}
}
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ import com.spoony.spoony.data.dto.request.AddMapRequestDto
import com.spoony.spoony.data.dto.request.PostScoopRequestDto
import com.spoony.spoony.data.dto.response.GetPostResponseDto
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path
@@ -25,4 +26,10 @@ interface PostService {
suspend fun postScoopPost(
@Body postScoopRequestDto: PostScoopRequestDto
): BaseResponse<Boolean>

@DELETE("/api/v1/post/zzim/{userId}/{postId}")
suspend fun deletePinMap(
@Path("userId") userId: Int,
@Path("postId") postId: Int
): BaseResponse<Boolean>
}
Original file line number Diff line number Diff line change
@@ -95,10 +95,10 @@ class PlaceDetailViewModel @Inject constructor(
}
}

fun deletePinMap(userId: Int, postId: Int) {
fun deletePinMap(postId: Int, userId: Int) {
viewModelScope.launch {
postRepository.deletePinMap(userId = userId, postId = postId)
.onSuccess { response ->
postRepository.deletePinMap(postId = postId, userId = userId)
.onSuccess {
_sideEffect.emit(PlaceDetailSideEffect.ShowSnackbar("내 지도에서 삭제되었어요."))
_state.update {
it.copy(