-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into feat/#128-add-map-api
# Conflicts: # app/src/main/java/com/spoony/spoony/data/datasourceimpl/PostRemoteDataSourceImpl.kt # app/src/main/java/com/spoony/spoony/data/service/PostService.kt # app/src/main/java/com/spoony/spoony/presentation/placeDetail/PlaceDetailViewModel.kt
- Loading branch information
Showing
24 changed files
with
334 additions
and
173 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/spoony/spoony/data/datasource/PlaceDataSource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.spoony.spoony.data.datasource | ||
|
||
import com.spoony.spoony.data.dto.base.BaseResponse | ||
import com.spoony.spoony.data.dto.response.PlaceCheckResponseDto | ||
import com.spoony.spoony.data.dto.response.SearchPlaceResponseDto | ||
|
||
interface PlaceDataSource { | ||
suspend fun getPlaces(query: String, display: Int): BaseResponse<SearchPlaceResponseDto> | ||
|
||
suspend fun checkDuplicatePlace( | ||
userId: Long, | ||
latitude: Double, | ||
longitude: Double | ||
): BaseResponse<PlaceCheckResponseDto> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
app/src/main/java/com/spoony/spoony/data/datasourceimpl/PlaceDataSourceImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.spoony.spoony.data.datasourceimpl | ||
|
||
import com.spoony.spoony.data.datasource.PlaceDataSource | ||
import com.spoony.spoony.data.dto.base.BaseResponse | ||
import com.spoony.spoony.data.dto.request.PlaceCheckRequestDto | ||
import com.spoony.spoony.data.dto.response.PlaceCheckResponseDto | ||
import com.spoony.spoony.data.dto.response.SearchPlaceResponseDto | ||
import com.spoony.spoony.data.service.PlaceService | ||
import javax.inject.Inject | ||
|
||
class PlaceDataSourceImpl @Inject constructor( | ||
private val placeService: PlaceService | ||
) : PlaceDataSource { | ||
override suspend fun getPlaces( | ||
query: String, | ||
display: Int | ||
): BaseResponse<SearchPlaceResponseDto> = | ||
placeService.getPlaces(query, display) | ||
|
||
override suspend fun checkDuplicatePlace( | ||
userId: Long, | ||
latitude: Double, | ||
longitude: Double | ||
): BaseResponse<PlaceCheckResponseDto> = | ||
placeService.postDuplicatePlace( | ||
PlaceCheckRequestDto( | ||
userId = userId, | ||
latitude = latitude, | ||
longitude = longitude | ||
) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/spoony/spoony/data/dto/request/PlaceCheckRequestDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.spoony.spoony.data.dto.request | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class PlaceCheckRequestDto( | ||
@SerialName("userId") | ||
val userId: Long, | ||
@SerialName("latitude") | ||
val latitude: Double, | ||
@SerialName("longitude") | ||
val longitude: Double | ||
) |
12 changes: 12 additions & 0 deletions
12
app/src/main/java/com/spoony/spoony/data/dto/request/PostScoopRequestDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.spoony.spoony.data.dto.request | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class PostScoopRequestDto( | ||
@SerialName("postId") | ||
val postId: Int, | ||
@SerialName("userId") | ||
val userId: Int | ||
) |
10 changes: 10 additions & 0 deletions
10
app/src/main/java/com/spoony/spoony/data/dto/response/PlaceCheckResponseDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.spoony.spoony.data.dto.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class PlaceCheckResponseDto( | ||
@SerialName("duplicate") | ||
val idDuplicated: Boolean | ||
) |
24 changes: 24 additions & 0 deletions
24
app/src/main/java/com/spoony/spoony/data/dto/response/PlaceResponseDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.spoony.spoony.data.dto.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class SearchPlaceResponseDto( | ||
@SerialName("placeList") | ||
val placeList: List<PlaceResponseDto> | ||
) | ||
|
||
@Serializable | ||
data class PlaceResponseDto( | ||
@SerialName("placeName") | ||
val placeName: String, | ||
@SerialName("placeAddress") | ||
val placeAddress: String, | ||
@SerialName("placeRoadAddress") | ||
val placeRoadAddress: String, | ||
@SerialName("latitude") | ||
val latitude: Double, | ||
@SerialName("longitude") | ||
val longitude: Double | ||
) |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/spoony/spoony/data/mapper/PlaceMapper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.spoony.spoony.data.mapper | ||
|
||
import com.spoony.spoony.data.dto.response.PlaceResponseDto | ||
import com.spoony.spoony.domain.entity.PlaceEntity | ||
|
||
fun PlaceResponseDto.toDomain(): PlaceEntity = | ||
PlaceEntity( | ||
placeName = placeName, | ||
placeAddress = placeAddress, | ||
placeRoadAddress = placeRoadAddress, | ||
latitude = latitude, | ||
longitude = longitude | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 34 additions & 65 deletions
99
app/src/main/java/com/spoony/spoony/data/repositoryimpl/RegisterRepositoryImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
app/src/main/java/com/spoony/spoony/data/service/PlaceService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.spoony.spoony.data.service | ||
|
||
import com.spoony.spoony.data.dto.base.BaseResponse | ||
import com.spoony.spoony.data.dto.request.PlaceCheckRequestDto | ||
import com.spoony.spoony.data.dto.response.PlaceCheckResponseDto | ||
import com.spoony.spoony.data.dto.response.SearchPlaceResponseDto | ||
import retrofit2.http.Body | ||
import retrofit2.http.GET | ||
import retrofit2.http.POST | ||
import retrofit2.http.Query | ||
|
||
interface PlaceService { | ||
@GET("api/v1/place/search") | ||
suspend fun getPlaces( | ||
@Query("query") query: String, | ||
@Query("display") display: Int = 5 | ||
): BaseResponse<SearchPlaceResponseDto> | ||
|
||
@POST("api/v1/place/check") | ||
suspend fun postDuplicatePlace( | ||
@Body request: PlaceCheckRequestDto | ||
): BaseResponse<PlaceCheckResponseDto> | ||
} |
Oops, something went wrong.