Skip to content

Commit

Permalink
Перенес все в один интерактор
Browse files Browse the repository at this point in the history
  • Loading branch information
ElchinGasymov committed Aug 18, 2024
1 parent aaa4605 commit 9084c72
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 110 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
package ru.practicum.android.diploma.di

import org.koin.dsl.module
import ru.practicum.android.diploma.domain.AllRegionInteractor
import ru.practicum.android.diploma.domain.CountryInteractor
import ru.practicum.android.diploma.domain.DetailsInteractor
import ru.practicum.android.diploma.domain.FavouriteVacanciesInteractor
import ru.practicum.android.diploma.domain.IndustryInteractor
import ru.practicum.android.diploma.domain.RegionInteractor
import ru.practicum.android.diploma.domain.FilterInteractor
import ru.practicum.android.diploma.domain.SearchInteractor
import ru.practicum.android.diploma.domain.impl.AllRegionInteractorImpl
import ru.practicum.android.diploma.domain.impl.CountryInteractorImpl
import ru.practicum.android.diploma.domain.impl.DetailsInteractorImpl
import ru.practicum.android.diploma.domain.impl.FavouriteVacanciesInteractorImpl
import ru.practicum.android.diploma.domain.impl.IndustryInteractorImpl
import ru.practicum.android.diploma.domain.impl.RegionInteractorImpl
import ru.practicum.android.diploma.domain.impl.FilterInteractorImpl
import ru.practicum.android.diploma.domain.impl.SearchInteractorImpl

val interactorModule = module {
Expand All @@ -29,19 +23,7 @@ val interactorModule = module {
DetailsInteractorImpl(repository = get())
}

factory<CountryInteractor> {
CountryInteractorImpl(repository = get())
}

factory<RegionInteractor> {
RegionInteractorImpl(repository = get())
}

factory<AllRegionInteractor> {
AllRegionInteractorImpl(repository = get())
}

factory<IndustryInteractor> {
IndustryInteractorImpl(repository = get())
factory<FilterInteractor> {
FilterInteractorImpl(repository = get())
}
}

This file was deleted.

This file was deleted.

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

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

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()
}
}

This file was deleted.

This file was deleted.

0 comments on commit 9084c72

Please sign in to comment.