Skip to content

Commit

Permalink
Merge pull request #207 from LJG7123/feature-aos/현재-위치에서-다시-검색
Browse files Browse the repository at this point in the history
Feature(#40): 현재 위치에서 다시 검색
  • Loading branch information
wsb7788 authored Dec 3, 2023
2 parents 41571fd + 532cdae commit dd0e243
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down Expand Up @@ -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() }
)
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -52,4 +54,9 @@ interface SnapPointApi {
suspend fun postImage(
@Part bitmap: MultipartBody.Part
): PostImageResponse

@GET("posts")
suspend fun getAroundPost(
@Body getAroundPostRequest: GetAroundPostRequest
): List<GetAroundPostResponse>
}
Original file line number Diff line number Diff line change
@@ -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,
)
Original file line number Diff line number Diff line change
@@ -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<PostBlock>,
)
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -10,4 +11,5 @@ interface PostRepository {
fun getVideo(uri: String): Flow<ByteArray>
fun getVideoUri(video: ByteArray): Flow<Unit>
fun postCreatePost(title: String, postBlocks: List<PostBlockState>): Flow<CreatePostResponse>
fun getAroundPost(leftBottom: String, rightTop: String): Flow<List<GetAroundPostResponse>>
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -87,4 +88,8 @@ class PostRepositoryImpl @Inject constructor(
snapPointApi.createPost(request)
}
}

override fun getAroundPost(leftBottom: String, rightTop: String): Flow<List<GetAroundPostResponse>> {
TODO("Not yet implemented")
}
}

0 comments on commit dd0e243

Please sign in to comment.