-
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.
- Loading branch information
1 parent
1aa2020
commit cb7b9ae
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/sopt/korailtalk/data/remote/model/request/SeatSelectingRequestDto.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.sopt.korailtalk.data.remote.model.request | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class SeatSelectingRequestDto( | ||
@SerialName("isAuto") val isAuto: Boolean, | ||
@SerialName("timetableId") val timetableId: Long, | ||
@SerialName("coachId") val coachId: Long, | ||
@SerialName("seatId") val seatId: Long?, | ||
@SerialName("price") val price: Int | ||
) |
24 changes: 24 additions & 0 deletions
24
app/src/main/java/com/sopt/korailtalk/data/remote/model/response/SeatsResponseDto.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.sopt.korailtalk.data.remote.model.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class SeatsResponseDto( | ||
@SerialName("coaches") val coaches: ArrayList<SeatMapData> | ||
) | ||
|
||
@Serializable | ||
data class SeatMapData ( | ||
@SerialName("coachId") val coachId: Long, | ||
@SerialName("leftSeats") val leftSeats: Int, | ||
@SerialName("seats") val seats: ArrayList<SeatData> | ||
) | ||
|
||
@Serializable | ||
data class SeatData( | ||
@SerialName("seatId") val seatId : Long, | ||
@SerialName("seatName") val seatName: String, | ||
@SerialName("direction") val direction : Boolean, | ||
@SerialName("isSold") val isSold: Boolean | ||
) |
22 changes: 22 additions & 0 deletions
22
app/src/main/java/com/sopt/korailtalk/data/remote/service/SeatsService.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.sopt.korailtalk.data.remote.service | ||
|
||
import com.sopt.korailtalk.data.remote.model.base.ApiResponse | ||
import com.sopt.korailtalk.data.remote.model.request.SeatSelectingRequestDto | ||
import com.sopt.korailtalk.data.remote.model.response.SeatsResponseDto | ||
import retrofit2.http.Body | ||
import retrofit2.http.GET | ||
import retrofit2.http.PATCH | ||
import retrofit2.http.Path | ||
|
||
interface SeatsService { | ||
@GET("/coaches/{timetableId}") | ||
suspend fun getSeats( | ||
@Body userId: Long, | ||
@Path("timetableId") timetableId: Long | ||
): ApiResponse<SeatsResponseDto> | ||
|
||
@PATCH("/seats") | ||
suspend fun selectSeat( | ||
@Body seatSelectingRequestDto: SeatSelectingRequestDto | ||
): ApiResponse<Unit> | ||
} |