Commit Graph

4 Commits

Author SHA1 Message Date
8ce553240c Test: Add unit tests for repository use cases
This commit introduces unit tests for the following use cases in the repository layer:
- `ObserveAirportsUseCaseImpl`
- `GetFlightsSearchContentUseCaseImpl`
- `GetConnectionsForAirportUseCaseImpl`

Key changes:
- Added `ObserveAirportsUseCaseImplTest.kt` with tests for observing airport data, including scenarios with valid data, empty data, null data, and cache refresh.
- Added `GetFlightsSearchContentUseCaseImplTest.kt` with tests for searching flights, covering valid responses and responses with null values.
- Added `GetConnectionsForAirportUseCaseImplTest.kt` with tests for fetching airport connections, including scenarios with valid responses, empty responses, responses with null airport codes/names, and multiple route responses.
- Added `kotlinx-coroutines-test` dependency to `model/repository/build.gradle.kts` for testing coroutines.
2025-06-16 00:55:12 +02:00
3e9768919d feat: Implement stations screen with grouped airports
This commit introduces a new "Stations" screen that displays airports grouped by country.

Key changes:
- Added a new Gradle module: `ui:stations`.
- Created `StationsScreen.kt` to display a list of airports grouped by country using `LazyColumn`. Airports within each country are displayed as `AirportInfoItem` and countries as `CountryItem`.
- Implemented `StationsScreenViewModel.kt` to fetch and manage the state of airports grouped by country. It uses `ObserveAirportsGroupedByCountry` use case.
- Defined `ObserveAirportsGroupedByCountry.kt` use case in `domain:stations` module to provide a flow of airports grouped by country.
- Implemented `ObserveAirportsGroupedByCountryImpl.kt` in the repository layer, which fetches data using `AirportService`, stores it in `AirportsDatasource`, and maps it to the domain model.
- Added Hilt module `ObserveAirportsGroupedByCountryModule.kt` to provide the use case implementation.
- Added `stationsScreen()` and `navigateToStations()` to `FlightsNavGraph.kt` and `TopLevelDestination.kt` for navigation.
- Updated `settings.gradle.kts` and `app/build.gradle.kts` to include the new `ui:stations` and `domain:stations` modules.
- Updated `CacheObservers.kt` to make `mapToDomain` a suspend function.
- Added string resources for the stations screen title.
2025-06-15 23:15:25 +02:00
fcc84dc728 feat: Implement airport data fetching and display
This commit introduces the functionality to fetch airport data from the Ryanair API and display it in the UI.

Key changes:
- Added `AirportInfoModel` interface and its implementation `AirportInfoModelImpl` to represent airport data in the data layer.
- Created `AirportInfoModelMapper` to map `AirportResponse` to `AirportInfoModel`.
- Set the base URL for Retrofit in `NetworkModule` to `https://services-api.ryanair.com`.
- Added new Gradle modules: `model:data:shared`, `model:datasource:airports`, `model:datasource:shared`, and `domain:search`.
- Implemented `CacheImpl` in `model:data:shared` for generic caching.
- Defined `ObserveAirportsUseCase` interface in `domain:search` to observe airport data.
- Added Detekt configuration for the `domain:search` and `model:datasource:shared` modules.
- Created `AirportsDatasource` interface and its implementation `AirportsDatasourceImpl` to manage airport data.
- Implemented `AirportInfoDomainMapper` to map `AirportInfoModel` to the domain `AirportInfo`.
- Updated `HomeScreen` to display a list of airports using `LazyColumn`.
- Updated `HomeScreenViewModel` to fetch and expose airport data via `ObserveAirportsUseCase`.
- Added `ObserveAirportsUseCaseModule` to provide the `ObserveAirportsUseCase` implementation.
- Implemented `ObserveAirportsUseCaseImpl` in the repository layer to fetch data from the API and update the datasource.
- Added `kotlinx-datetime` dependency.
- Created `AirportsDatasourceModule` to provide `AirportsDatasource` and its implementation.
- Added `CacheObservers.kt` with a utility function `loadData` to handle cache observation and data loading logic.
- Updated dependencies in `model:data:simple`, `model:repository`, and `ui:home` build files.
- Updated `settings.gradle.kts` to include new modules.
- Defined `Cache` interface in `model:datasource:shared`.
2025-06-13 21:45:55 +02:00
714cdb6795 Initial commit 2025-06-12 23:20:21 +02:00