Move Category model and repository to domain and data layer (#8967)

To keep the commit from being 100+ files the interactors wasn't moved.

The domain module like the data module uses `tachiyomi` instead of `eu.kanade.tachiyomi` for package names
This commit is contained in:
Andreas
2023-01-22 16:12:29 +01:00
committed by GitHub
parent c2812fca24
commit d3a73fc228
47 changed files with 108 additions and 65 deletions

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View File

@@ -0,0 +1,17 @@
package tachiyomi.domain.category.model
import java.io.Serializable
data class Category(
val id: Long,
val name: String,
val order: Long,
val flags: Long,
) : Serializable {
val isSystemCategory: Boolean = id == UNCATEGORIZED_ID
companion object {
const val UNCATEGORIZED_ID = 0L
}
}

View File

@@ -0,0 +1,8 @@
package tachiyomi.domain.category.model
data class CategoryUpdate(
val id: Long,
val name: String? = null,
val order: Long? = null,
val flags: Long? = null,
)

View File

@@ -0,0 +1,28 @@
package tachiyomi.domain.category.repository
import kotlinx.coroutines.flow.Flow
import tachiyomi.domain.category.model.Category
import tachiyomi.domain.category.model.CategoryUpdate
interface CategoryRepository {
suspend fun get(id: Long): Category?
suspend fun getAll(): List<Category>
fun getAllAsFlow(): Flow<List<Category>>
suspend fun getCategoriesByMangaId(mangaId: Long): List<Category>
fun getCategoriesByMangaIdAsFlow(mangaId: Long): Flow<List<Category>>
suspend fun insert(category: Category)
suspend fun updatePartial(update: CategoryUpdate)
suspend fun updatePartial(updates: List<CategoryUpdate>)
suspend fun updateAllFlags(flags: Long?)
suspend fun delete(categoryId: Long)
}