forked from Yandex-Practicum/practicum-android-diploma
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from ElchinGasymov/careerhub_add_interactor
Интерактор для фильтров и di
- Loading branch information
Showing
3 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
app/src/main/java/ru/practicum/android/diploma/domain/FilterInteractor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package ru.practicum.android.diploma.domain | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
import ru.practicum.android.diploma.domain.models.Country | ||
import ru.practicum.android.diploma.domain.models.Industries | ||
import ru.practicum.android.diploma.domain.models.Region | ||
import ru.practicum.android.diploma.util.ResponseData | ||
|
||
interface FilterInteractor { | ||
suspend fun getCountries(): Flow<ResponseData<List<Country>>> | ||
suspend fun getRegions(id: String): Flow<ResponseData<List<Region>>> | ||
suspend fun getAllRegions(): Flow<ResponseData<List<Region>>> | ||
suspend fun getIndustries(): Flow<ResponseData<List<Industries>>> | ||
} |
27 changes: 27 additions & 0 deletions
27
app/src/main/java/ru/practicum/android/diploma/domain/impl/FilterInteractorImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package ru.practicum.android.diploma.domain.impl | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
import ru.practicum.android.diploma.domain.FilterInteractor | ||
import ru.practicum.android.diploma.domain.api.FilterRepository | ||
import ru.practicum.android.diploma.domain.models.Country | ||
import ru.practicum.android.diploma.domain.models.Industries | ||
import ru.practicum.android.diploma.domain.models.Region | ||
import ru.practicum.android.diploma.util.ResponseData | ||
|
||
class FilterInteractorImpl(private val repository: FilterRepository) : FilterInteractor { | ||
override suspend fun getCountries(): Flow<ResponseData<List<Country>>> { | ||
return repository.getCountries() | ||
} | ||
|
||
override suspend fun getRegions(id: String): Flow<ResponseData<List<Region>>> { | ||
return repository.getRegions(id) | ||
} | ||
|
||
override suspend fun getAllRegions(): Flow<ResponseData<List<Region>>> { | ||
return repository.getAllRegions() | ||
} | ||
|
||
override suspend fun getIndustries(): Flow<ResponseData<List<Industries>>> { | ||
return repository.getIndustries() | ||
} | ||
} |