delete error from DB when successfully updated

This commit is contained in:
Cuong-Tran
2024-10-24 13:38:23 +07:00
parent 28fa0dec6a
commit ff25910820
5 changed files with 32 additions and 1 deletions

View File

@@ -29,6 +29,16 @@ class DeleteLibraryUpdateErrors(
}
}
suspend fun deleteMangaError(mangaId: Long) = withNonCancellableContext {
try {
libraryUpdateErrorRepository.deleteMangaError(mangaId)
Result.Success
} catch (e: Exception) {
logcat(LogPriority.ERROR, e)
return@withNonCancellableContext Result.InternalError(e)
}
}
sealed class Result {
object Success : Result()
data class InternalError(val error: Throwable) : Result()

View File

@@ -13,6 +13,8 @@ interface LibraryUpdateErrorRepository {
suspend fun delete(errorId: Long)
suspend fun deleteMangaError(mangaId: Long)
suspend fun upsert(libraryUpdateError: LibraryUpdateError)
suspend fun insert(libraryUpdateError: LibraryUpdateError)