Skip to content

Commit

Permalink
[feat/#23] 좌석 선택 dto, service 정의
Browse files Browse the repository at this point in the history
  • Loading branch information
imtaejugkim committed Nov 28, 2024
1 parent 1aa2020 commit cb7b9ae
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
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
)
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
)
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>
}

0 comments on commit cb7b9ae

Please sign in to comment.