mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 06:17:57 +01:00 
			
		
		
		
	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:
		
							
								
								
									
										2
									
								
								domain/src/main/AndroidManifest.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								domain/src/main/AndroidManifest.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <manifest /> | ||||
| @@ -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 | ||||
|     } | ||||
| } | ||||
| @@ -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, | ||||
| ) | ||||
| @@ -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) | ||||
| } | ||||
		Reference in New Issue
	
	Block a user