mirror of
https://github.com/AdrianKuta/android-challange-adrian-kuta.git
synced 2025-10-31 00:13:39 +01:00
feat: Implement flight search functionality
This commit introduces the ability to search for flights based on user-defined criteria.
Key changes:
- Added `GetFlightsSearchContentUseCase` interface in the domain layer and its implementation `GetFlightsSearchContentUseCaseImpl` in the repository layer to handle flight search logic.
- Implemented `FlightDomainMapper` to map `FlightResponse` from the API to the domain `Flight` model.
- Updated `NetworkModule`:
- Introduced `ServicesAPI` and `NativeAppsAPI` qualifiers to differentiate between Retrofit instances for different Ryanair APIs.
- Configured a new Retrofit instance for the `nativeapps.ryanair.com` base URL.
- Modified `FlightService` to use the `nativeapps.ryanair.com` base URL.
- Updated `FlightService` endpoint to `api/v4/en-gb/Availability`.
- Integrated `GetFlightsSearchContentUseCase` into `HomeScreenViewModel` to trigger flight searches.
- Created `SearchOptions` data class in the domain layer to encapsulate search parameters.
- Added `GetFlightsSearchContentUseCaseModule` to provide the use case implementation via Hilt.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package dev.adriankuta.flights.domain.search
|
||||
|
||||
import dev.adriankuta.flights.domain.search.entities.SearchOptions
|
||||
import dev.adriankuta.flights.domain.types.Flight
|
||||
|
||||
fun interface GetFlightsSearchContentUseCase {
|
||||
suspend operator fun invoke(searchOptions: SearchOptions): Flight
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package dev.adriankuta.flights.domain.search.entities
|
||||
|
||||
import dev.adriankuta.flights.domain.types.Airport
|
||||
import java.time.LocalDate
|
||||
|
||||
data class SearchOptions(
|
||||
val origin: Airport.Departure,
|
||||
val destination: Airport.Arrival,
|
||||
val date: LocalDate,
|
||||
val adults: Int,
|
||||
val teens: Int,
|
||||
val children: Int,
|
||||
)
|
||||
Reference in New Issue
Block a user