Use domain layer for almost all SY code
This commit is contained in:
@@ -32,10 +32,11 @@ class CategoryRepositoryImpl(
|
||||
}
|
||||
}
|
||||
|
||||
// SY -->
|
||||
@Throws(DuplicateNameException::class)
|
||||
override suspend fun insert(name: String, order: Long) {
|
||||
override suspend fun insert(name: String, order: Long): Long {
|
||||
if (checkDuplicateName(name)) throw DuplicateNameException(name)
|
||||
handler.await {
|
||||
return handler.awaitOne(true) {
|
||||
categoriesQueries.insert(
|
||||
name = name,
|
||||
order = order,
|
||||
@@ -44,8 +45,10 @@ class CategoryRepositoryImpl(
|
||||
mangaOrder = emptyList(),
|
||||
// SY <--
|
||||
)
|
||||
categoriesQueries.selectLastInsertedRowId()
|
||||
}
|
||||
}
|
||||
// SY <--
|
||||
|
||||
@Throws(DuplicateNameException::class)
|
||||
override suspend fun update(payload: CategoryUpdate) {
|
||||
|
||||
@@ -94,6 +94,10 @@ class ChapterRepositoryImpl(
|
||||
}
|
||||
|
||||
// SY -->
|
||||
override suspend fun getChapterByUrl(url: String): List<Chapter> {
|
||||
return handler.awaitList { chaptersQueries.getChapterByUrl(url, chapterMapper) }
|
||||
}
|
||||
|
||||
override suspend fun getMergedChapterByMangaId(mangaId: Long): List<Chapter> {
|
||||
return handler.awaitList { chaptersQueries.getMergedChaptersByMangaId(mangaId, chapterMapper) }
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import eu.kanade.data.DatabaseHandler
|
||||
import eu.kanade.data.chapter.chapterMapper
|
||||
import eu.kanade.data.manga.mangaMapper
|
||||
import eu.kanade.domain.chapter.model.Chapter
|
||||
import eu.kanade.domain.history.model.History
|
||||
import eu.kanade.domain.history.model.HistoryUpdate
|
||||
import eu.kanade.domain.history.model.HistoryWithRelations
|
||||
import eu.kanade.domain.history.repository.HistoryRepository
|
||||
@@ -109,4 +110,10 @@ class HistoryRepositoryImpl(
|
||||
logcat(LogPriority.ERROR, throwable = e)
|
||||
}
|
||||
}
|
||||
|
||||
// SY -->
|
||||
override suspend fun getByMangaId(mangaId: Long): List<History> {
|
||||
return handler.awaitList { historyQueries.getHistoryByMangaId(mangaId, historyMapper) }
|
||||
}
|
||||
// SY <--
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user