Fix chapters and categories not being added to database

Closes #3278
Fixes #3291
This commit is contained in:
AntsyLich
2026-05-12 02:04:58 +06:00
parent cb2a0ea570
commit b4a3ec0b32
6 changed files with 20 additions and 22 deletions
@@ -21,7 +21,7 @@ class ChapterRepositoryImpl(
return try {
database.transactionWithResult {
chapters.map { chapter ->
val lastInsertId = database.chaptersQueries.insert(
val chapterId = database.chaptersQueries.insertReturningId(
chapter.mangaId,
chapter.url,
chapter.name,
@@ -34,8 +34,9 @@ class ChapterRepositoryImpl(
chapter.dateFetch,
chapter.dateUpload,
chapter.version,
).awaitAsOne()
chapter.copy(id = lastInsertId)
)
.awaitAsOne()
chapter.copy(id = chapterId)
}
}
} catch (e: Exception) {