Move more repositories to domain module

This commit is contained in:
Jobobby04
2023-02-09 15:10:37 -05:00
parent ab0995ab9f
commit dd62337ad6
71 changed files with 110 additions and 110 deletions
@@ -0,0 +1,17 @@
package tachiyomi.domain.manga.model
import exh.metadata.metadata.EHentaiSearchMetadata
data class FavoriteEntry(
val id: Long? = null,
val title: String,
val gid: String,
val token: String,
val category: Int = -1,
) {
fun getUrl() = EHentaiSearchMetadata.idAndTokenToUrl(gid, token)
}
@@ -0,0 +1,10 @@
package tachiyomi.domain.manga.model
data class MergeMangaSettingsUpdate(
val id: Long,
var isInfoManga: Boolean?,
var getChapterUpdates: Boolean?,
var chapterPriority: Int?,
var downloadChapters: Boolean?,
var chapterSortMode: Int?,
)
@@ -0,0 +1,44 @@
package tachiyomi.domain.manga.model
data class MergedMangaReference(
// Tag identifier, unique
val id: Long,
// The manga where it grabs the updated manga info
val isInfoManga: Boolean,
// If false the manga will not grab chapter updates
val getChapterUpdates: Boolean,
// The mode in which the chapters are handeled, only set in the main merge reference
val chapterSortMode: Int,
// chapter priority the deduplication uses
val chapterPriority: Int,
// Set if you want it to download new chapters
val downloadChapters: Boolean,
// merged manga this reference is attached to
val mergeId: Long?,
// merged manga url this reference is attached to
val mergeUrl: String,
// manga id included in the merge this reference is attached to
val mangaId: Long?,
// manga url included in the merge this reference is attached to
val mangaUrl: String,
// source of the manga that is merged into this merge
val mangaSourceId: Long,
) {
companion object {
const val CHAPTER_SORT_NONE = 0
const val CHAPTER_SORT_NO_DEDUPE = 1
const val CHAPTER_SORT_PRIORITY = 2
const val CHAPTER_SORT_MOST_CHAPTERS = 3
const val CHAPTER_SORT_HIGHEST_CHAPTER_NUMBER = 4
}
}
@@ -0,0 +1,11 @@
package tachiyomi.domain.manga.repository
import tachiyomi.domain.manga.model.FavoriteEntry
interface FavoritesEntryRepository {
suspend fun deleteAll()
suspend fun insertAll(favoriteEntries: List<FavoriteEntry>)
suspend fun selectAll(): List<FavoriteEntry>
}
@@ -0,0 +1,34 @@
package tachiyomi.domain.manga.repository
import kotlinx.coroutines.flow.Flow
import tachiyomi.domain.manga.model.Manga
import tachiyomi.domain.manga.model.MergeMangaSettingsUpdate
import tachiyomi.domain.manga.model.MergedMangaReference
interface MangaMergeRepository {
suspend fun getMergedManga(): List<Manga>
suspend fun subscribeMergedManga(): Flow<List<Manga>>
suspend fun getMergedMangaById(id: Long): List<Manga>
suspend fun subscribeMergedMangaById(id: Long): Flow<List<Manga>>
suspend fun getReferencesById(id: Long): List<MergedMangaReference>
suspend fun subscribeReferencesById(id: Long): Flow<List<MergedMangaReference>>
suspend fun updateSettings(update: MergeMangaSettingsUpdate): Boolean
suspend fun updateAllSettings(values: List<MergeMangaSettingsUpdate>): Boolean
suspend fun insert(reference: MergedMangaReference): Long?
suspend fun insertAll(references: List<MergedMangaReference>)
suspend fun deleteById(id: Long)
suspend fun deleteByMergeId(mergeId: Long)
suspend fun getMergeMangaForDownloading(mergeId: Long): List<Manga>
}
@@ -0,0 +1,33 @@
package tachiyomi.domain.manga.repository
import exh.metadata.metadata.base.FlatMetadata
import exh.metadata.metadata.base.RaisedSearchMetadata
import exh.metadata.sql.models.SearchMetadata
import exh.metadata.sql.models.SearchTag
import exh.metadata.sql.models.SearchTitle
import kotlinx.coroutines.flow.Flow
import tachiyomi.domain.manga.model.Manga
interface MangaMetadataRepository {
suspend fun getMetadataById(id: Long): SearchMetadata?
fun subscribeMetadataById(id: Long): Flow<SearchMetadata?>
suspend fun getTagsById(id: Long): List<SearchTag>
fun subscribeTagsById(id: Long): Flow<List<SearchTag>>
suspend fun getTitlesById(id: Long): List<SearchTitle>
fun subscribeTitlesById(id: Long): Flow<List<SearchTitle>>
suspend fun insertFlatMetadata(flatMetadata: FlatMetadata)
suspend fun insertMetadata(metadata: RaisedSearchMetadata) = insertFlatMetadata(metadata.flatten())
suspend fun getExhFavoriteMangaWithMetadata(): List<Manga>
suspend fun getIdsOfFavoriteMangaWithMetadata(): List<Long>
suspend fun getSearchMetadata(): List<SearchMetadata>
}
@@ -0,0 +1,10 @@
package tachiyomi.domain.source.model
import eu.kanade.tachiyomi.source.model.FilterList
data class EXHSavedSearch(
val id: Long,
val name: String,
val query: String,
val filterList: FilterList?,
)
@@ -0,0 +1,15 @@
package tachiyomi.domain.source.model
data class FeedSavedSearch(
// Tag identifier, unique
val id: Long,
// Source for the saved search
val source: Long,
// If -1 then get latest, if set get the saved search
val savedSearch: Long?,
// If the feed is a global or source specific feed
val global: Boolean,
)
@@ -0,0 +1,18 @@
package tachiyomi.domain.source.model
data class SavedSearch(
// Tag identifier, unique
val id: Long,
// The source the saved search is for
val source: Long,
// If false the manga will not grab chapter updates
val name: String,
// The query if there is any
val query: String?,
// The filter list
val filtersJson: String?,
)
@@ -0,0 +1,30 @@
package tachiyomi.domain.source.repository
import kotlinx.coroutines.flow.Flow
import tachiyomi.domain.source.model.FeedSavedSearch
import tachiyomi.domain.source.model.SavedSearch
interface FeedSavedSearchRepository {
suspend fun getGlobal(): List<FeedSavedSearch>
fun getGlobalAsFlow(): Flow<List<FeedSavedSearch>>
suspend fun getGlobalFeedSavedSearch(): List<SavedSearch>
suspend fun countGlobal(): Long
suspend fun getBySourceId(sourceId: Long): List<FeedSavedSearch>
fun getBySourceIdAsFlow(sourceId: Long): Flow<List<FeedSavedSearch>>
suspend fun getBySourceIdFeedSavedSearch(sourceId: Long): List<SavedSearch>
suspend fun countBySourceId(sourceId: Long): Long
suspend fun delete(feedSavedSearchId: Long)
suspend fun insert(feedSavedSearch: FeedSavedSearch): Long?
suspend fun insertAll(feedSavedSearch: List<FeedSavedSearch>)
}
@@ -0,0 +1,19 @@
package tachiyomi.domain.source.repository
import kotlinx.coroutines.flow.Flow
import tachiyomi.domain.source.model.SavedSearch
interface SavedSearchRepository {
suspend fun getById(savedSearchId: Long): SavedSearch?
suspend fun getBySourceId(sourceId: Long): List<SavedSearch>
fun getBySourceIdAsFlow(sourceId: Long): Flow<List<SavedSearch>>
suspend fun delete(savedSearchId: Long)
suspend fun insert(savedSearch: SavedSearch): Long?
suspend fun insertAll(savedSearch: List<SavedSearch>)
}