I really like this repository, and it's architecture and project-structure. Currently, I am trying to implement "clean-achitecture" to one of my projects and stumbled upon one question: Where to put all the worker classes? For example, let's look at the following CoroutineWorker:
@HiltWorker
class DocumentListWorker @AssistedInject constructor(
@Assisted context: Context,
@Assisted params: WorkerParameters,
private val firebaseEntity: DocumentRepository,
private val documentDao: DocumentDao,
private val networkMapper: DocumentNetworkMapper,
) : CoroutineWorker(context, params) {
override suspend fun doWork(): Result {
Timber.d("Started DocumentWorker")
// Get Data from Cloud Firestore and map it to a DocumentCacheEntity to insert it to the database
val documentEntityList = firebaseEntity.getAllDocuments()
val documentCacheList = networkMapper.mapFromEntityList(documentEntityList)
documentDao.deleteAll()
documentDao.insert(documentCacheList)
return Result.success()
}
}
My question is: In which package would such a class fit the best? Here are my thoughts:
Not into presentation, because it has nothing to do with ui
Not into domain because it does not represent any sort of domain-data
Not into interactors
Somewhere into datasource, maybe into network as business -> datasource -> network -> worker OR
As another package inside datasource, so business -> datasource -> worker?
I really like this repository, and it's architecture and project-structure. Currently, I am trying to implement "clean-achitecture" to one of my projects and stumbled upon one question: Where to put all the worker classes? For example, let's look at the following CoroutineWorker:
My question is: In which package would such a class fit the best? Here are my thoughts:
I appreciate any answer, thank you very much