mirror of
https://github.com/AdrianKuta/android-challange-adrian-kuta.git
synced 2025-10-31 00:13:39 +01:00
feat: Implement airport connection fetching and filtering
This commit introduces the functionality to fetch available flight connections for a selected origin airport and filter the destination airport list accordingly.
Key changes:
- Added `GetConnectionsForAirportUseCase` interface in `domain/stations` to define the contract for fetching airport connections.
- Implemented `GetConnectionsForAirportUseCaseImpl` in `model/repository` to fetch routes from the `RoutesService` and map them to domain `Airport` types.
- Created `AirportDomainMapper.kt` in `model/repository/mappers` to map `RouteResponse` and its nested types to domain `Airport` and `MacCity` types.
- Added a Hilt module `GetConnectionsForAirportUseCaseModule` to provide the implementation for `GetConnectionsForAirportUseCase`.
- Renamed `OriginAirportsUiState` to `AirportsUiState` in `StationsScreen.kt` and `StationsScreenViewModel.kt` for better generality.
- Updated `StationsScreenViewModel`:
- Injected `GetConnectionsForAirportUseCase`.
- Added `_availableDestinationsCodes` StateFlow to hold the codes of airports reachable from the selected origin.
- Modified `airportsUiState` (previously `originAirportsUiState`) to take `filterDestinations` as a parameter and filter airports based on both search query and available destination codes.
- Added `AirportInfo.toDepartureAirPort()` extension function.
- Updated `StationsScreen.kt` to use the renamed `AirportsUiState`.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package dev.adriankuta.flights.domain.stations
|
||||
|
||||
import dev.adriankuta.flights.domain.types.Airport
|
||||
|
||||
fun interface GetConnectionsForAirportUseCase {
|
||||
|
||||
suspend operator fun invoke(airport: Airport): Set<Airport>
|
||||
}
|
||||
Reference in New Issue
Block a user