mirror of
https://github.com/gotson/komga.git
synced 2025-12-20 23:45:11 +01:00
fix: sidecars would not be deleted with library
This commit is contained in:
parent
1a1f1cd9a8
commit
49f83b78ac
4 changed files with 16 additions and 0 deletions
|
|
@ -0,0 +1,6 @@
|
|||
DELETE
|
||||
FROM SIDECAR
|
||||
WHERE LIBRARY_ID NOT IN (
|
||||
SELECT ID
|
||||
FROM LIBRARY
|
||||
)
|
||||
|
|
@ -10,4 +10,5 @@ interface SidecarRepository {
|
|||
fun save(libraryId: String, sidecar: Sidecar)
|
||||
|
||||
fun deleteByLibraryIdAndUrls(libraryId: String, urls: Collection<URL>)
|
||||
fun deleteByLibraryId(libraryId: String)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import org.gotson.komga.domain.model.Library
|
|||
import org.gotson.komga.domain.model.PathContainedInPath
|
||||
import org.gotson.komga.domain.persistence.LibraryRepository
|
||||
import org.gotson.komga.domain.persistence.SeriesRepository
|
||||
import org.gotson.komga.domain.persistence.SidecarRepository
|
||||
import org.springframework.stereotype.Service
|
||||
import java.io.FileNotFoundException
|
||||
import java.nio.file.Files
|
||||
|
|
@ -19,6 +20,7 @@ class LibraryLifecycle(
|
|||
private val libraryRepository: LibraryRepository,
|
||||
private val seriesLifecycle: SeriesLifecycle,
|
||||
private val seriesRepository: SeriesRepository,
|
||||
private val sidecarRepository: SidecarRepository,
|
||||
private val taskReceiver: TaskReceiver
|
||||
) {
|
||||
|
||||
|
|
@ -73,6 +75,7 @@ class LibraryLifecycle(
|
|||
|
||||
val seriesIds = seriesRepository.findAllByLibraryId(library.id).map { it.id }
|
||||
seriesLifecycle.deleteMany(seriesIds)
|
||||
sidecarRepository.deleteByLibraryId(library.id)
|
||||
|
||||
libraryRepository.delete(library.id)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,12 @@ class SidecarDao(
|
|||
.execute()
|
||||
}
|
||||
|
||||
override fun deleteByLibraryId(libraryId: String) {
|
||||
dsl.deleteFrom(sc)
|
||||
.where(sc.LIBRARY_ID.eq(libraryId))
|
||||
.execute()
|
||||
}
|
||||
|
||||
private fun SidecarRecord.toDomain() =
|
||||
SidecarStored(
|
||||
url = URL(url),
|
||||
|
|
|
|||
Loading…
Reference in a new issue