diff --git a/android/app/src/main/java/com/boostcampwm2023/snappoint/data/mapper/PostMapper.kt b/android/app/src/main/java/com/boostcampwm2023/snappoint/data/mapper/PostMapper.kt index 0484310a..3ae2f2f9 100644 --- a/android/app/src/main/java/com/boostcampwm2023/snappoint/data/mapper/PostMapper.kt +++ b/android/app/src/main/java/com/boostcampwm2023/snappoint/data/mapper/PostMapper.kt @@ -3,8 +3,10 @@ package com.boostcampwm2023.snappoint.data.mapper import com.boostcampwm2023.snappoint.data.remote.model.BlockType import com.boostcampwm2023.snappoint.data.remote.model.File import com.boostcampwm2023.snappoint.data.remote.model.PostBlock +import com.boostcampwm2023.snappoint.data.remote.model.response.GetAroundPostResponse import com.boostcampwm2023.snappoint.presentation.model.PositionState import com.boostcampwm2023.snappoint.presentation.model.PostBlockState +import com.boostcampwm2023.snappoint.presentation.model.PostSummaryState fun PostBlock.asPostBlockState(): PostBlockState { return when(type){ @@ -71,3 +73,12 @@ fun PostBlock.asPositionState(): PositionState { longitude = this.longitude!! ) } + +fun GetAroundPostResponse.asPostSummaryState(): PostSummaryState { + return PostSummaryState( + title = this.title, + author = "", + timeStamp = this.createdAt, + postBlocks = this.blocks.map { it.asPostBlockState() } + ) +} \ No newline at end of file diff --git a/android/app/src/main/java/com/boostcampwm2023/snappoint/data/remote/SnapPointApi.kt b/android/app/src/main/java/com/boostcampwm2023/snappoint/data/remote/SnapPointApi.kt index 0348ee85..43a94392 100644 --- a/android/app/src/main/java/com/boostcampwm2023/snappoint/data/remote/SnapPointApi.kt +++ b/android/app/src/main/java/com/boostcampwm2023/snappoint/data/remote/SnapPointApi.kt @@ -1,9 +1,11 @@ package com.boostcampwm2023.snappoint.data.remote import com.boostcampwm2023.snappoint.data.remote.model.request.CreatePostRequest +import com.boostcampwm2023.snappoint.data.remote.model.request.GetAroundPostRequest import com.boostcampwm2023.snappoint.data.remote.model.request.SignInRequest import com.boostcampwm2023.snappoint.data.remote.model.request.SignupRequest import com.boostcampwm2023.snappoint.data.remote.model.response.CreatePostResponse +import com.boostcampwm2023.snappoint.data.remote.model.response.GetAroundPostResponse import com.boostcampwm2023.snappoint.data.remote.model.response.ImageResponse import com.boostcampwm2023.snappoint.data.remote.model.response.ImageUriResponse import com.boostcampwm2023.snappoint.data.remote.model.response.PostImageResponse @@ -52,4 +54,9 @@ interface SnapPointApi { suspend fun postImage( @Part bitmap: MultipartBody.Part ): PostImageResponse + + @GET("posts") + suspend fun getAroundPost( + @Body getAroundPostRequest: GetAroundPostRequest + ): List } \ No newline at end of file diff --git a/android/app/src/main/java/com/boostcampwm2023/snappoint/data/remote/model/response/GetPostResponse.kt b/android/app/src/main/java/com/boostcampwm2023/snappoint/data/remote/model/response/GetAroundPostResponse.kt similarity index 100% rename from android/app/src/main/java/com/boostcampwm2023/snappoint/data/remote/model/response/GetPostResponse.kt rename to android/app/src/main/java/com/boostcampwm2023/snappoint/data/remote/model/response/GetAroundPostResponse.kt diff --git a/android/app/src/main/java/com/boostcampwm2023/snappoint/data/repository/PostRepository.kt b/android/app/src/main/java/com/boostcampwm2023/snappoint/data/repository/PostRepository.kt index 989f00cc..5d56747e 100644 --- a/android/app/src/main/java/com/boostcampwm2023/snappoint/data/repository/PostRepository.kt +++ b/android/app/src/main/java/com/boostcampwm2023/snappoint/data/repository/PostRepository.kt @@ -1,6 +1,7 @@ package com.boostcampwm2023.snappoint.data.repository import com.boostcampwm2023.snappoint.data.remote.model.response.CreatePostResponse +import com.boostcampwm2023.snappoint.data.remote.model.response.GetAroundPostResponse import com.boostcampwm2023.snappoint.presentation.model.PostBlockState import kotlinx.coroutines.flow.Flow @@ -10,4 +11,5 @@ interface PostRepository { fun getVideo(uri: String): Flow fun getVideoUri(video: ByteArray): Flow fun postCreatePost(title: String, postBlocks: List): Flow + fun getAroundPost(leftBottom: String, rightTop: String): Flow> } \ No newline at end of file diff --git a/android/app/src/main/java/com/boostcampwm2023/snappoint/data/repository/PostRepositoryImpl.kt b/android/app/src/main/java/com/boostcampwm2023/snappoint/data/repository/PostRepositoryImpl.kt index cf48fd8a..08e5d221 100644 --- a/android/app/src/main/java/com/boostcampwm2023/snappoint/data/repository/PostRepositoryImpl.kt +++ b/android/app/src/main/java/com/boostcampwm2023/snappoint/data/repository/PostRepositoryImpl.kt @@ -6,6 +6,7 @@ import com.boostcampwm2023.snappoint.data.remote.SnapPointApi import com.boostcampwm2023.snappoint.data.remote.model.File import com.boostcampwm2023.snappoint.data.remote.model.request.CreatePostRequest import com.boostcampwm2023.snappoint.data.remote.model.response.CreatePostResponse +import com.boostcampwm2023.snappoint.data.remote.model.response.GetAroundPostResponse import com.boostcampwm2023.snappoint.presentation.model.PostBlockState import com.boostcampwm2023.snappoint.presentation.util.toByteArray import kotlinx.coroutines.Dispatchers @@ -87,4 +88,8 @@ class PostRepositoryImpl @Inject constructor( snapPointApi.createPost(request) } } + + override fun getAroundPost(leftBottom: String, rightTop: String): Flow> { + TODO("Not yet implemented") + } } \ No newline at end of file