mirror of
https://github.com/mihonapp/mihon.git
synced 2026-10-20 15:42:27 -07:00
Stream entries when creating and restoring backups
Closes #3850 Co-authored-by: NGB-Was-Taken <76197326+NGB-Was-Taken@users.noreply.github.com>
This commit is contained in:
co-authored by
NGB-Was-Taken
parent
5a5ff22c37
commit
771ba33a33
@@ -50,6 +50,15 @@ class CategoryRepositoryImpl(
|
||||
.subscribeToList()
|
||||
}
|
||||
|
||||
override suspend fun getCategoriesByMangaIds(mangaIds: List<Long>): Map<Long, List<Category>> {
|
||||
return database.categoryQueries
|
||||
.getCategoriesByMangaIds(mangaIds) { mangaId, id, name, order, flags ->
|
||||
mangaId to mapCategory(id, name, order, flags)
|
||||
}
|
||||
.awaitAsList()
|
||||
.groupBy({ it.first }, { it.second })
|
||||
}
|
||||
|
||||
override suspend fun insert(category: NewCategory) {
|
||||
database.categoryQueries.insert(name = category.name, flags = category.flags)
|
||||
}
|
||||
|
||||
@@ -113,6 +113,13 @@ class ChapterRepositoryImpl(
|
||||
.awaitAsList()
|
||||
}
|
||||
|
||||
override suspend fun getChaptersByMangaIds(mangaIds: List<Long>): Map<Long, List<Chapter>> {
|
||||
return database.chapterQueries
|
||||
.getChaptersByMangaIds(mangaIds, ::mapChapter)
|
||||
.awaitAsList()
|
||||
.groupBy { it.mangaId }
|
||||
}
|
||||
|
||||
override suspend fun getChapterSummaryByMangaId(mangaId: Long): ChapterSummary {
|
||||
return database.chapterQueries
|
||||
.getChapterSummaryByMangaId(mangaId) { total, latestChapterNumber ->
|
||||
|
||||
@@ -48,6 +48,15 @@ class HistoryRepositoryImpl(
|
||||
.awaitAsList()
|
||||
}
|
||||
|
||||
override suspend fun getHistoryByMangaIds(mangaIds: List<Long>): Map<Long, List<History>> {
|
||||
return database.historyQueries
|
||||
.getHistoryByMangaIds(mangaIds) { mangaId, id, chapterId, readAt, readDuration ->
|
||||
mangaId to HistoryMapper.mapHistory(id, chapterId, readAt, readDuration)
|
||||
}
|
||||
.awaitAsList()
|
||||
.groupBy({ it.first }, { it.second })
|
||||
}
|
||||
|
||||
override suspend fun resetHistory(historyId: Long) {
|
||||
try {
|
||||
database.historyQueries.resetHistoryById(historyId)
|
||||
|
||||
@@ -144,6 +144,13 @@ class MangaRepositoryImpl(
|
||||
.toSet()
|
||||
}
|
||||
|
||||
override suspend fun getExcludedScanlatorsByMangaIds(mangaIds: List<Long>): Map<Long, List<String>> {
|
||||
return database.excluded_scanlatorQueries
|
||||
.getExcludedScanlatorsByMangaIds(mangaIds)
|
||||
.awaitAsList()
|
||||
.groupBy({ it.manga_id }, { it.scanlator })
|
||||
}
|
||||
|
||||
override fun getExcludedScanlatorsAsFlow(mangaId: Long): Flow<Set<String>> {
|
||||
return database.excluded_scanlatorQueries
|
||||
.getExcludedScanlatorsByMangaId(mangaId)
|
||||
|
||||
@@ -31,6 +31,13 @@ class TrackRepositoryImpl(
|
||||
.awaitAsList()
|
||||
}
|
||||
|
||||
override suspend fun getTracksByMangaIds(mangaIds: List<Long>): Map<Long, List<Track>> {
|
||||
return database.manga_trackQueries
|
||||
.getTracksByMangaIds(mangaIds, TrackMapper::mapTrack)
|
||||
.awaitAsList()
|
||||
.groupBy { it.mangaId }
|
||||
}
|
||||
|
||||
override suspend fun getTracks(): List<Track> {
|
||||
return database.manga_trackQueries
|
||||
.getTracks(TrackMapper::mapTrack)
|
||||
|
||||
Reference in New Issue
Block a user