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:
2025-06-14 15:42:07 +02:00
parent 5d9a56d71f
commit ffcfc1f45b
8 changed files with 193 additions and 6 deletions

View File

@ -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
}

View File

@ -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,
)