Skip to content

Commit 307d7df

Browse files
committed
refactor: 외선, 내선, 상행, 하행 분리
1 parent b6b9304 commit 307d7df

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

data/src/main/java/com/stop/data/remote/source/route/RouteRemoteDataSourceImpl.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,11 @@ internal class RouteRemoteDataSourceImpl @Inject constructor(
108108
serviceName = "SearchLastTrainTimeByIDService",
109109
stationId = stationId,
110110
weekTag = weekType.divisionValue,
111-
inOutTag = transportDirectionType.divisionValue,
111+
inOutTag = when (transportDirectionType) {
112+
TransportDirectionType.INNER, TransportDirectionType.TO_END -> "1"
113+
TransportDirectionType.OUTER, TransportDirectionType.TO_FIRST -> "2"
114+
TransportDirectionType.UNKNOWN -> throw IllegalArgumentException()
115+
},
112116
)
113117
) {
114118
return when (this) {
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package com.stop.domain.model.route.seoul.subway
22

3-
enum class TransportDirectionType(val divisionValue: String) {
4-
INNER("1"), // 내선, 상행, 기점 출발
5-
OUTER("2"), // 외선, 하행, 종점 출발
6-
UNKNOWN("-1") // 계산하지 않은 경우
3+
enum class TransportDirectionType {
4+
INNER, // 내선
5+
TO_FIRST, // 하행, 종점 출발
6+
OUTER, // 외선
7+
TO_END, // 상행, 기점 출발
8+
UNKNOWN // 계산하지 않은 경우
79
}

domain/src/main/java/com/stop/domain/usecase/nowlocation/GetSubwayTrainNowStationUseCaseImpl.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ class GetSubwayTrainNowStationUseCaseImpl @Inject constructor(
3535
}
3636

3737
return when (transportLastTime.transportDirectionType) {
38-
TransportDirectionType.OUTER -> possibleTrains.first()
39-
TransportDirectionType.INNER -> possibleTrains.last()
38+
TransportDirectionType.OUTER, TransportDirectionType.TO_FIRST -> possibleTrains.first()
39+
TransportDirectionType.INNER, TransportDirectionType.TO_END -> possibleTrains.last()
4040
TransportDirectionType.UNKNOWN -> throw ApiChangedException()
4141
}
4242
}

domain/src/main/java/com/stop/domain/usecase/route/GetLastTransportTimeUseCaseImpl.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,9 @@ internal class GetLastTransportTimeUseCaseImpl @Inject constructor(
273273
}
274274
} else {
275275
if (startStationIndex < endStationIndex) {
276-
TransportDirectionType.OUTER
276+
TransportDirectionType.TO_FIRST
277277
} else {
278-
TransportDirectionType.INNER
278+
TransportDirectionType.TO_END
279279
}
280280
}
281281
}
@@ -341,7 +341,7 @@ internal class GetLastTransportTimeUseCaseImpl @Inject constructor(
341341
destinationStationName = transportIdRequest.destinationStation.name,
342342
stationsUntilStart = listOf(),
343343
enableDestinationStation = listOf(),
344-
transportDirectionType = TransportDirectionType.UNKNOWN,
344+
transportDirectionType = TransportDirectionType.UNKNOWN, // TODO: 서울 버스의 상행, 하행 구현
345345
)
346346
}
347347

@@ -503,9 +503,9 @@ internal class GetLastTransportTimeUseCaseImpl @Inject constructor(
503503
}
504504

505505
if (startIndex < endIndex) {
506-
return Pair(TransportDirectionType.INNER, startIndex)
506+
return Pair(TransportDirectionType.TO_END, startIndex)
507507
}
508-
return Pair(TransportDirectionType.OUTER, startIndex)
508+
return Pair(TransportDirectionType.TO_FIRST, startIndex)
509509
}
510510

511511
private suspend fun convertSeoulBusRouteId(

0 commit comments

Comments
 (0)