From 82fa7ca819bc8011dbaac4fe5a1f1a4967b406b2 Mon Sep 17 00:00:00 2001 From: LJG7123 Date: Thu, 30 Nov 2023 23:40:46 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[FEAT]=20=EC=A3=BC=EB=B3=80=20=EA=B2=8C?= =?UTF-8?q?=EC=8B=9C=EA=B8=80=20API=20=EC=9A=94=EC=B2=AD=EC=9D=84=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C=20data=20class=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../remote/model/request/GetAroundPostRequest.kt | 10 ++++++++++ .../data/remote/model/response/GetPostResponse.kt | 14 ++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 android/app/src/main/java/com/boostcampwm2023/snappoint/data/remote/model/request/GetAroundPostRequest.kt create mode 100644 android/app/src/main/java/com/boostcampwm2023/snappoint/data/remote/model/response/GetPostResponse.kt diff --git a/android/app/src/main/java/com/boostcampwm2023/snappoint/data/remote/model/request/GetAroundPostRequest.kt b/android/app/src/main/java/com/boostcampwm2023/snappoint/data/remote/model/request/GetAroundPostRequest.kt new file mode 100644 index 00000000..062f76e4 --- /dev/null +++ b/android/app/src/main/java/com/boostcampwm2023/snappoint/data/remote/model/request/GetAroundPostRequest.kt @@ -0,0 +1,10 @@ +package com.boostcampwm2023.snappoint.data.remote.model.request + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class GetAroundPostRequest( + @SerialName("lb") val leftBottom: String, + @SerialName("rt") val rightTop: String, +) 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/GetPostResponse.kt new file mode 100644 index 00000000..d24b6311 --- /dev/null +++ b/android/app/src/main/java/com/boostcampwm2023/snappoint/data/remote/model/response/GetPostResponse.kt @@ -0,0 +1,14 @@ +package com.boostcampwm2023.snappoint.data.remote.model.response + +import com.boostcampwm2023.snappoint.data.remote.model.PostBlock +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class GetAroundPostResponse( + @SerialName("uuid") val postUuid: String, + @SerialName("title") val title: String, + @SerialName("createdAt") val createdAt: String, + @SerialName("modifiedAt") val modifiedAt: String, + @SerialName("blocks") val blocks: List, +) \ No newline at end of file From 532cdae494aa213e1295233e32f68bec23f68255 Mon Sep 17 00:00:00 2001 From: LJG7123 Date: Fri, 1 Dec 2023 00:51:23 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[FEAT]=20=EC=A3=BC=EB=B3=80=20=EA=B2=8C?= =?UTF-8?q?=EC=8B=9C=EA=B8=80=EC=9D=84=20=EB=B0=9B=EC=95=84=EC=98=A4?= =?UTF-8?q?=EB=8A=94=20API=20=EC=9A=94=EC=B2=AD=EC=9D=84=20=EC=9C=84?= =?UTF-8?q?=ED=95=9C=20=EB=B0=91=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../snappoint/data/mapper/PostMapper.kt | 11 +++++++++++ .../snappoint/data/remote/SnapPointApi.kt | 7 +++++++ .../{GetPostResponse.kt => GetAroundPostResponse.kt} | 0 .../snappoint/data/repository/PostRepository.kt | 2 ++ .../snappoint/data/repository/PostRepositoryImpl.kt | 5 +++++ 5 files changed, 25 insertions(+) rename android/app/src/main/java/com/boostcampwm2023/snappoint/data/remote/model/response/{GetPostResponse.kt => GetAroundPostResponse.kt} (100%) 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