-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEAT/#77] μ΄λ μ½λ κ²μ¦ API
- Loading branch information
Showing
25 changed files
with
275 additions
and
35 deletions.
There are no files selected for viewing
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
12 changes: 12 additions & 0 deletions
12
data/src/main/java/com/going/data/datasource/EnterTripDataSource.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.going.data.datasource; | ||
|
||
import com.going.data.dto.BaseResponse | ||
import com.going.data.dto.request.EnterTripRequestDto | ||
import com.going.data.dto.response.EnterTripResponseDto | ||
import retrofit2.http.Body | ||
|
||
interface EnterTripDataSource { | ||
suspend fun postEnterTrip( | ||
@Body request: EnterTripRequestDto, | ||
): BaseResponse<EnterTripResponseDto> | ||
} |
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
17 changes: 17 additions & 0 deletions
17
data/src/main/java/com/going/data/datasourceImpl/EnterTripDataSourceImpl.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,17 @@ | ||
package com.going.data.datasourceImpl | ||
|
||
import com.going.data.datasource.EnterTripDataSource | ||
import com.going.data.dto.BaseResponse | ||
import com.going.data.dto.request.EnterTripRequestDto | ||
import com.going.data.dto.response.EnterTripResponseDto | ||
import com.going.data.service.EnterTripService | ||
import javax.inject.Inject | ||
|
||
class EnterTripDataSourceImpl @Inject constructor( | ||
private val enterTripService: EnterTripService, | ||
) : EnterTripDataSource { | ||
override suspend fun postEnterTrip( | ||
code: EnterTripRequestDto | ||
): BaseResponse<EnterTripResponseDto> = | ||
enterTripService.postEnterTrip(code) | ||
} |
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
15 changes: 15 additions & 0 deletions
15
data/src/main/java/com/going/data/dto/request/EnterTripRequestDto.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.going.data.dto.request | ||
|
||
import com.going.domain.entity.request.EnterTripRequestModel | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class EnterTripRequestDto( | ||
@SerialName("code") | ||
val code: String, | ||
) | ||
|
||
fun EnterTripRequestModel.toEnterTripRequestDto(): EnterTripRequestDto = | ||
EnterTripRequestDto(code) | ||
|
22 changes: 22 additions & 0 deletions
22
data/src/main/java/com/going/data/dto/response/EnterTripResponseDto.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,22 @@ | ||
package com.going.data.dto.response | ||
|
||
import com.going.domain.entity.response.EnterTripModel | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class EnterTripResponseDto( | ||
@SerialName("tripId") | ||
val tripId: Long, | ||
@SerialName("title") | ||
val title: String, | ||
@SerialName("startDate") | ||
val startDate: String, | ||
@SerialName("endDate") | ||
val endDate: String, | ||
@SerialName("day") | ||
val day: Int, | ||
) { | ||
fun toEnterTripModel() = | ||
EnterTripModel(tripId, title, startDate, endDate, day) | ||
} |
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
22 changes: 22 additions & 0 deletions
22
data/src/main/java/com/going/data/repositoryImpl/EnterTripRepositoryImpl.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,22 @@ | ||
package com.going.data.repositoryImpl | ||
|
||
import com.going.data.datasource.EnterTripDataSource | ||
import com.going.data.dto.request.toEnterTripRequestDto | ||
import com.going.domain.entity.request.EnterTripRequestModel | ||
import com.going.domain.entity.response.EnterTripModel | ||
import com.going.domain.repository.EnterTripRepository | ||
import javax.inject.Inject | ||
|
||
class EnterTripRepositoryImpl @Inject constructor( | ||
private val enterTripDataSource: EnterTripDataSource, | ||
) : EnterTripRepository { | ||
|
||
override suspend fun postEnterTrip( | ||
requestEnterTripModel: EnterTripRequestModel | ||
): Result<EnterTripModel> = | ||
runCatching { | ||
enterTripDataSource.postEnterTrip( | ||
requestEnterTripModel.toEnterTripRequestDto(), | ||
).data.toEnterTripModel() | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
data/src/main/java/com/going/data/service/EnterTripService.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.going.data.service | ||
|
||
import com.going.data.dto.BaseResponse | ||
import com.going.data.dto.request.EnterTripRequestDto | ||
import com.going.data.dto.response.EnterTripResponseDto | ||
import retrofit2.http.Body | ||
import retrofit2.http.POST | ||
|
||
interface EnterTripService { | ||
@POST("/api/trips/verify") | ||
suspend fun postEnterTrip( | ||
@Body request: EnterTripRequestDto, | ||
): BaseResponse<EnterTripResponseDto> | ||
} |
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
5 changes: 5 additions & 0 deletions
5
domain/src/main/kotlin/com/going/domain/entity/request/EnterTripRequestModel.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,5 @@ | ||
package com.going.domain.entity.request | ||
|
||
data class EnterTripRequestModel( | ||
val code: String | ||
) |
9 changes: 9 additions & 0 deletions
9
domain/src/main/kotlin/com/going/domain/entity/response/EnterTripModel.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,9 @@ | ||
package com.going.domain.entity.response | ||
|
||
data class EnterTripModel( | ||
val tripId: Long, | ||
val title: String, | ||
val startDate: String, | ||
val endDate: String, | ||
val day: Int | ||
) |
10 changes: 10 additions & 0 deletions
10
domain/src/main/kotlin/com/going/domain/repository/EnterTripRepository.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.going.domain.repository | ||
|
||
import com.going.domain.entity.request.EnterTripRequestModel | ||
import com.going.domain.entity.response.EnterTripModel | ||
|
||
interface EnterTripRepository { | ||
suspend fun postEnterTrip( | ||
requestEnterTripModel: EnterTripRequestModel | ||
): Result<EnterTripModel> | ||
} |
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
Oops, something went wrong.