diff --git a/komga/src/flyway/kotlin/db/migration/sqlite/V20200810154730__thumbnails_part_2.kt b/komga/src/flyway/kotlin/db/migration/sqlite/V20200810154730__thumbnails_part_2.kt index 2bc0ea953..983a05970 100644 --- a/komga/src/flyway/kotlin/db/migration/sqlite/V20200810154730__thumbnails_part_2.kt +++ b/komga/src/flyway/kotlin/db/migration/sqlite/V20200810154730__thumbnails_part_2.kt @@ -21,7 +21,7 @@ class V20200810154730__thumbnails_part_2 : BaseJavaMigration() { jdbcTemplate.batchUpdate( "INSERT INTO THUMBNAIL_BOOK(ID, THUMBNAIL, SELECTED, TYPE, BOOK_ID) values (?, ?, 1, 'GENERATED', ?)", - parameters + parameters, ) } } diff --git a/komga/src/flyway/kotlin/db/migration/sqlite/V20200820150923__metadata_fields_part_2.kt b/komga/src/flyway/kotlin/db/migration/sqlite/V20200820150923__metadata_fields_part_2.kt index c9bb6eb57..030d8a904 100644 --- a/komga/src/flyway/kotlin/db/migration/sqlite/V20200820150923__metadata_fields_part_2.kt +++ b/komga/src/flyway/kotlin/db/migration/sqlite/V20200820150923__metadata_fields_part_2.kt @@ -12,7 +12,7 @@ class V20200820150923__metadata_fields_part_2 : BaseJavaMigration() { val bookMetadata = jdbcTemplate.queryForList( """select m.AGE_RATING, m.AGE_RATING_LOCK, m.PUBLISHER, m.PUBLISHER_LOCK, m.READING_DIRECTION, m.READING_DIRECTION_LOCK, b.SERIES_ID, m.NUMBER_SORT from BOOK_METADATA m -left join BOOK B on B.ID = m.BOOK_ID""" +left join BOOK B on B.ID = m.BOOK_ID""", ) if (bookMetadata.isNotEmpty()) { @@ -41,7 +41,7 @@ left join BOOK B on B.ID = m.BOOK_ID""" jdbcTemplate.batchUpdate( "UPDATE SERIES_METADATA SET AGE_RATING = ?, AGE_RATING_LOCK = ?, PUBLISHER = ?, PUBLISHER_LOCK = ?, READING_DIRECTION = ?, READING_DIRECTION_LOCK = ? WHERE SERIES_ID = ?", - parameters + parameters, ) } } diff --git a/komga/src/flyway/kotlin/db/migration/sqlite/V20210624165023__missing_series_metadata.kt b/komga/src/flyway/kotlin/db/migration/sqlite/V20210624165023__missing_series_metadata.kt index 32cd1a9de..efb707ff4 100644 --- a/komga/src/flyway/kotlin/db/migration/sqlite/V20210624165023__missing_series_metadata.kt +++ b/komga/src/flyway/kotlin/db/migration/sqlite/V20210624165023__missing_series_metadata.kt @@ -14,7 +14,7 @@ class V20210624165023__missing_series_metadata : BaseJavaMigration() { val jdbcTemplate = JdbcTemplate(SingleConnectionDataSource(context.connection, true)) val seriesWithoutMetada = jdbcTemplate.queryForList( - """select s.ID, s.NAME from SERIES s where s.ID not in (select sm.SERIES_ID from SERIES_METADATA sm)""" + """select s.ID, s.NAME from SERIES s where s.ID not in (select sm.SERIES_ID from SERIES_METADATA sm)""", ) if (seriesWithoutMetada.isNotEmpty()) { diff --git a/komga/src/main/kotlin/org/gotson/komga/application/tasks/TaskReceiver.kt b/komga/src/main/kotlin/org/gotson/komga/application/tasks/TaskReceiver.kt index 60ff928a9..96cb12d00 100644 --- a/komga/src/main/kotlin/org/gotson/komga/application/tasks/TaskReceiver.kt +++ b/komga/src/main/kotlin/org/gotson/komga/application/tasks/TaskReceiver.kt @@ -55,9 +55,9 @@ class TaskReceiver( bookRepository.findAllIds( BookSearch( libraryIds = listOf(library.id), - mediaStatus = listOf(Media.Status.UNKNOWN, Media.Status.OUTDATED) + mediaStatus = listOf(Media.Status.UNKNOWN, Media.Status.OUTDATED), ), - Sort.by(Sort.Order.asc("seriesId"), Sort.Order.asc("number")) + Sort.by(Sort.Order.asc("seriesId"), Sort.Order.asc("number")), ).forEach { submitTask(Task.AnalyzeBook(it)) } diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/model/Author.kt b/komga/src/main/kotlin/org/gotson/komga/domain/model/Author.kt index 259162840..b1b4591e5 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/model/Author.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/model/Author.kt @@ -2,7 +2,7 @@ package org.gotson.komga.domain.model class Author( name: String, - role: String + role: String, ) { val name = name.trim() val role = role.trim().lowercase() diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/model/BookMetadataPatch.kt b/komga/src/main/kotlin/org/gotson/komga/domain/model/BookMetadataPatch.kt index 875366401..e18f1edb6 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/model/BookMetadataPatch.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/model/BookMetadataPatch.kt @@ -12,11 +12,11 @@ data class BookMetadataPatch( val isbn: String? = null, val links: List? = null, - val readLists: List = emptyList() + val readLists: List = emptyList(), ) { data class ReadListEntry( val name: String, - val number: Int? = null + val number: Int? = null, ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/model/BookPage.kt b/komga/src/main/kotlin/org/gotson/komga/domain/model/BookPage.kt index 989884c65..511d01e03 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/model/BookPage.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/model/BookPage.kt @@ -3,5 +3,5 @@ package org.gotson.komga.domain.model data class BookPage( val fileName: String, val mediaType: String, - val dimension: Dimension? = null + val dimension: Dimension? = null, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/model/BookPageContent.kt b/komga/src/main/kotlin/org/gotson/komga/domain/model/BookPageContent.kt index b94645ad3..12e6df1bf 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/model/BookPageContent.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/model/BookPageContent.kt @@ -3,5 +3,5 @@ package org.gotson.komga.domain.model class BookPageContent( val number: Int, val content: ByteArray, - val mediaType: String + val mediaType: String, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/model/Dimension.kt b/komga/src/main/kotlin/org/gotson/komga/domain/model/Dimension.kt index ff8f1f430..de010e6ac 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/model/Dimension.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/model/Dimension.kt @@ -2,5 +2,5 @@ package org.gotson.komga.domain.model data class Dimension( val width: Int, - val height: Int + val height: Int, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/model/Exceptions.kt b/komga/src/main/kotlin/org/gotson/komga/domain/model/Exceptions.kt index d27ae6547..c3f5a18bb 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/model/Exceptions.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/model/Exceptions.kt @@ -11,6 +11,7 @@ open class CodedException : Exception { this.code = code } } + fun Exception.withCode(code: String) = CodedException(this, code) class MediaNotReadyException : Exception() diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/model/MediaContainerEntry.kt b/komga/src/main/kotlin/org/gotson/komga/domain/model/MediaContainerEntry.kt index 9d47f0f15..678f1a8de 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/model/MediaContainerEntry.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/model/MediaContainerEntry.kt @@ -4,5 +4,5 @@ data class MediaContainerEntry( val name: String, val mediaType: String? = null, val comment: String? = null, - val dimension: Dimension? = null + val dimension: Dimension? = null, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/model/ReadList.kt b/komga/src/main/kotlin/org/gotson/komga/domain/model/ReadList.kt index 28f9a4989..b28c65ae5 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/model/ReadList.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/model/ReadList.kt @@ -19,5 +19,5 @@ data class ReadList( /** * Indicates that the bookIds have been filtered and is not exhaustive. */ - val filtered: Boolean = false + val filtered: Boolean = false, ) : Auditable(), Serializable diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/model/SeriesCollection.kt b/komga/src/main/kotlin/org/gotson/komga/domain/model/SeriesCollection.kt index 471d00ca3..20d6401c2 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/model/SeriesCollection.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/model/SeriesCollection.kt @@ -18,5 +18,5 @@ data class SeriesCollection( /** * Indicates that the seriesIds have been filtered and is not exhaustive. */ - val filtered: Boolean = false + val filtered: Boolean = false, ) : Auditable(), Serializable diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/model/SeriesMetadata.kt b/komga/src/main/kotlin/org/gotson/komga/domain/model/SeriesMetadata.kt index 2a0f44baf..b0d11d5a4 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/model/SeriesMetadata.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/model/SeriesMetadata.kt @@ -65,7 +65,7 @@ class SeriesMetadata( totalBookCountLock: Boolean = this.totalBookCountLock, seriesId: String = this.seriesId, createdDate: LocalDateTime = this.createdDate, - lastModifiedDate: LocalDateTime = this.lastModifiedDate + lastModifiedDate: LocalDateTime = this.lastModifiedDate, ) = SeriesMetadata( status = status, @@ -92,7 +92,7 @@ class SeriesMetadata( totalBookCountLock = totalBookCountLock, seriesId = seriesId, createdDate = createdDate, - lastModifiedDate = lastModifiedDate + lastModifiedDate = lastModifiedDate, ) enum class Status { diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/model/SeriesMetadataPatch.kt b/komga/src/main/kotlin/org/gotson/komga/domain/model/SeriesMetadataPatch.kt index 2a925f173..79ff29fc5 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/model/SeriesMetadataPatch.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/model/SeriesMetadataPatch.kt @@ -12,5 +12,5 @@ data class SeriesMetadataPatch( val genres: Set?, val totalBookCount: Int?, - val collections: List + val collections: List, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/BookAnalyzer.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/BookAnalyzer.kt index a0aae5cb8..006439487 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/service/BookAnalyzer.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/BookAnalyzer.kt @@ -21,7 +21,7 @@ private val logger = KotlinLogging.logger {} class BookAnalyzer( private val contentDetector: ContentDetector, extractors: List, - private val imageConverter: ImageConverter + private val imageConverter: ImageConverter, ) { val supportedMediaTypes = extractors @@ -54,7 +54,7 @@ class BookAnalyzer( }.let { (images, others) -> Pair( images.map { BookPage(it.name, it.mediaType!!, it.dimension) }, - others + others, ) } @@ -106,13 +106,13 @@ class BookAnalyzer( return ThumbnailBook( thumbnail = thumbnail, type = ThumbnailBook.Type.GENERATED, - bookId = book.book.id + bookId = book.book.id, ) } @Throws( MediaNotReadyException::class, - IndexOutOfBoundsException::class + IndexOutOfBoundsException::class, ) fun getPageContent(book: BookWithMedia, number: Int): ByteArray { logger.info { "Get page #$number for book: $book" } @@ -131,7 +131,7 @@ class BookAnalyzer( } @Throws( - MediaNotReadyException::class + MediaNotReadyException::class, ) fun getFileContent(book: BookWithMedia, fileName: String): ByteArray { logger.info { "Get file $fileName for book: $book" } diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/BookConverter.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/BookConverter.kt index 12b5daab4..8cadb1d97 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/service/BookConverter.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/BookConverter.kt @@ -96,7 +96,7 @@ class BookConverter( ?.copy( id = book.id, seriesId = book.seriesId, - libraryId = book.libraryId + libraryId = book.libraryId, ) ?: throw IllegalStateException("Newly converted book could not be scanned: $destinationFilename") @@ -172,7 +172,7 @@ class BookConverter( ?.copy( id = book.id, seriesId = book.seriesId, - libraryId = book.libraryId + libraryId = book.libraryId, ) ?: throw IllegalStateException("Repaired book could not be scanned: $destinationFilename") diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/BookImporter.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/BookImporter.kt index 59ecc150e..74e923e7c 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/service/BookImporter.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/BookImporter.kt @@ -68,12 +68,12 @@ class BookImporter( val destFile = series.path.resolve( if (destinationName != null) Paths.get("$destinationName.${sourceFile.extension}").name - else sourceFile.name + else sourceFile.name, ) val sidecars = fileSystemScanner.scanBookSidecars(sourceFile).associateWith { series.path.resolve( if (destinationName != null) it.url.toURI().toPath().name.replace(sourceFile.nameWithoutExtension, destinationName, true) - else it.url.toURI().toPath().name + else it.url.toURI().toPath().name, ) } @@ -159,7 +159,7 @@ class BookImporter( it.copy( bookId = importedBook.id, status = Media.Status.OUTDATED, - ) + ), ) } @@ -178,8 +178,8 @@ class BookImporter( .forEach { rl -> readListRepository.update( rl.copy( - bookIds = rl.bookIds.values.map { if (it == bookToUpgrade.id) importedBook.id else it }.toIndexedMap() - ) + bookIds = rl.bookIds.values.map { if (it == bookToUpgrade.id) importedBook.id else it }.toIndexedMap(), + ), ) } @@ -201,7 +201,7 @@ class BookImporter( val destSidecar = sourceSidecar.copy( url = destPath.toUri().toURL(), parentUrl = destPath.parent.toUri().toURL(), - lastModifiedTime = destPath.readAttributes().getUpdatedTime() + lastModifiedTime = destPath.readAttributes().getUpdatedTime(), ) sidecarRepository.save(importedBook.libraryId, destSidecar) } diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/BookLifecycle.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/BookLifecycle.kt index 7bf30c3c8..30fcced6e 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/service/BookLifecycle.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/BookLifecycle.kt @@ -206,7 +206,7 @@ class BookLifecycle( @Throws( ImageConversionException::class, MediaNotReadyException::class, - IndexOutOfBoundsException::class + IndexOutOfBoundsException::class, ) fun getBookPage(book: Book, number: Int, convertTo: ImageType? = null, resizeTo: Int? = null): BookPageContent { val media = mediaRepository.findById(book.id) diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/BookMetadataLifecycle.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/BookMetadataLifecycle.kt index d91e6e76b..576d9bf20 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/service/BookMetadataLifecycle.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/BookMetadataLifecycle.kt @@ -74,7 +74,7 @@ class BookMetadataLifecycle( private fun handlePatchForReadLists( patch: BookMetadataPatch?, - book: Book + book: Book, ) { patch?.readLists?.forEach { readList -> @@ -93,7 +93,7 @@ class BookMetadataLifecycle( } map[key] = book.id readListLifecycle.updateReadList( - existing.copy(bookIds = map) + existing.copy(bookIds = map), ) } } else { @@ -101,8 +101,8 @@ class BookMetadataLifecycle( readListLifecycle.addReadList( ReadList( name = readList.name, - bookIds = mapOf((readList.number ?: 0) to book.id).toSortedMap() - ) + bookIds = mapOf((readList.number ?: 0) to book.id).toSortedMap(), + ), ) } } @@ -111,7 +111,7 @@ class BookMetadataLifecycle( private fun handlePatchForBookMetadata( patch: BookMetadataPatch?, - book: Book + book: Book, ) { patch?.let { bPatch -> bookMetadataRepository.findById(book.id).let { diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/FileSystemScanner.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/FileSystemScanner.kt index 88e5acc1f..f00a317e4 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/service/FileSystemScanner.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/FileSystemScanner.kt @@ -84,7 +84,7 @@ class FileSystemScanner( pathToSeries[dir] = Series( name = dir.name.ifBlank { dir.pathString }, url = dir.toUri().toURL(), - fileLastModified = attrs.getUpdatedTime() + fileLastModified = attrs.getUpdatedTime(), ) return FileVisitResult.CONTINUE @@ -159,7 +159,7 @@ class FileSystemScanner( return FileVisitResult.CONTINUE } - } + }, ) }.also { val countOfBooks = scannedSeries.values.sumOf { it.size } @@ -192,7 +192,7 @@ class FileSystemScanner( name = path.nameWithoutExtension, url = path.toUri().toURL(), fileLastModified = attrs.getUpdatedTime(), - fileSize = attrs.size() + fileSize = attrs.size(), ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/LibraryContentLifecycle.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/LibraryContentLifecycle.kt index 82254e543..470c68c28 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/service/LibraryContentLifecycle.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/LibraryContentLifecycle.kt @@ -264,8 +264,8 @@ class LibraryContentLifecycle( deleted.copy( seriesId = newSeries.id, title = if (deleted.titleLock) deleted.title else newlyAdded.title, - titleSort = if (deleted.titleSortLock) deleted.titleSort else newlyAdded.titleSort - ) + titleSort = if (deleted.titleSortLock) deleted.titleSort else newlyAdded.titleSort, + ), ) } @@ -274,8 +274,8 @@ class LibraryContentLifecycle( .forEach { col -> collectionRepository.update( col.copy( - seriesIds = col.seriesIds.map { if (it == match.first.id) newSeries.id else it } - ) + seriesIds = col.seriesIds.map { if (it == match.first.id) newSeries.id else it }, + ), ) } @@ -334,7 +334,7 @@ class LibraryContentLifecycle( deleted.copy( bookId = bookToAdd.id, title = if (deleted.titleLock) deleted.title else newlyAdded.title, - ) + ), ) if (!deleted.titleLock) taskReceiver.refreshBookMetadata(bookToAdd.id, setOf(BookMetadataPatchCapability.TITLE)) } @@ -349,8 +349,8 @@ class LibraryContentLifecycle( .forEach { rl -> readListRepository.update( rl.copy( - bookIds = rl.bookIds.values.map { if (it == match.id) bookToAdd.id else it }.toIndexedMap() - ) + bookIds = rl.bookIds.values.map { if (it == match.id) bookToAdd.id else it }.toIndexedMap(), + ), ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/LibraryLifecycle.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/LibraryLifecycle.kt index c068ec746..ac36c7ddf 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/service/LibraryLifecycle.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/LibraryLifecycle.kt @@ -33,7 +33,7 @@ class LibraryLifecycle( FileNotFoundException::class, DirectoryNotFoundException::class, DuplicateNameException::class, - PathContainedInPath::class + PathContainedInPath::class, ) fun addLibrary(library: Library): Library { logger.info { "Adding new library: ${library.name} with root folder: ${library.root}" } diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/LocalArtworkLifecycle.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/LocalArtworkLifecycle.kt index 77ca97e4d..b9e3d1e7f 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/service/LocalArtworkLifecycle.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/LocalArtworkLifecycle.kt @@ -15,7 +15,7 @@ class LocalArtworkLifecycle( private val libraryRepository: LibraryRepository, private val bookLifecycle: BookLifecycle, private val seriesLifecycle: SeriesLifecycle, - private val localArtworkProvider: LocalArtworkProvider + private val localArtworkProvider: LocalArtworkProvider, ) { fun refreshLocalArtwork(book: Book) { diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/ReadListLifecycle.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/ReadListLifecycle.kt index 9cc7ed392..c6f1a6ceb 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/service/ReadListLifecycle.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/ReadListLifecycle.kt @@ -29,7 +29,7 @@ class ReadListLifecycle( ) { @Throws( - DuplicateNameException::class + DuplicateNameException::class, ) fun addReadList(readList: ReadList): ReadList { logger.info { "Adding new read list: $readList" } diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/ReadListMatcher.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/ReadListMatcher.kt index 69a4f2361..edffc1019 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/service/ReadListMatcher.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/ReadListMatcher.kt @@ -55,13 +55,13 @@ class ReadListMatcher( return if (bookIds.isNotEmpty()) ReadListRequestResult( readList = ReadList(name = request.name, bookIds = bookIds.toIndexedMap()), - unmatchedBooks = unmatchedBooks + unmatchedBooks = unmatchedBooks, ) else { ReadListRequestResult( readList = null, unmatchedBooks = unmatchedBooks, - errorCode = "ERR_1010" + errorCode = "ERR_1010", ) } } diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/SeriesCollectionLifecycle.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/SeriesCollectionLifecycle.kt index f74c50de8..94756bceb 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/service/SeriesCollectionLifecycle.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/SeriesCollectionLifecycle.kt @@ -25,7 +25,7 @@ class SeriesCollectionLifecycle( ) { @Throws( - DuplicateNameException::class + DuplicateNameException::class, ) fun addCollection(collection: SeriesCollection): SeriesCollection { logger.info { "Adding new collection: $collection" } diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/SeriesLifecycle.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/SeriesLifecycle.kt index 8ac918247..d46077dad 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/service/SeriesLifecycle.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/SeriesLifecycle.kt @@ -81,20 +81,20 @@ class SeriesLifecycle( .trim() .stripAccents() .replace(whitespacePattern, " ") - } + }, ) .map { book -> book to metadatas.first { it.bookId == book.id } } logger.debug { "Sorted books: $sorted" } bookRepository.update( - sorted.mapIndexed { index, (book, _) -> book.copy(number = index + 1) } + sorted.mapIndexed { index, (book, _) -> book.copy(number = index + 1) }, ) val oldToNew = sorted.mapIndexedNotNull { index, (_, metadata) -> if (metadata.numberLock && metadata.numberSortLock) null else metadata to metadata.copy( number = if (!metadata.numberLock) (index + 1).toString() else metadata.number, - numberSort = if (!metadata.numberSortLock) (index + 1).toFloat() else metadata.numberSort + numberSort = if (!metadata.numberSortLock) (index + 1).toFloat() else metadata.numberSort, ) } bookMetadataRepository.update(oldToNew.map { it.second }) @@ -131,7 +131,7 @@ class SeriesLifecycle( title = it.name, number = it.number.toString(), numberSort = it.number.toFloat(), - bookId = it.id + bookId = it.id, ) }.let { bookMetadataRepository.insert(it) } } @@ -147,12 +147,12 @@ class SeriesLifecycle( SeriesMetadata( title = series.name, titleSort = StringUtils.stripAccents(series.name), - seriesId = series.id - ) + seriesId = series.id, + ), ) bookMetadataAggregationRepository.insert( - BookMetadataAggregation(seriesId = series.id) + BookMetadataAggregation(seriesId = series.id), ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/SeriesMetadataLifecycle.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/SeriesMetadataLifecycle.kt index c11139081..f0b5152aa 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/service/SeriesMetadataLifecycle.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/SeriesMetadataLifecycle.kt @@ -91,7 +91,7 @@ class SeriesMetadataLifecycle( private fun handlePatchForCollections( patches: List, - series: Series + series: Series, ) { patches.flatMap { it.collections }.distinct().forEach { collection -> collectionRepository.findByNameOrNull(collection).let { existing -> @@ -101,7 +101,7 @@ class SeriesMetadataLifecycle( else { logger.debug { "Adding series '${series.name}' to existing collection '${existing.name}'" } collectionLifecycle.updateCollection( - existing.copy(seriesIds = existing.seriesIds + series.id) + existing.copy(seriesIds = existing.seriesIds + series.id), ) } } else { @@ -109,8 +109,8 @@ class SeriesMetadataLifecycle( collectionLifecycle.addCollection( SeriesCollection( name = collection, - seriesIds = listOf(series.id) - ) + seriesIds = listOf(series.id), + ), ) } } @@ -119,7 +119,7 @@ class SeriesMetadataLifecycle( private fun handlePatchForSeriesMetadata( patches: List, - series: Series + series: Series, ) { val aggregatedPatch = SeriesMetadataPatch( title = patches.mostFrequent { it.title }, @@ -132,7 +132,7 @@ class SeriesMetadataLifecycle( ageRating = patches.mapNotNull { it.ageRating }.maxOrNull(), publisher = patches.mostFrequent { it.publisher }, totalBookCount = patches.mapNotNull { it.totalBookCount }.maxOrNull(), - collections = emptyList() + collections = emptyList(), ) handlePatchForSeriesMetadata(aggregatedPatch, series) @@ -140,7 +140,7 @@ class SeriesMetadataLifecycle( private fun handlePatchForSeriesMetadata( patch: SeriesMetadataPatch, - series: Series + series: Series, ) { seriesMetadataRepository.findById(series.id).let { logger.debug { "Apply metadata for series: $series" } diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/TransientBookLifecycle.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/TransientBookLifecycle.kt index eacf5669c..cafbda65e 100644 --- a/komga/src/main/kotlin/org/gotson/komga/domain/service/TransientBookLifecycle.kt +++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/TransientBookLifecycle.kt @@ -43,7 +43,7 @@ class TransientBookLifecycle( @Throws( MediaNotReadyException::class, - IndexOutOfBoundsException::class + IndexOutOfBoundsException::class, ) fun getBookPage(transientBook: BookWithMedia, number: Int): BookPageContent { val pageContent = bookAnalyzer.getPageContent(transientBook, number) diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/datasource/DataSourcesConfiguration.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/datasource/DataSourcesConfiguration.kt index 53bfc92fc..1f8207712 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/datasource/DataSourcesConfiguration.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/datasource/DataSourcesConfiguration.kt @@ -11,7 +11,7 @@ import javax.sql.DataSource @Configuration class DataSourcesConfiguration( - private val komgaProperties: KomgaProperties + private val komgaProperties: KomgaProperties, ) { @Bean("sqliteDataSource") @@ -29,7 +29,7 @@ class DataSourcesConfiguration( dataSource = sqliteUdfDataSource poolName = "SqliteUdfPool" maximumPoolSize = 1 - } + }, ) } } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/datasource/SqliteUdfDataSource.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/datasource/SqliteUdfDataSource.kt index ce11a9a69..2a58fe328 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/datasource/SqliteUdfDataSource.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/datasource/SqliteUdfDataSource.kt @@ -41,7 +41,7 @@ class SqliteUdfDataSource : SimpleDriverDataSource() { result(if (regexp.containsMatchIn(text)) 1 else 0) } - } + }, ) } @@ -55,7 +55,7 @@ class SqliteUdfDataSource : SimpleDriverDataSource() { null -> error("Argument must not be null") else -> result(text.stripAccents()) } - } + }, ) } @@ -70,7 +70,7 @@ class SqliteUdfDataSource : SimpleDriverDataSource() { } override fun xCompare(str1: String, str2: String): Int = collator.compare(str1, str2) - } + }, ) } } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/image/MosaicGenerator.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/image/MosaicGenerator.kt index fb776a8f6..18272f29c 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/image/MosaicGenerator.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/image/MosaicGenerator.kt @@ -19,7 +19,7 @@ class MosaicGenerator { 0 to 0, 106 to 0, 0 to 150, - 106 to 150 + 106 to 150, ).forEachIndexed { index, (x, y) -> thumbs.getOrNull(index)?.let { drawImage(it, x, y, null) } } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jms/ArtemisConfig.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jms/ArtemisConfig.kt index 092ad6693..23630b1bf 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jms/ArtemisConfig.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jms/ArtemisConfig.kt @@ -40,18 +40,18 @@ class ArtemisConfig : ArtemisConfigurationCustomizer { QUEUE_TASKS, AddressSettings().apply { defaultConsumerWindowSize = 0 - } + }, ) it.addQueueConfiguration( QueueConfiguration(QUEUE_TASKS) .setAddress(QUEUE_TASKS) .setLastValueKey(QUEUE_UNIQUE_ID) - .setRoutingType(RoutingType.ANYCAST) + .setRoutingType(RoutingType.ANYCAST), ) it.addQueueConfiguration( QueueConfiguration(QUEUE_SSE) .setAddress(QUEUE_SSE) - .setRoutingType(RoutingType.MULTICAST) + .setRoutingType(RoutingType.MULTICAST), ) } } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/AuthenticationActivityDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/AuthenticationActivityDao.kt index f9abcefc5..4fcecd90a 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/AuthenticationActivityDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/AuthenticationActivityDao.kt @@ -18,7 +18,7 @@ import java.time.LocalDateTime @Component class AuthenticationActivityDao( - private val dsl: DSLContext + private val dsl: DSLContext, ) : AuthenticationActivityRepository { private val aa = Tables.AUTHENTICATION_ACTIVITY diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookDao.kt index ffadfe0ce..6e102c121 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookDao.kt @@ -123,7 +123,7 @@ class BookDao( items, if (pageable.isPaged) PageRequest.of(pageable.pageNumber, pageable.pageSize, pageSort) else PageRequest.of(0, maxOf(count.toInt(), 20), pageSort), - count + count, ) } @@ -246,7 +246,7 @@ class BookDao( b.LIBRARY_ID, b.SERIES_ID, b.DELETED_DATE, - ).values(null as String?, null, null, null, null, null, null, null, null, null) + ).values(null as String?, null, null, null, null, null, null, null, null, null), ).also { step -> chunk.forEach { step.bind( @@ -337,6 +337,6 @@ class BookDao( deletedDate = deletedDate, createdDate = createdDate.toCurrentTimeZone(), lastModifiedDate = lastModifiedDate.toCurrentTimeZone(), - number = number + number = number, ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookMetadataAggregationDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookMetadataAggregationDao.kt index 4b3cdcf43..166e2e5b1 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookMetadataAggregationDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/BookMetadataAggregationDao.kt @@ -34,7 +34,7 @@ class BookMetadataAggregationDao( .leftJoin(a).on(d.SERIES_ID.eq(a.SERIES_ID)) .where(d.SERIES_ID.`in`(seriesIds)) .fetchGroups( - { it.into(d) }, { it.into(a) } + { it.into(d) }, { it.into(a) }, ).map { (dr, ar) -> dr.toDomain(ar.filterNot { it.name == null }.map { it.toDomain() }, findTags(dr.seriesId)) } @@ -87,7 +87,7 @@ class BookMetadataAggregationDao( metadata.authors.chunked(batchSize).forEach { chunk -> dsl.batch( dsl.insertInto(a, a.SERIES_ID, a.NAME, a.ROLE) - .values(null as String?, null, null) + .values(null as String?, null, null), ).also { step -> chunk.forEach { step.bind(metadata.seriesId, it.name, it.role) @@ -102,7 +102,7 @@ class BookMetadataAggregationDao( metadata.tags.chunked(batchSize).forEach { chunk -> dsl.batch( dsl.insertInto(t, t.SERIES_ID, t.TAG) - .values(null as String?, null) + .values(null as String?, null), ).also { step -> chunk.forEach { step.bind(metadata.seriesId, it) @@ -141,12 +141,12 @@ class BookMetadataAggregationDao( seriesId = seriesId, createdDate = createdDate.toCurrentTimeZone(), - lastModifiedDate = lastModifiedDate.toCurrentTimeZone() + lastModifiedDate = lastModifiedDate.toCurrentTimeZone(), ) private fun BookMetadataAggregationAuthorRecord.toDomain() = Author( name = name, - role = role + role = role, ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/KomgaUserDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/KomgaUserDao.kt index daba28022..982fc5cee 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/KomgaUserDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/KomgaUserDao.kt @@ -13,7 +13,7 @@ import java.time.ZoneId @Component class KomgaUserDao( - private val dsl: DSLContext + private val dsl: DSLContext, ) : KomgaUserRepository { private val u = Tables.USER @@ -51,7 +51,7 @@ class KomgaUserDao( sharedAllLibraries = ur.sharedAllLibraries, id = ur.id, createdDate = ur.createdDate.toCurrentTimeZone(), - lastModifiedDate = ur.lastModifiedDate.toCurrentTimeZone() + lastModifiedDate = ur.lastModifiedDate.toCurrentTimeZone(), ) } @@ -115,7 +115,7 @@ class KomgaUserDao( override fun existsByEmailIgnoreCase(email: String): Boolean = dsl.fetchExists( dsl.selectFrom(u) - .where(u.EMAIL.equalIgnoreCase(email)) + .where(u.EMAIL.equalIgnoreCase(email)), ) override fun findByEmailIgnoreCaseOrNull(email: String): KomgaUser? = diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/LibraryDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/LibraryDao.kt index 5444fb9fe..fd2b7dcf1 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/LibraryDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/LibraryDao.kt @@ -13,7 +13,7 @@ import java.time.ZoneId @Component class LibraryDao( - private val dsl: DSLContext + private val dsl: DSLContext, ) : LibraryRepository { private val l = Tables.LIBRARY @@ -130,6 +130,6 @@ class LibraryDao( unavailableDate = unavailableDate, id = id, createdDate = createdDate.toCurrentTimeZone(), - lastModifiedDate = lastModifiedDate.toCurrentTimeZone() + lastModifiedDate = lastModifiedDate.toCurrentTimeZone(), ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/MediaDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/MediaDao.kt index ee5b49dd5..20da9c6cb 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/MediaDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/MediaDao.kt @@ -51,7 +51,7 @@ class MediaDao( .groupBy(*groupFields) .orderBy(p.NUMBER.asc()) .fetchGroups( - { it.into(m) }, { it.into(p) } + { it.into(m) }, { it.into(p) }, ).map { (mr, pr) -> val files = dsl.selectFrom(f) .where(f.BOOK_ID.eq(bookId)) @@ -77,8 +77,8 @@ class MediaDao( m.STATUS, m.MEDIA_TYPE, m.COMMENT, - m.PAGE_COUNT - ).values(null as String?, null, null, null, null) + m.PAGE_COUNT, + ).values(null as String?, null, null, null, null), ).also { step -> chunk.forEach { step.bind( @@ -86,7 +86,7 @@ class MediaDao( it.status, it.mediaType, it.comment, - it.pages.size + it.pages.size, ) } }.execute() @@ -108,8 +108,8 @@ class MediaDao( p.MEDIA_TYPE, p.NUMBER, p.WIDTH, - p.HEIGHT - ).values(null as String?, null, null, null, null, null) + p.HEIGHT, + ).values(null as String?, null, null, null, null, null), ).also { step -> chunk.forEach { media -> media.pages.forEachIndexed { index, page -> @@ -119,7 +119,7 @@ class MediaDao( page.mediaType, index, page.dimension?.width, - page.dimension?.height + page.dimension?.height, ) } } @@ -135,14 +135,14 @@ class MediaDao( dsl.insertInto( f, f.BOOK_ID, - f.FILE_NAME - ).values(null as String?, null) + f.FILE_NAME, + ).values(null as String?, null), ).also { step -> chunk.forEach { media -> media.files.forEach { step.bind( media.bookId, - it + it, ) } } @@ -201,13 +201,13 @@ class MediaDao( comment = comment, bookId = bookId, createdDate = createdDate.toCurrentTimeZone(), - lastModifiedDate = lastModifiedDate.toCurrentTimeZone() + lastModifiedDate = lastModifiedDate.toCurrentTimeZone(), ) private fun MediaPageRecord.toDomain() = BookPage( fileName = fileName, mediaType = mediaType, - dimension = if (width != null && height != null) Dimension(width, height) else null + dimension = if (width != null && height != null) Dimension(width, height) else null, ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReadListDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReadListDao.kt index 580be133a..eb7117a50 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReadListDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReadListDao.kt @@ -76,7 +76,7 @@ class ReadListDao( items, if (pageable.isPaged) PageRequest.of(pageable.pageNumber, pageable.pageSize, pageSort) else PageRequest.of(0, maxOf(count.toInt(), 20), pageSort), - count + count, ) } @@ -115,7 +115,7 @@ class ReadListDao( items, if (pageable.isPaged) PageRequest.of(pageable.pageNumber, pageable.pageSize, pageSort) else PageRequest.of(0, maxOf(count, 20), pageSort), - count.toLong() + count.toLong(), ) } @@ -139,8 +139,8 @@ class ReadListDao( dsl.select(rl.ID) .from(rl) .leftJoin(rlb).on(rl.ID.eq(rlb.READLIST_ID)) - .where(rlb.READLIST_ID.isNull) - ) + .where(rlb.READLIST_ID.isNull), + ), ).fetchInto(rl) .map { it.toDomain(sortedMapOf()) } @@ -244,7 +244,7 @@ class ReadListDao( override fun existsByName(name: String): Boolean = dsl.fetchExists( dsl.selectFrom(rl) - .where(rl.NAME.equalIgnoreCase(name)) + .where(rl.NAME.equalIgnoreCase(name)), ) private fun ReadlistRecord.toDomain(bookIds: SortedMap) = @@ -255,6 +255,6 @@ class ReadListDao( id = id, createdDate = createdDate.toCurrentTimeZone(), lastModifiedDate = lastModifiedDate.toCurrentTimeZone(), - filtered = bookCount != bookIds.size + filtered = bookCount != bookIds.size, ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReadProgressDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReadProgressDao.kt index 78808e82f..b575fd1e3 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReadProgressDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReadProgressDao.kt @@ -160,7 +160,7 @@ class ReadProgressDao( .innerJoin(r).on(b.ID.eq(r.BOOK_ID)) .where(b.SERIES_ID.`in`(seriesIdsQuery)) .apply { userId?.let { and(r.USER_ID.eq(it)) } } - .groupBy(b.SERIES_ID, r.USER_ID) + .groupBy(b.SERIES_ID, r.USER_ID), ).execute() } @@ -172,6 +172,6 @@ class ReadProgressDao( completed = completed, readDate = readDate.toCurrentTimeZone(), createdDate = createdDate.toCurrentTimeZone(), - lastModifiedDate = lastModifiedDate.toCurrentTimeZone() + lastModifiedDate = lastModifiedDate.toCurrentTimeZone(), ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReadProgressDtoDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReadProgressDtoDao.kt index 23eac402b..fa2cfac49 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReadProgressDtoDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReadProgressDtoDao.kt @@ -15,7 +15,7 @@ import java.math.BigDecimal @Component class ReadProgressDtoDao( - private val dsl: DSLContext + private val dsl: DSLContext, ) : ReadProgressDtoRepository { private val rlb = Tables.READLIST_BOOK diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReferentialDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReferentialDao.kt index 314389b43..61ccfae52 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReferentialDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ReferentialDao.kt @@ -20,7 +20,7 @@ import java.time.LocalDate @Component class ReferentialDao( - private val dsl: DSLContext + private val dsl: DSLContext, ) : ReferentialRepository { private val a = Tables.BOOK_METADATA_AUTHOR @@ -151,7 +151,7 @@ class ReferentialDao( items, if (pageable.isPaged) PageRequest.of(pageable.pageNumber, pageable.pageSize, pageSort) else PageRequest.of(0, maxOf(count, 20), pageSort), - count.toLong() + count.toLong(), ) } @@ -214,7 +214,7 @@ class ReferentialDao( .union( select(st.TAG.`as`("tag")) .from(st) - .apply { filterOnLibraryIds?.let { leftJoin(s).on(st.SERIES_ID.eq(s.ID)).where(s.LIBRARY_ID.`in`(it)) } } + .apply { filterOnLibraryIds?.let { leftJoin(s).on(st.SERIES_ID.eq(s.ID)).where(s.LIBRARY_ID.`in`(it)) } }, ) .fetchSet(0, String::class.java) .sortedBy { it.stripAccents().lowercase() } @@ -231,7 +231,7 @@ class ReferentialDao( .from(st) .leftJoin(s).on(st.SERIES_ID.eq(s.ID)) .where(s.LIBRARY_ID.eq(libraryId)) - .apply { filterOnLibraryIds?.let { and(s.LIBRARY_ID.`in`(it)) } } + .apply { filterOnLibraryIds?.let { and(s.LIBRARY_ID.`in`(it)) } }, ) .fetchSet(0, String::class.java) .sortedBy { it.stripAccents().lowercase() } @@ -250,7 +250,7 @@ class ReferentialDao( .leftJoin(cs).on(st.SERIES_ID.eq(cs.SERIES_ID)) .leftJoin(s).on(st.SERIES_ID.eq(s.ID)) .where(cs.COLLECTION_ID.eq(collectionId)) - .apply { filterOnLibraryIds?.let { and(s.LIBRARY_ID.`in`(it)) } } + .apply { filterOnLibraryIds?.let { and(s.LIBRARY_ID.`in`(it)) } }, ) .fetchSet(0, String::class.java) .sortedBy { it.stripAccents().lowercase() } @@ -377,7 +377,7 @@ class ReferentialDao( items, if (pageable.isPaged) PageRequest.of(pageable.pageNumber, pageable.pageSize, pageSort) else PageRequest.of(0, maxOf(count, 20), pageSort), - count.toLong() + count.toLong(), ) } @@ -466,12 +466,12 @@ class ReferentialDao( private fun BookMetadataAuthorRecord.toDomain(): Author = Author( name = name, - role = role + role = role, ) private fun BookMetadataAggregationAuthorRecord.toDomain(): Author = Author( name = name, - role = role + role = role, ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesCollectionDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesCollectionDao.kt index d06a2b72f..d6bad86ef 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesCollectionDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesCollectionDao.kt @@ -75,7 +75,7 @@ class SeriesCollectionDao( items, if (pageable.isPaged) PageRequest.of(pageable.pageNumber, pageable.pageSize, pageSort) else PageRequest.of(0, maxOf(count.toInt(), 20), pageSort), - count + count, ) } @@ -114,7 +114,7 @@ class SeriesCollectionDao( items, if (pageable.isPaged) PageRequest.of(pageable.pageNumber, pageable.pageSize, pageSort) else PageRequest.of(0, maxOf(count, 20), pageSort), - count.toLong() + count.toLong(), ) } @@ -138,8 +138,8 @@ class SeriesCollectionDao( dsl.select(c.ID) .from(c) .leftJoin(cs).on(c.ID.eq(cs.COLLECTION_ID)) - .where(cs.COLLECTION_ID.isNull) - ) + .where(cs.COLLECTION_ID.isNull), + ), ).fetchInto(c) .map { it.toDomain(emptyList()) } @@ -244,7 +244,7 @@ class SeriesCollectionDao( override fun existsByName(name: String): Boolean = dsl.fetchExists( dsl.selectFrom(c) - .where(c.NAME.equalIgnoreCase(name)) + .where(c.NAME.equalIgnoreCase(name)), ) private fun CollectionRecord.toDomain(seriesIds: List) = @@ -255,6 +255,6 @@ class SeriesCollectionDao( id = id, createdDate = createdDate.toCurrentTimeZone(), lastModifiedDate = lastModifiedDate.toCurrentTimeZone(), - filtered = seriesCount != seriesIds.size + filtered = seriesCount != seriesIds.size, ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDao.kt index ce4b38c81..7f54d1266 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDao.kt @@ -165,6 +165,6 @@ class SeriesDao( bookCount = bookCount, deletedDate = deletedDate, createdDate = createdDate.toCurrentTimeZone(), - lastModifiedDate = lastModifiedDate.toCurrentTimeZone() + lastModifiedDate = lastModifiedDate.toCurrentTimeZone(), ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesMetadataDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesMetadataDao.kt index 0fa81d1e7..129b1f73b 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesMetadataDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/SeriesMetadataDao.kt @@ -122,7 +122,7 @@ class SeriesMetadataDao( metadata.genres.chunked(batchSize).forEach { chunk -> dsl.batch( dsl.insertInto(g, g.SERIES_ID, g.GENRE) - .values(null as String?, null) + .values(null as String?, null), ).also { step -> chunk.forEach { step.bind(metadata.seriesId, it) @@ -137,7 +137,7 @@ class SeriesMetadataDao( metadata.tags.chunked(batchSize).forEach { chunk -> dsl.batch( dsl.insertInto(st, st.SERIES_ID, st.TAG) - .values(null as String?, null) + .values(null as String?, null), ).also { step -> chunk.forEach { step.bind(metadata.seriesId, it) @@ -196,6 +196,6 @@ class SeriesMetadataDao( seriesId = seriesId, createdDate = createdDate.toCurrentTimeZone(), - lastModifiedDate = lastModifiedDate.toCurrentTimeZone() + lastModifiedDate = lastModifiedDate.toCurrentTimeZone(), ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ThumbnailBookDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ThumbnailBookDao.kt index 66cb65928..4e4eaf4d5 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ThumbnailBookDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ThumbnailBookDao.kt @@ -113,6 +113,6 @@ class ThumbnailBookDao( id = id, bookId = bookId, createdDate = createdDate, - lastModifiedDate = lastModifiedDate + lastModifiedDate = lastModifiedDate, ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ThumbnailReadListDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ThumbnailReadListDao.kt index 7661c7a84..da0a93659 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ThumbnailReadListDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ThumbnailReadListDao.kt @@ -10,7 +10,7 @@ import org.springframework.transaction.annotation.Transactional @Component class ThumbnailReadListDao( - private val dsl: DSLContext + private val dsl: DSLContext, ) : ThumbnailReadListRepository { private val tr = Tables.THUMBNAIL_READLIST @@ -90,6 +90,6 @@ class ThumbnailReadListDao( id = id, readListId = readlistId, createdDate = createdDate, - lastModifiedDate = lastModifiedDate + lastModifiedDate = lastModifiedDate, ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ThumbnailSeriesCollectionDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ThumbnailSeriesCollectionDao.kt index 785ee90b9..7d1683265 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ThumbnailSeriesCollectionDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ThumbnailSeriesCollectionDao.kt @@ -10,7 +10,7 @@ import org.springframework.transaction.annotation.Transactional @Component class ThumbnailSeriesCollectionDao( - private val dsl: DSLContext + private val dsl: DSLContext, ) : ThumbnailSeriesCollectionRepository { private val tc = Tables.THUMBNAIL_COLLECTION @@ -90,6 +90,6 @@ class ThumbnailSeriesCollectionDao( id = id, collectionId = collectionId, createdDate = createdDate, - lastModifiedDate = lastModifiedDate + lastModifiedDate = lastModifiedDate, ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ThumbnailSeriesDao.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ThumbnailSeriesDao.kt index e4f533cf4..fcb1ab039 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ThumbnailSeriesDao.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/ThumbnailSeriesDao.kt @@ -95,6 +95,6 @@ class ThumbnailSeriesDao( id = id, seriesId = seriesId, createdDate = createdDate, - lastModifiedDate = lastModifiedDate + lastModifiedDate = lastModifiedDate, ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/UnpagedSorted.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/UnpagedSorted.kt index 88aa5fbc8..fc2dadd28 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/UnpagedSorted.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/UnpagedSorted.kt @@ -4,7 +4,7 @@ import org.springframework.data.domain.Pageable import org.springframework.data.domain.Sort class UnpagedSorted( - private val sort: Sort + private val sort: Sort, ) : Pageable { override fun getPageNumber(): Int { diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/Utils.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/Utils.kt index 71019d6de..cde2683e6 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/Utils.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/Utils.kt @@ -52,7 +52,7 @@ fun DSLContext.insertTempStrings(batchSize: Int, collection: Collection) if (collection.isNotEmpty()) { collection.chunked(batchSize).forEach { chunk -> this.batch( - this.insertInto(Tables.TEMP_STRING_LIST, Tables.TEMP_STRING_LIST.STRING).values(null as String?) + this.insertInto(Tables.TEMP_STRING_LIST, Tables.TEMP_STRING_LIST.STRING).values(null as String?), ).also { step -> chunk.forEach { step.bind(it) diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/ContentDetector.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/ContentDetector.kt index c444d1cac..8b9a9e1d6 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/ContentDetector.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/ContentDetector.kt @@ -13,7 +13,7 @@ private val logger = KotlinLogging.logger {} @Service class ContentDetector( - private val tika: TikaConfig + private val tika: TikaConfig, ) { fun detectMediaType(path: Path): String { diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/EpubExtractor.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/EpubExtractor.kt index 1d8bfdea1..6827c7fef 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/EpubExtractor.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/EpubExtractor.kt @@ -17,7 +17,7 @@ private val logger = KotlinLogging.logger {} class EpubExtractor( private val zipExtractor: ZipExtractor, private val contentDetector: ContentDetector, - private val imageAnalyzer: ImageAnalyzer + private val imageAnalyzer: ImageAnalyzer, ) : MediaContainerExtractor { override fun mediaTypes(): List = listOf("application/epub+zip") @@ -94,6 +94,6 @@ class EpubExtractor( private data class ManifestItem( val id: String, val href: String, - val mediaType: String + val mediaType: String, ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/PdfExtractor.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/PdfExtractor.kt index d541d4aeb..1f0240c16 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/PdfExtractor.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/PdfExtractor.kt @@ -20,7 +20,7 @@ private val logger = KotlinLogging.logger {} @Service class PdfExtractor( - private val imageAnalyzer: ImageAnalyzer + private val imageAnalyzer: ImageAnalyzer, ) : MediaContainerExtractor { private val mediaType = "image/jpeg" diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/RarExtractor.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/RarExtractor.kt index 92d3f12ec..085484a16 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/RarExtractor.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/RarExtractor.kt @@ -14,7 +14,7 @@ private val logger = KotlinLogging.logger {} @Service class RarExtractor( private val contentDetector: ContentDetector, - private val imageAnalyzer: ImageAnalyzer + private val imageAnalyzer: ImageAnalyzer, ) : MediaContainerExtractor { private val natSortComparator: Comparator = CaseInsensitiveSimpleNaturalComparator.getInstance() diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/ZipExtractor.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/ZipExtractor.kt index 8e080e2e9..b84b412c4 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/ZipExtractor.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/mediacontainer/ZipExtractor.kt @@ -15,7 +15,7 @@ private val logger = KotlinLogging.logger {} @Service class ZipExtractor( private val contentDetector: ContentDetector, - private val imageAnalyzer: ImageAnalyzer + private val imageAnalyzer: ImageAnalyzer, ) : MediaContainerExtractor { private val cache = Caffeine.newBuilder() diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/metadata/barcode/IsbnBarcodeProvider.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/metadata/barcode/IsbnBarcodeProvider.kt index ca97cf9bb..b78bed56d 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/metadata/barcode/IsbnBarcodeProvider.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/metadata/barcode/IsbnBarcodeProvider.kt @@ -25,12 +25,12 @@ private const val PAGES_FIRST = 3 @Service class IsbnBarcodeProvider( private val bookAnalyzer: BookAnalyzer, - private val validator: ISBNValidator + private val validator: ISBNValidator, ) : BookMetadataProvider { private val hints = mapOf( DecodeHintType.POSSIBLE_FORMATS to EnumSet.of(BarcodeFormat.EAN_13), - DecodeHintType.TRY_HARDER to true + DecodeHintType.TRY_HARDER to true, ) override fun getCapabilities(): Set = diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/metadata/localartwork/LocalArtworkProvider.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/metadata/localartwork/LocalArtworkProvider.kt index 83120ada6..2abb1e9a5 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/metadata/localartwork/LocalArtworkProvider.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/metadata/localartwork/LocalArtworkProvider.kt @@ -20,7 +20,7 @@ private val logger = KotlinLogging.logger {} @Service class LocalArtworkProvider( - private val contentDetector: ContentDetector + private val contentDetector: ContentDetector, ) : SidecarSeriesConsumer, SidecarBookConsumer { val supportedExtensions = listOf("png", "jpeg", "jpg", "tbn") @@ -45,7 +45,7 @@ class LocalArtworkProvider( url = path.toUri().toURL(), type = ThumbnailBook.Type.SIDECAR, bookId = book.id, - selected = index == 0 + selected = index == 0, ) }.toList() } @@ -66,7 +66,7 @@ class LocalArtworkProvider( url = path.toUri().toURL(), seriesId = series.id, selected = index == 0, - type = ThumbnailSeries.Type.SIDECAR + type = ThumbnailSeries.Type.SIDECAR, ) }.toList() } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/metadata/mylar/dto/MylarMetadata.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/metadata/mylar/dto/MylarMetadata.kt index e4d775f05..9cda23275 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/metadata/mylar/dto/MylarMetadata.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/metadata/mylar/dto/MylarMetadata.kt @@ -41,5 +41,5 @@ data class MylarMetadata( @field:JsonProperty("publication_run") val publicationRun: String, - val status: Status + val status: Status, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/metadata/mylar/dto/Series.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/metadata/mylar/dto/Series.kt index 327564761..99d80ba48 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/metadata/mylar/dto/Series.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/metadata/mylar/dto/Series.kt @@ -4,5 +4,5 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties @JsonIgnoreProperties(ignoreUnknown = true) data class Series( - val metadata: MylarMetadata + val metadata: MylarMetadata, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/security/CorsConfiguration.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/security/CorsConfiguration.kt index 3c50fe8aa..e005e47c0 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/security/CorsConfiguration.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/security/CorsConfiguration.kt @@ -32,7 +32,7 @@ class CorsConfiguration { allowCredentials = true addExposedHeader(HttpHeaders.CONTENT_DISPOSITION) addExposedHeader(sessionHeaderName) - } + }, ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/security/LoginListener.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/security/LoginListener.kt index 12ef937db..8f5403e83 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/security/LoginListener.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/security/LoginListener.kt @@ -38,7 +38,7 @@ class LoginListener( ip = event.getIp(), userAgent = event.getUserAgent(), success = true, - source = source + source = source, ) logger.info { activity } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/security/SecurityConfiguration.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/security/SecurityConfiguration.kt index 1cfa66df8..7b450642d 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/security/SecurityConfiguration.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/security/SecurityConfiguration.kt @@ -57,7 +57,7 @@ class SecurityConfiguration( it.mvcMatchers( "/api/**", "/opds/**", - "/sse/**" + "/sse/**", ).hasRole(ROLE_USER) } .headers { @@ -102,7 +102,7 @@ class SecurityConfiguration( setTokenValiditySeconds(komgaProperties.rememberMe.validity.seconds.toInt()) setAlwaysRemember(true) setAuthenticationDetailsSource(userAgentWebAuthenticationDetailsSource) - } + }, ) } } @@ -125,7 +125,7 @@ class SecurityConfiguration( "/android-chrome-512x512.png", "/manifest.json", "/", - "/index.html" + "/index.html", ) } } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/security/oauth2/GithubOAuth2UserService.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/security/oauth2/GithubOAuth2UserService.kt index e9dbcee05..71787bcb0 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/security/oauth2/GithubOAuth2UserService.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/security/oauth2/GithubOAuth2UserService.kt @@ -32,7 +32,7 @@ class GithubOAuth2UserService : DefaultOAuth2UserService() { RequestEntity( HttpHeaders().apply { setBearerAuth(userRequest.accessToken.tokenValue) }, HttpMethod.GET, - UriComponentsBuilder.fromUriString("${userRequest.clientRegistration.providerDetails.userInfoEndpoint.uri}/emails").build().toUri() + UriComponentsBuilder.fromUriString("${userRequest.clientRegistration.providerDetails.userInfoEndpoint.uri}/emails").build().toUri(), ), parameterizedResponseType, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/swagger/AuthorsAsQueryParam.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/swagger/AuthorsAsQueryParam.kt index 0ecbb64ed..5a189926e 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/swagger/AuthorsAsQueryParam.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/swagger/AuthorsAsQueryParam.kt @@ -10,7 +10,7 @@ import io.swagger.v3.oas.annotations.media.Schema @Parameters( Parameter( description = "Author criteria in the format: name,role. Multiple author criteria are supported.", - `in` = ParameterIn.QUERY, name = "author", array = ArraySchema(schema = Schema(type = "string")) - ) + `in` = ParameterIn.QUERY, name = "author", array = ArraySchema(schema = Schema(type = "string")), + ), ) annotation class AuthorsAsQueryParam diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/swagger/PageableAnnotations.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/swagger/PageableAnnotations.kt index 38191503c..b16aab88c 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/swagger/PageableAnnotations.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/swagger/PageableAnnotations.kt @@ -11,7 +11,7 @@ import io.swagger.v3.oas.annotations.media.Schema description = "Zero-based page index (0..N)", `in` = ParameterIn.QUERY, name = "page", - schema = Schema(type = "integer") + schema = Schema(type = "integer"), ) annotation class PageAsQueryParam @@ -21,14 +21,14 @@ annotation class PageAsQueryParam description = "Zero-based page index (0..N)", `in` = ParameterIn.QUERY, name = "page", - schema = Schema(type = "integer") + schema = Schema(type = "integer"), ), Parameter( description = "The size of the page to be returned", `in` = ParameterIn.QUERY, name = "size", - schema = Schema(type = "integer") - ) + schema = Schema(type = "integer"), + ), ) annotation class PageableWithoutSortAsQueryParam @@ -38,17 +38,17 @@ annotation class PageableWithoutSortAsQueryParam description = "Zero-based page index (0..N)", `in` = ParameterIn.QUERY, name = "page", - schema = Schema(type = "integer") + schema = Schema(type = "integer"), ), Parameter( description = "The size of the page to be returned", `in` = ParameterIn.QUERY, name = "size", - schema = Schema(type = "integer") + schema = Schema(type = "integer"), ), Parameter( description = "Sorting criteria in the format: property(,asc|desc). Default sort order is ascending. Multiple sort criteria are supported.", - `in` = ParameterIn.QUERY, name = "sort", array = ArraySchema(schema = Schema(type = "string")) - ) + `in` = ParameterIn.QUERY, name = "sort", array = ArraySchema(schema = Schema(type = "string")), + ), ) annotation class PageableAsQueryParam diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/swagger/SwaggerConfiguration.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/swagger/SwaggerConfiguration.kt index b5c21439c..cd3f770be 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/swagger/SwaggerConfiguration.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/swagger/SwaggerConfiguration.kt @@ -24,20 +24,20 @@ class SwaggerConfiguration { Komga offers 2 APIs: REST and OPDS. Both APIs are secured using HTTP Basic Authentication. - """.trimIndent() + """.trimIndent(), ) - .license(License().name("MIT").url("https://github.com/gotson/komga/blob/master/LICENSE")) + .license(License().name("MIT").url("https://github.com/gotson/komga/blob/master/LICENSE")), ) .externalDocs( ExternalDocumentation() .description("Komga documentation") - .url("https://komga.org") + .url("https://komga.org"), ) .components( Components() .addSecuritySchemes( "basicAuth", - SecurityScheme().type(SecurityScheme.Type.HTTP).scheme("basic") - ) + SecurityScheme().type(SecurityScheme.Type.HTTP).scheme("basic"), + ), ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/BCP47.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/BCP47.kt index 3676448d1..0cddd4eb1 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/BCP47.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/BCP47.kt @@ -12,7 +12,7 @@ import kotlin.reflect.KClass annotation class BCP47( val message: String = "Must be a valid BCP 47 language tag", val groups: Array> = [], - val payload: Array> = [] + val payload: Array> = [], ) class BCP47Validator : ConstraintValidator { diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/Blank.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/Blank.kt index d8f8be0e2..a47ec369e 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/Blank.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/Blank.kt @@ -11,7 +11,7 @@ import kotlin.reflect.KClass annotation class Blank( val message: String = "Must be blank", val groups: Array> = [], - val payload: Array> = [] + val payload: Array> = [], ) class BlankValidator : ConstraintValidator { diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/NullOrBlankOrBCP47.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/NullOrBlankOrBCP47.kt index 49a0e0068..6c2112c20 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/NullOrBlankOrBCP47.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/NullOrBlankOrBCP47.kt @@ -16,5 +16,5 @@ import kotlin.reflect.KClass annotation class NullOrBlankOrBCP47( val message: String = "Must be null or blank or valid BCP 47 language tag", val groups: Array> = [], - val payload: Array> = [] + val payload: Array> = [], ) diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/NullOrBlankOrISBN.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/NullOrBlankOrISBN.kt index 9a19f0078..028a1df29 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/NullOrBlankOrISBN.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/NullOrBlankOrISBN.kt @@ -17,5 +17,5 @@ import kotlin.reflect.KClass annotation class NullOrBlankOrISBN( val message: String = "Must be null or blank or valid ISBN-13", val groups: Array> = [], - val payload: Array> = [] + val payload: Array> = [], ) diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/NullOrNotBlank.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/NullOrNotBlank.kt index 2f43ec627..7b883e214 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/NullOrNotBlank.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/NullOrNotBlank.kt @@ -16,5 +16,5 @@ import kotlin.reflect.KClass annotation class NullOrNotBlank( val message: String = "Must be null or not blank", val groups: Array> = [], - val payload: Array> = [] + val payload: Array> = [], ) diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/NullOrNotEmpty.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/NullOrNotEmpty.kt index c66e7487d..1551cc02b 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/NullOrNotEmpty.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/validation/NullOrNotEmpty.kt @@ -16,5 +16,5 @@ import kotlin.reflect.KClass annotation class NullOrNotEmpty( val message: String = "Must be null or not empty", val groups: Array> = [], - val payload: Array> = [] + val payload: Array> = [], ) diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/AuthorsHandlerMethodArgumentResolver.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/AuthorsHandlerMethodArgumentResolver.kt index 149f02553..3134edba8 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/AuthorsHandlerMethodArgumentResolver.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/AuthorsHandlerMethodArgumentResolver.kt @@ -15,7 +15,7 @@ class AuthorsHandlerMethodArgumentResolver : HandlerMethodArgumentResolver { parameter: MethodParameter, mavContainer: ModelAndViewContainer?, webRequest: NativeWebRequest, - binderFactory: WebDataBinderFactory? + binderFactory: WebDataBinderFactory?, ): Any? { val param = webRequest.getParameterValues("author") ?: return null diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/BracketParamsFilterConfiguration.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/BracketParamsFilterConfiguration.kt index 7a0e34269..505194623 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/BracketParamsFilterConfiguration.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/BracketParamsFilterConfiguration.kt @@ -16,7 +16,7 @@ class BracketParamsFilterConfiguration { FilterRegistrationBean(BracketParamsFilter()) .also { it.addUrlPatterns( - "/api/*" + "/api/*", ) it.setName("queryParamsFilter") } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/DelimitedPair.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/DelimitedPair.kt index 71e67171c..ae7f93252 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/DelimitedPair.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/DelimitedPair.kt @@ -3,5 +3,5 @@ package org.gotson.komga.infrastructure.web @Retention(AnnotationRetention.RUNTIME) @Target(AnnotationTarget.VALUE_PARAMETER) annotation class DelimitedPair( - val parameterName: String + val parameterName: String, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/DelimitedPairHandlerMethodArgumentResolver.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/DelimitedPairHandlerMethodArgumentResolver.kt index 0b2ab6217..3c62c3e46 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/DelimitedPairHandlerMethodArgumentResolver.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/DelimitedPairHandlerMethodArgumentResolver.kt @@ -14,7 +14,7 @@ class DelimitedPairHandlerMethodArgumentResolver : HandlerMethodArgumentResolver parameter: MethodParameter, mavContainer: ModelAndViewContainer?, webRequest: NativeWebRequest, - binderFactory: WebDataBinderFactory? + binderFactory: WebDataBinderFactory?, ): Pair? { val paramName = parameter.getParameterAnnotation(DelimitedPair::class.java)?.parameterName ?: return null val param = webRequest.getParameterValues(paramName) ?: return null diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/EtagFilterConfiguration.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/EtagFilterConfiguration.kt index d7baf59ce..86f99f8ff 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/EtagFilterConfiguration.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/EtagFilterConfiguration.kt @@ -13,7 +13,7 @@ class EtagFilterConfiguration { .also { it.addUrlPatterns( "/api/*", - "/opds/*" + "/opds/*", ) it.setName("etagFilter") } diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/WebMvcConfiguration.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/WebMvcConfiguration.kt index b681c66ba..100fbe287 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/WebMvcConfiguration.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/web/WebMvcConfiguration.kt @@ -38,7 +38,7 @@ class WebMvcConfiguration : WebMvcConfigurer { "/apple-touch-icon-180x180.png", "/android-chrome-192x192.png", "/android-chrome-512x512.png", - "/manifest.json" + "/manifest.json", ) .addResourceLocations( "classpath:public/index.html", @@ -50,7 +50,7 @@ class WebMvcConfiguration : WebMvcConfigurer { "classpath:public/apple-touch-icon-180x180.png", "classpath:public/android-chrome-192x192.png", "classpath:public/android-chrome-512x512.png", - "classpath:public/manifest.json" + "classpath:public/manifest.json", ) .setCacheControl(CacheControl.noStore()) @@ -59,13 +59,13 @@ class WebMvcConfiguration : WebMvcConfigurer { "/css/**", "/fonts/**", "/img/**", - "/js/**" + "/js/**", ) .addResourceLocations( "classpath:public/css/", "classpath:public/fonts/", "classpath:public/img/", - "classpath:public/js/" + "classpath:public/js/", ) .setCacheControl(CacheControl.maxAge(365, TimeUnit.DAYS).cachePublic()) } @@ -75,9 +75,9 @@ class WebMvcConfiguration : WebMvcConfigurer { WebContentInterceptor().apply { addCacheMapping( cachePrivate, - "/api/**", "/opds/**" + "/api/**", "/opds/**", ) - } + }, ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/OpdsController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/OpdsController.kt index 29bf74867..c6fccecfc 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/OpdsController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/OpdsController.kt @@ -97,7 +97,7 @@ class OpdsController( private val seriesDtoRepository: SeriesDtoRepository, private val bookDtoRepository: BookDtoRepository, private val mediaRepository: MediaRepository, - private val referentialRepository: ReferentialRepository + private val referentialRepository: ReferentialRepository, ) { private val routeBase = "${servletContext.contextPath}$ROUTE_BASE" @@ -121,12 +121,12 @@ class OpdsController( return listOfNotNull( if (!page.isFirst) OpdsLinkFeedNavigation( OpdsLinkRel.PREVIOUS, - pageBuilder.expand(mapOf("page" to page.pageable.previousOrFirst().pageNumber)).toUriString() + pageBuilder.expand(mapOf("page" to page.pageable.previousOrFirst().pageNumber)).toUriString(), ) else null, if (!page.isLast) OpdsLinkFeedNavigation( OpdsLinkRel.NEXT, - pageBuilder.expand(mapOf("page" to page.pageable.next().pageNumber)).toUriString() + pageBuilder.expand(mapOf("page" to page.pageable.next().pageNumber)).toUriString(), ) else null, ) @@ -206,8 +206,8 @@ class OpdsController( id = ID_PUBLISHERS_ALL, content = "Browse by publishers", link = OpdsLinkFeedNavigation(OpdsLinkRel.SUBSECTION, uriBuilder(ROUTE_PUBLISHERS_ALL).toUriString()), - ) - ) + ), + ), ) @GetMapping(ROUTE_SEARCH) @@ -404,7 +404,7 @@ class OpdsController( OpdsLinkFeedNavigation(OpdsLinkRel.SELF, uriBuilder(ROUTE_LIBRARIES_ALL).toUriString()), linkStart, ), - entries = libraries.map { it.toOpdsEntry() } + entries = libraries.map { it.toOpdsEntry() }, ) } @@ -434,7 +434,7 @@ class OpdsController( linkStart, *linkPage(uriBuilder, collections).toTypedArray(), ), - entries = collections.content.map { it.toOpdsEntry() } + entries = collections.content.map { it.toOpdsEntry() }, ) } @@ -464,7 +464,7 @@ class OpdsController( linkStart, *linkPage(uriBuilder, readLists).toTypedArray(), ), - entries = readLists.content.map { it.toOpdsEntry() } + entries = readLists.content.map { it.toOpdsEntry() }, ) } @@ -496,7 +496,7 @@ class OpdsController( content = "", link = OpdsLinkFeedNavigation(OpdsLinkRel.SUBSECTION, uriBuilder(ROUTE_SERIES_ALL).queryParam("publisher", publisher).toUriString()), ) - } + }, ) } @@ -569,7 +569,7 @@ class OpdsController( linkStart, *linkPage(uriBuilder, entries).toTypedArray(), ), - entries = entries.content + entries = entries.content, ) } ?: throw ResponseStatusException(HttpStatus.NOT_FOUND) @@ -609,7 +609,7 @@ class OpdsController( linkStart, *linkPage(uriBuilder, entries).toTypedArray(), ), - entries = entries.content + entries = entries.content, ) } ?: throw ResponseStatusException(HttpStatus.NOT_FOUND) @@ -653,7 +653,7 @@ class OpdsController( linkStart, *linkPage(uriBuilder, booksPage).toTypedArray(), ), - entries = entries.content + entries = entries.content, ) } ?: throw ResponseStatusException(HttpStatus.NOT_FOUND) @@ -694,7 +694,7 @@ class OpdsController( OpdsLinkImage(media.pages[0].mediaType, uriBuilder("books/$id/pages/1").toUriString()), OpdsLinkFileAcquisition(media.mediaType, uriBuilder("books/$id/file/${sanitize(FilenameUtils.getName(url))}").toUriString()), opdsLinkPageStreaming, - ) + ), ) } @@ -704,7 +704,7 @@ class OpdsController( updated = lastModifiedDate.atZone(ZoneId.systemDefault()) ?: ZonedDateTime.now(), id = id, content = "", - link = OpdsLinkFeedNavigation(OpdsLinkRel.SUBSECTION, uriBuilder("libraries/$id").toUriString()) + link = OpdsLinkFeedNavigation(OpdsLinkRel.SUBSECTION, uriBuilder("libraries/$id").toUriString()), ) private fun SeriesCollection.toOpdsEntry(): OpdsEntryNavigation = @@ -713,7 +713,7 @@ class OpdsController( updated = lastModifiedDate.atZone(ZoneId.systemDefault()) ?: ZonedDateTime.now(), id = id, content = "", - link = OpdsLinkFeedNavigation(OpdsLinkRel.SUBSECTION, uriBuilder("collections/$id").toUriString()) + link = OpdsLinkFeedNavigation(OpdsLinkRel.SUBSECTION, uriBuilder("collections/$id").toUriString()), ) private fun ReadList.toOpdsEntry(): OpdsEntryNavigation = @@ -722,7 +722,7 @@ class OpdsController( updated = lastModifiedDate.atZone(ZoneId.systemDefault()) ?: ZonedDateTime.now(), id = id, content = "", - link = OpdsLinkFeedNavigation(OpdsLinkRel.SUBSECTION, uriBuilder("readlists/$id").toUriString()) + link = OpdsLinkFeedNavigation(OpdsLinkRel.SUBSECTION, uriBuilder("readlists/$id").toUriString()), ) private fun shouldPrependBookNumbers(userAgent: String) = diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpdsAuthor.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpdsAuthor.kt index 9b013d303..647c56ee9 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpdsAuthor.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpdsAuthor.kt @@ -10,5 +10,5 @@ data class OpdsAuthor( @JsonInclude(JsonInclude.Include.NON_NULL) @JacksonXmlProperty(namespace = ATOM) - val uri: URI? = null + val uri: URI? = null, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpdsEntry.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpdsEntry.kt index 674099ec0..a1e78b643 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpdsEntry.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpdsEntry.kt @@ -16,7 +16,7 @@ abstract class OpdsEntry( @get:JacksonXmlProperty(namespace = ATOM) val id: String, - content: String + content: String, ) { @get:JacksonXmlProperty(namespace = ATOM) val content: String = content.replace("\n", "
") @@ -29,7 +29,7 @@ class OpdsEntryNavigation( content: String, @JacksonXmlProperty(namespace = ATOM) - val link: OpdsLink + val link: OpdsLink, ) : OpdsEntry(title, updated, id, content) class OpdsEntryAcquisition( @@ -44,5 +44,5 @@ class OpdsEntryAcquisition( @JacksonXmlElementWrapper(useWrapping = false) @JacksonXmlProperty(localName = "link", namespace = ATOM) - val links: List + val links: List, ) : OpdsEntry(title, updated, id, content) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpdsFeed.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpdsFeed.kt index 6efd932d7..976c81cfe 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpdsFeed.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpdsFeed.kt @@ -26,7 +26,7 @@ abstract class OpdsFeed( @JacksonXmlElementWrapper(useWrapping = false) @JacksonXmlProperty(localName = "entry", namespace = ATOM) - val entries: List + val entries: List, ) @JsonSerialize(`as` = OpdsFeed::class) @@ -36,7 +36,7 @@ class OpdsFeedNavigation( updated: ZonedDateTime, author: OpdsAuthor, links: List, - entries: List + entries: List, ) : OpdsFeed(id, title, updated, author, links, entries) @JsonSerialize(`as` = OpdsFeed::class) @@ -46,5 +46,5 @@ class OpdsFeedAcquisition( updated: ZonedDateTime, author: OpdsAuthor, links: List, - entries: List + entries: List, ) : OpdsFeed(id, title, updated, author, links, entries) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpdsLink.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpdsLink.kt index da5c29941..5b665a0de 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpdsLink.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpdsLink.kt @@ -11,49 +11,49 @@ open class OpdsLink( val rel: String, @get:JacksonXmlProperty(isAttribute = true) - val href: String + val href: String, ) @JsonSerialize(`as` = OpdsLink::class) class OpdsLinkFeedNavigation(rel: String, href: String) : OpdsLink( type = "application/atom+xml;profile=opds-catalog;kind=navigation", rel = rel, - href = href + href = href, ) @JsonSerialize(`as` = OpdsLink::class) class OpdsLinkFeedAcquisition(rel: String, href: String) : OpdsLink( type = "application/atom+xml;profile=opds-catalog;kind=acquisition", rel = rel, - href = href + href = href, ) @JsonSerialize(`as` = OpdsLink::class) class OpdsLinkImage(mediaType: String, href: String) : OpdsLink( type = mediaType, rel = "http://opds-spec.org/image", - href = href + href = href, ) @JsonSerialize(`as` = OpdsLink::class) class OpdsLinkImageThumbnail(mediaType: String, href: String) : OpdsLink( type = mediaType, rel = "http://opds-spec.org/image/thumbnail", - href = href + href = href, ) @JsonSerialize(`as` = OpdsLink::class) class OpdsLinkFileAcquisition(mediaType: String?, href: String) : OpdsLink( type = mediaType ?: "application/octet-stream", rel = "http://opds-spec.org/acquisition", - href = href + href = href, ) @JsonSerialize(`as` = OpdsLink::class) class OpdsLinkSearch(href: String) : OpdsLink( type = "application/opensearchdescription+xml", rel = "search", - href = href + href = href, ) class OpdsLinkPageStreaming( @@ -68,7 +68,7 @@ class OpdsLinkPageStreaming( ) : OpdsLink( type = mediaType, rel = "http://vaemendis.net/opds-pse/stream", - href = href + href = href, ) class OpdsLinkRel { diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpenSearchDescription.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpenSearchDescription.kt index 4cbfcb814..eb5e29494 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpenSearchDescription.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/opds/dto/OpenSearchDescription.kt @@ -21,11 +21,11 @@ class OpenSearchDescription( val outputEncoding: String = "UTF-8", @JacksonXmlProperty(localName = "Url", namespace = OPENSEARCH) - val url: OpenSearchUrl + val url: OpenSearchUrl, ) { class OpenSearchUrl( @JacksonXmlProperty(isAttribute = true) - val template: String + val template: String, ) { @JacksonXmlProperty(isAttribute = true) val type = "application/atom+xml;profile=opds-catalog;kind=acquisition" diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/persistence/BookDtoRepository.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/persistence/BookDtoRepository.kt index 687880c5e..c9e85a0b1 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/persistence/BookDtoRepository.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/persistence/BookDtoRepository.kt @@ -28,14 +28,14 @@ interface BookDtoRepository { readListId: String, bookId: String, userId: String, - filterOnLibraryIds: Collection? + filterOnLibraryIds: Collection?, ): BookDto? fun findNextInReadListOrNull( readListId: String, bookId: String, userId: String, - filterOnLibraryIds: Collection? + filterOnLibraryIds: Collection?, ): BookDto? fun findAllOnDeck(userId: String, filterOnLibraryIds: Collection?, pageable: Pageable): Page diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/persistence/ReadProgressDtoRepository.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/persistence/ReadProgressDtoRepository.kt index f1a58ce76..8c8a00a8a 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/persistence/ReadProgressDtoRepository.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/persistence/ReadProgressDtoRepository.kt @@ -4,7 +4,7 @@ import org.gotson.komga.interfaces.api.rest.dto.TachiyomiReadProgressDto import org.gotson.komga.interfaces.api.rest.dto.TachiyomiReadProgressV2Dto interface ReadProgressDtoRepository { - fun findProgressBySeries(seriesId: String, userId: String,): TachiyomiReadProgressDto - fun findProgressV2BySeries(seriesId: String, userId: String,): TachiyomiReadProgressV2Dto - fun findProgressByReadList(readListId: String, userId: String,): TachiyomiReadProgressDto + fun findProgressBySeries(seriesId: String, userId: String): TachiyomiReadProgressDto + fun findProgressV2BySeries(seriesId: String, userId: String): TachiyomiReadProgressV2Dto + fun findProgressByReadList(readListId: String, userId: String): TachiyomiReadProgressDto } diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/ClaimController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/ClaimController.kt index 861ae3d95..7a90a78bf 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/ClaimController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/ClaimController.kt @@ -20,7 +20,7 @@ import javax.validation.constraints.NotBlank @RequestMapping("api/v1/claim", produces = [MediaType.APPLICATION_JSON_VALUE]) @Validated class ClaimController( - private val userDetailsLifecycle: KomgaUserLifecycle + private val userDetailsLifecycle: KomgaUserLifecycle, ) { @GetMapping @@ -29,7 +29,7 @@ class ClaimController( @PostMapping fun claimAdmin( @Email(regexp = ".+@.+\\..+") @RequestHeader("X-Komga-Email") email: String, - @NotBlank @RequestHeader("X-Komga-Password") password: String + @NotBlank @RequestHeader("X-Komga-Password") password: String, ): UserDto { if (userDetailsLifecycle.countUsers() > 0) throw ResponseStatusException(HttpStatus.BAD_REQUEST, "This server has already been claimed") @@ -38,12 +38,12 @@ class ClaimController( KomgaUser( email = email, password = password, - roleAdmin = true - ) + roleAdmin = true, + ), ).toDto() } data class ClaimStatus( - val isClaimed: Boolean + val isClaimed: Boolean, ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/ErrorHandlingControllerAdvice.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/ErrorHandlingControllerAdvice.kt index 0b3c63f8b..da1f583cd 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/ErrorHandlingControllerAdvice.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/ErrorHandlingControllerAdvice.kt @@ -14,28 +14,28 @@ class ErrorHandlingControllerAdvice { @ResponseStatus(HttpStatus.BAD_REQUEST) @ResponseBody fun onConstraintValidationException( - e: ConstraintViolationException + e: ConstraintViolationException, ): ValidationErrorResponse = ValidationErrorResponse( - e.constraintViolations.map { Violation(it.propertyPath.toString(), it.message) } + e.constraintViolations.map { Violation(it.propertyPath.toString(), it.message) }, ) @ExceptionHandler(MethodArgumentNotValidException::class) @ResponseStatus(HttpStatus.BAD_REQUEST) @ResponseBody fun onMethodArgumentNotValidException( - e: MethodArgumentNotValidException + e: MethodArgumentNotValidException, ): ValidationErrorResponse = ValidationErrorResponse( - e.bindingResult.fieldErrors.map { Violation(it.field, it.defaultMessage) } + e.bindingResult.fieldErrors.map { Violation(it.field, it.defaultMessage) }, ) } data class ValidationErrorResponse( - val violations: List = emptyList() + val violations: List = emptyList(), ) data class Violation( val fieldName: String? = null, - val message: String? = null + val message: String? = null, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/FileSystemController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/FileSystemController.kt index 6a6196484..f7c456728 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/FileSystemController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/FileSystemController.kt @@ -23,11 +23,11 @@ class FileSystemController { @PostMapping fun getDirectoryListing( - @RequestBody(required = false) request: DirectoryRequestDto = DirectoryRequestDto() + @RequestBody(required = false) request: DirectoryRequestDto = DirectoryRequestDto(), ): DirectoryListingDto = if (request.path.isEmpty()) { DirectoryListingDto( - directories = fs.rootDirectories.map { it.toDto() } + directories = fs.rootDirectories.map { it.toDto() }, ) } else { val p = fs.getPath(request.path) @@ -42,7 +42,7 @@ class FileSystemController { .sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.toString() }) .map { it.toDto() } .toList() - } + }, ) } catch (e: Exception) { throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Path does not exist") @@ -51,24 +51,24 @@ class FileSystemController { } data class DirectoryRequestDto( - val path: String = "" + val path: String = "", ) @JsonInclude(JsonInclude.Include.NON_NULL) data class DirectoryListingDto( val parent: String? = null, - val directories: List + val directories: List, ) data class PathDto( val type: String, val name: String, - val path: String + val path: String, ) fun Path.toDto(): PathDto = PathDto( type = if (Files.isDirectory(this)) "directory" else "file", name = (fileName ?: this).toString(), - path = toString() + path = toString(), ) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/LibraryController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/LibraryController.kt index a75b7e9bc..bf6d0a04b 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/LibraryController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/LibraryController.kt @@ -48,7 +48,7 @@ class LibraryController( @GetMapping fun getAll( - @AuthenticationPrincipal principal: KomgaPrincipal + @AuthenticationPrincipal principal: KomgaPrincipal, ): List = if (principal.user.sharedAllLibraries) { libraryRepository.findAll() @@ -59,7 +59,7 @@ class LibraryController( @GetMapping("{libraryId}") fun getOne( @AuthenticationPrincipal principal: KomgaPrincipal, - @PathVariable libraryId: String + @PathVariable libraryId: String, ): LibraryDto = libraryRepository.findByIdOrNull(libraryId)?.let { if (!principal.user.canAccessLibrary(it)) throw ResponseStatusException(HttpStatus.FORBIDDEN) @@ -70,7 +70,7 @@ class LibraryController( @PreAuthorize("hasRole('$ROLE_ADMIN')") fun addOne( @AuthenticationPrincipal principal: KomgaPrincipal, - @Valid @RequestBody library: LibraryCreationDto + @Valid @RequestBody library: LibraryCreationDto, ): LibraryDto = try { libraryLifecycle.addLibrary( @@ -92,14 +92,15 @@ class LibraryController( convertToCbz = library.convertToCbz, emptyTrashAfterScan = library.emptyTrashAfterScan, seriesCover = library.seriesCover.toDomain(), - ) + ), ).toDto(includeRoot = principal.user.roleAdmin) } catch (e: Exception) { when (e) { is FileNotFoundException, is DirectoryNotFoundException, is DuplicateNameException, - is PathContainedInPath -> + is PathContainedInPath, + -> throw ResponseStatusException(HttpStatus.BAD_REQUEST, e.message) else -> throw ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR) } @@ -110,7 +111,7 @@ class LibraryController( @ResponseStatus(HttpStatus.NO_CONTENT) fun updateOne( @PathVariable libraryId: String, - @Valid @RequestBody library: LibraryUpdateDto + @Valid @RequestBody library: LibraryUpdateDto, ) { libraryRepository.findByIdOrNull(libraryId)?.let { val toUpdate = Library( @@ -140,7 +141,8 @@ class LibraryController( is FileNotFoundException, is DirectoryNotFoundException, is DuplicateNameException, - is PathContainedInPath -> + is PathContainedInPath, + -> throw ResponseStatusException(HttpStatus.BAD_REQUEST, e.message) else -> throw ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR) } diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/ReadListController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/ReadListController.kt index 18e16e7c0..344e637b9 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/ReadListController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/ReadListController.kt @@ -95,7 +95,7 @@ class ReadListController( @RequestParam(name = "search", required = false) searchTerm: String?, @RequestParam(name = "library_id", required = false) libraryIds: List?, @RequestParam(name = "unpaged", required = false) unpaged: Boolean = false, - @Parameter(hidden = true) page: Pageable + @Parameter(hidden = true) page: Pageable, ): Page { val sort = when { !searchTerm.isNullOrBlank() -> Sort.by("relevance") @@ -107,31 +107,31 @@ class ReadListController( else PageRequest.of( page.pageNumber, page.pageSize, - sort + sort, ) return when { principal.user.sharedAllLibraries && libraryIds == null -> readListRepository.findAll( searchTerm, - pageable = pageRequest + pageable = pageRequest, ) principal.user.sharedAllLibraries && libraryIds != null -> readListRepository.findAllByLibraryIds( libraryIds, null, searchTerm, - pageable = pageRequest + pageable = pageRequest, ) !principal.user.sharedAllLibraries && libraryIds != null -> readListRepository.findAllByLibraryIds( libraryIds, principal.user.sharedLibrariesIds, searchTerm, - pageable = pageRequest + pageable = pageRequest, ) else -> readListRepository.findAllByLibraryIds( principal.user.sharedLibrariesIds, principal.user.sharedLibrariesIds, searchTerm, - pageable = pageRequest + pageable = pageRequest, ) }.map { it.toDto() } } @@ -139,7 +139,7 @@ class ReadListController( @GetMapping("{id}") fun getOne( @AuthenticationPrincipal principal: KomgaPrincipal, - @PathVariable id: String + @PathVariable id: String, ): ReadListDto = readListRepository.findByIdOrNull(id, principal.user.getAuthorizedLibraryIds(null)) ?.toDto() @@ -149,7 +149,7 @@ class ReadListController( @GetMapping(value = ["{id}/thumbnail"], produces = [MediaType.IMAGE_JPEG_VALUE]) fun getReadListThumbnail( @AuthenticationPrincipal principal: KomgaPrincipal, - @PathVariable id: String + @PathVariable id: String, ): ResponseEntity { readListRepository.findByIdOrNull(id, principal.user.getAuthorizedLibraryIds(null))?.let { return ResponseEntity.ok() @@ -163,7 +163,7 @@ class ReadListController( fun getReadListThumbnailById( @AuthenticationPrincipal principal: KomgaPrincipal, @PathVariable(name = "id") id: String, - @PathVariable(name = "thumbnailId") thumbnailId: String + @PathVariable(name = "thumbnailId") thumbnailId: String, ): ByteArray { readListRepository.findByIdOrNull(id, principal.user.getAuthorizedLibraryIds(null))?.let { return readListLifecycle.getThumbnailBytes(thumbnailId) @@ -200,7 +200,7 @@ class ReadListController( readListId = readList.id, thumbnail = file.bytes, type = ThumbnailReadList.Type.USER_UPLOADED, - selected = selected + selected = selected, ), ) } ?: throw ResponseStatusException(HttpStatus.NOT_FOUND) @@ -239,15 +239,15 @@ class ReadListController( @PostMapping @PreAuthorize("hasRole('$ROLE_ADMIN')") fun addOne( - @Valid @RequestBody readList: ReadListCreationDto + @Valid @RequestBody readList: ReadListCreationDto, ): ReadListDto = try { readListLifecycle.addReadList( ReadList( name = readList.name, summary = readList.summary, - bookIds = readList.bookIds.toIndexedMap() - ) + bookIds = readList.bookIds.toIndexedMap(), + ), ).toDto() } catch (e: DuplicateNameException) { throw ResponseStatusException(HttpStatus.BAD_REQUEST, e.message) @@ -265,13 +265,13 @@ class ReadListController( @ResponseStatus(HttpStatus.NO_CONTENT) fun updateOne( @PathVariable id: String, - @Valid @RequestBody readList: ReadListUpdateDto + @Valid @RequestBody readList: ReadListUpdateDto, ) { readListRepository.findByIdOrNull(id)?.let { existing -> val updated = existing.copy( name = readList.name ?: existing.name, summary = readList.summary ?: existing.summary, - bookIds = readList.bookIds?.toIndexedMap() ?: existing.bookIds + bookIds = readList.bookIds?.toIndexedMap() ?: existing.bookIds, ) try { readListLifecycle.updateReadList(updated) @@ -285,7 +285,7 @@ class ReadListController( @PreAuthorize("hasRole('$ROLE_ADMIN')") @ResponseStatus(HttpStatus.NO_CONTENT) fun deleteOne( - @PathVariable id: String + @PathVariable id: String, ) { readListRepository.findByIdOrNull(id)?.let { readListLifecycle.deleteReadList(it) @@ -305,7 +305,7 @@ class ReadListController( @RequestParam(name = "deleted", required = false) deleted: Boolean?, @RequestParam(name = "unpaged", required = false) unpaged: Boolean = false, @Parameter(hidden = true) @Authors authors: List?, - @Parameter(hidden = true) page: Pageable + @Parameter(hidden = true) page: Pageable, ): Page = readListRepository.findByIdOrNull(id, principal.user.getAuthorizedLibraryIds(null))?.let { readList -> val sort = Sort.by(Sort.Order.asc("readList.number")) @@ -315,7 +315,7 @@ class ReadListController( else PageRequest.of( page.pageNumber, page.pageSize, - sort + sort, ) val bookSearch = BookSearchWithReadProgress( @@ -332,7 +332,7 @@ class ReadListController( principal.user.id, principal.user.getAuthorizedLibraryIds(null), bookSearch, - pageRequest + pageRequest, ) .map { it.restrictUrl(!principal.user.roleAdmin) } } ?: throw ResponseStatusException(HttpStatus.NOT_FOUND) @@ -341,14 +341,14 @@ class ReadListController( fun getBookSiblingPrevious( @AuthenticationPrincipal principal: KomgaPrincipal, @PathVariable id: String, - @PathVariable bookId: String + @PathVariable bookId: String, ): BookDto = readListRepository.findByIdOrNull(id, principal.user.getAuthorizedLibraryIds(null))?.let { bookDtoRepository.findPreviousInReadListOrNull( id, bookId, principal.user.id, - principal.user.getAuthorizedLibraryIds(null) + principal.user.getAuthorizedLibraryIds(null), ) ?.restrictUrl(!principal.user.roleAdmin) } ?: throw ResponseStatusException(HttpStatus.NOT_FOUND) @@ -357,14 +357,14 @@ class ReadListController( fun getBookSiblingNext( @AuthenticationPrincipal principal: KomgaPrincipal, @PathVariable id: String, - @PathVariable bookId: String + @PathVariable bookId: String, ): BookDto = readListRepository.findByIdOrNull(id, principal.user.getAuthorizedLibraryIds(null))?.let { bookDtoRepository.findNextInReadListOrNull( id, bookId, principal.user.id, - principal.user.getAuthorizedLibraryIds(null) + principal.user.getAuthorizedLibraryIds(null), ) ?.restrictUrl(!principal.user.roleAdmin) } ?: throw ResponseStatusException(HttpStatus.NOT_FOUND) @@ -372,7 +372,7 @@ class ReadListController( @GetMapping("{id}/read-progress/tachiyomi") fun getReadProgress( @PathVariable id: String, - @AuthenticationPrincipal principal: KomgaPrincipal + @AuthenticationPrincipal principal: KomgaPrincipal, ): TachiyomiReadProgressDto = readListRepository.findByIdOrNull(id, principal.user.getAuthorizedLibraryIds(null))?.let { readList -> readProgressDtoRepository.findProgressByReadList(readList.id, principal.user.id) @@ -383,7 +383,7 @@ class ReadListController( fun markReadProgressTachiyomi( @PathVariable id: String, @Valid @RequestBody readProgress: TachiyomiReadProgressUpdateDto, - @AuthenticationPrincipal principal: KomgaPrincipal + @AuthenticationPrincipal principal: KomgaPrincipal, ) { readListRepository.findByIdOrNull(id, principal.user.getAuthorizedLibraryIds(null))?.let { readList -> bookDtoRepository.findAllByReadListId( @@ -391,7 +391,7 @@ class ReadListController( principal.user.id, principal.user.getAuthorizedLibraryIds(null), BookSearchWithReadProgress(), - UnpagedSorted(Sort.by(Sort.Order.asc("readList.number"))) + UnpagedSorted(Sort.by(Sort.Order.asc("readList.number"))), ).filterIndexed { index, _ -> index < readProgress.lastBookRead } .forEach { book -> if (book.readProgress?.completed != true) @@ -404,7 +404,7 @@ class ReadListController( @PreAuthorize("hasRole('$ROLE_FILE_DOWNLOAD')") fun getReadListFile( @AuthenticationPrincipal principal: KomgaPrincipal, - @PathVariable id: String + @PathVariable id: String, ): ResponseEntity { readListRepository.findByIdOrNull(id, principal.user.getAuthorizedLibraryIds(null))?.let { readList -> @@ -439,7 +439,7 @@ class ReadListController( contentDisposition = ContentDisposition.builder("attachment") .filename(readList.name + ".zip") .build() - } + }, ) .contentType(MediaType.parseMediaType("application/zip")) .body(streamingResponse) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/ReferentialController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/ReferentialController.kt index a90adaf9c..e8324464a 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/ReferentialController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/ReferentialController.kt @@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.RestController @RestController @RequestMapping("api", produces = [MediaType.APPLICATION_JSON_VALUE]) class ReferentialController( - private val referentialRepository: ReferentialRepository + private val referentialRepository: ReferentialRepository, ) { @GetMapping("v1/authors") @@ -70,7 +70,7 @@ class ReferentialController( @GetMapping("v1/authors/names") fun getAuthorsNames( @AuthenticationPrincipal principal: KomgaPrincipal, - @RequestParam(name = "search", defaultValue = "") search: String + @RequestParam(name = "search", defaultValue = "") search: String, ): List = referentialRepository.findAllAuthorsNamesByName(search, principal.user.getAuthorizedLibraryIds(null)) @@ -84,7 +84,7 @@ class ReferentialController( fun getGenres( @AuthenticationPrincipal principal: KomgaPrincipal, @RequestParam(name = "library_id", required = false) libraryId: String?, - @RequestParam(name = "collection_id", required = false) collectionId: String? + @RequestParam(name = "collection_id", required = false) collectionId: String?, ): Set = when { libraryId != null -> referentialRepository.findAllGenresByLibrary(libraryId, principal.user.getAuthorizedLibraryIds(null)) @@ -96,7 +96,7 @@ class ReferentialController( fun getTags( @AuthenticationPrincipal principal: KomgaPrincipal, @RequestParam(name = "library_id", required = false) libraryId: String?, - @RequestParam(name = "collection_id", required = false) collectionId: String? + @RequestParam(name = "collection_id", required = false) collectionId: String?, ): Set = when { libraryId != null -> referentialRepository.findAllSeriesAndBookTagsByLibrary(libraryId, principal.user.getAuthorizedLibraryIds(null)) @@ -120,7 +120,7 @@ class ReferentialController( fun getSeriesTags( @AuthenticationPrincipal principal: KomgaPrincipal, @RequestParam(name = "library_id", required = false) libraryId: String?, - @RequestParam(name = "collection_id", required = false) collectionId: String? + @RequestParam(name = "collection_id", required = false) collectionId: String?, ): Set = when { libraryId != null -> referentialRepository.findAllSeriesTagsByLibrary(libraryId, principal.user.getAuthorizedLibraryIds(null)) @@ -132,7 +132,7 @@ class ReferentialController( fun getLanguages( @AuthenticationPrincipal principal: KomgaPrincipal, @RequestParam(name = "library_id", required = false) libraryId: String?, - @RequestParam(name = "collection_id", required = false) collectionId: String? + @RequestParam(name = "collection_id", required = false) collectionId: String?, ): Set = when { libraryId != null -> referentialRepository.findAllLanguagesByLibrary(libraryId, principal.user.getAuthorizedLibraryIds(null)) @@ -144,7 +144,7 @@ class ReferentialController( fun getPublishers( @AuthenticationPrincipal principal: KomgaPrincipal, @RequestParam(name = "library_id", required = false) libraryId: String?, - @RequestParam(name = "collection_id", required = false) collectionId: String? + @RequestParam(name = "collection_id", required = false) collectionId: String?, ): Set = when { libraryId != null -> referentialRepository.findAllPublishersByLibrary(libraryId, principal.user.getAuthorizedLibraryIds(null)) @@ -156,7 +156,7 @@ class ReferentialController( fun getAgeRatings( @AuthenticationPrincipal principal: KomgaPrincipal, @RequestParam(name = "library_id", required = false) libraryId: String?, - @RequestParam(name = "collection_id", required = false) collectionId: String? + @RequestParam(name = "collection_id", required = false) collectionId: String?, ): Set = when { libraryId != null -> referentialRepository.findAllAgeRatingsByLibrary(libraryId, principal.user.getAuthorizedLibraryIds(null)) @@ -168,7 +168,7 @@ class ReferentialController( fun getSeriesReleaseDates( @AuthenticationPrincipal principal: KomgaPrincipal, @RequestParam(name = "library_id", required = false) libraryId: String?, - @RequestParam(name = "collection_id", required = false) collectionId: String? + @RequestParam(name = "collection_id", required = false) collectionId: String?, ): Set = when { libraryId != null -> referentialRepository.findAllSeriesReleaseDatesByLibrary(libraryId, principal.user.getAuthorizedLibraryIds(null)) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/SeriesCollectionController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/SeriesCollectionController.kt index 37ef7be3f..fccfa3d43 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/SeriesCollectionController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/SeriesCollectionController.kt @@ -75,7 +75,7 @@ class SeriesCollectionController( @RequestParam(name = "search", required = false) searchTerm: String?, @RequestParam(name = "library_id", required = false) libraryIds: List?, @RequestParam(name = "unpaged", required = false) unpaged: Boolean = false, - @Parameter(hidden = true) page: Pageable + @Parameter(hidden = true) page: Pageable, ): Page { val sort = when { !searchTerm.isNullOrBlank() -> Sort.by("relevance") @@ -87,7 +87,7 @@ class SeriesCollectionController( else PageRequest.of( page.pageNumber, page.pageSize, - sort + sort, ) return when { @@ -101,7 +101,7 @@ class SeriesCollectionController( @GetMapping("{id}") fun getOne( @AuthenticationPrincipal principal: KomgaPrincipal, - @PathVariable id: String + @PathVariable id: String, ): CollectionDto = collectionRepository.findByIdOrNull(id, principal.user.getAuthorizedLibraryIds(null)) ?.toDto() @@ -111,7 +111,7 @@ class SeriesCollectionController( @GetMapping(value = ["{id}/thumbnail"], produces = [MediaType.IMAGE_JPEG_VALUE]) fun getCollectionThumbnail( @AuthenticationPrincipal principal: KomgaPrincipal, - @PathVariable id: String + @PathVariable id: String, ): ResponseEntity { collectionRepository.findByIdOrNull(id, principal.user.getAuthorizedLibraryIds(null))?.let { return ResponseEntity.ok() @@ -125,7 +125,7 @@ class SeriesCollectionController( fun getCollectionThumbnailById( @AuthenticationPrincipal principal: KomgaPrincipal, @PathVariable(name = "id") id: String, - @PathVariable(name = "thumbnailId") thumbnailId: String + @PathVariable(name = "thumbnailId") thumbnailId: String, ): ByteArray { collectionRepository.findByIdOrNull(id, principal.user.getAuthorizedLibraryIds(null))?.let { return collectionLifecycle.getThumbnailBytes(thumbnailId) @@ -162,7 +162,7 @@ class SeriesCollectionController( collectionId = collection.id, thumbnail = file.bytes, type = ThumbnailSeriesCollection.Type.USER_UPLOADED, - selected = selected + selected = selected, ), ) } ?: throw ResponseStatusException(HttpStatus.NOT_FOUND) @@ -201,15 +201,15 @@ class SeriesCollectionController( @PostMapping @PreAuthorize("hasRole('$ROLE_ADMIN')") fun addOne( - @Valid @RequestBody collection: CollectionCreationDto + @Valid @RequestBody collection: CollectionCreationDto, ): CollectionDto = try { collectionLifecycle.addCollection( SeriesCollection( name = collection.name, ordered = collection.ordered, - seriesIds = collection.seriesIds - ) + seriesIds = collection.seriesIds, + ), ).toDto() } catch (e: DuplicateNameException) { throw ResponseStatusException(HttpStatus.BAD_REQUEST, e.message) @@ -220,13 +220,13 @@ class SeriesCollectionController( @ResponseStatus(HttpStatus.NO_CONTENT) fun updateOne( @PathVariable id: String, - @Valid @RequestBody collection: CollectionUpdateDto + @Valid @RequestBody collection: CollectionUpdateDto, ) { collectionRepository.findByIdOrNull(id)?.let { existing -> val updated = existing.copy( name = collection.name ?: existing.name, ordered = collection.ordered ?: existing.ordered, - seriesIds = collection.seriesIds ?: existing.seriesIds + seriesIds = collection.seriesIds ?: existing.seriesIds, ) try { collectionLifecycle.updateCollection(updated) @@ -240,7 +240,7 @@ class SeriesCollectionController( @PreAuthorize("hasRole('$ROLE_ADMIN')") @ResponseStatus(HttpStatus.NO_CONTENT) fun deleteOne( - @PathVariable id: String + @PathVariable id: String, ) { collectionRepository.findByIdOrNull(id)?.let { collectionLifecycle.deleteCollection(it) @@ -266,7 +266,7 @@ class SeriesCollectionController( @RequestParam(name = "complete", required = false) complete: Boolean?, @RequestParam(name = "unpaged", required = false) unpaged: Boolean = false, @Parameter(hidden = true) @Authors authors: List?, - @Parameter(hidden = true) page: Pageable + @Parameter(hidden = true) page: Pageable, ): Page = collectionRepository.findByIdOrNull(id, principal.user.getAuthorizedLibraryIds(null))?.let { collection -> val sort = @@ -278,7 +278,7 @@ class SeriesCollectionController( else PageRequest.of( page.pageNumber, page.pageSize, - sort + sort, ) val seriesSearch = SeriesSearchWithReadProgress( @@ -293,7 +293,7 @@ class SeriesCollectionController( tags = tags, ageRatings = ageRatings?.map { it.toIntOrNull() }, releaseYears = release_years, - authors = authors + authors = authors, ) seriesDtoRepository.findAllByCollectionId(collection.id, seriesSearch, principal.user.id, pageRequest) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/SeriesController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/SeriesController.kt index e41328e97..63b0c70c3 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/SeriesController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/SeriesController.kt @@ -112,8 +112,8 @@ class SeriesController( @Parameters( Parameter( description = "Search by regex criteria, in the form: regex,field. Supported fields are TITLE and TITLE_SORT.", - `in` = ParameterIn.QUERY, name = "search_regex", schema = Schema(type = "string") - ) + `in` = ParameterIn.QUERY, name = "search_regex", schema = Schema(type = "string"), + ), ) @GetMapping("v1/series") fun getAllSeries( @@ -134,7 +134,7 @@ class SeriesController( @RequestParam(name = "complete", required = false) complete: Boolean?, @RequestParam(name = "unpaged", required = false) unpaged: Boolean = false, @Parameter(hidden = true) @Authors authors: List?, - @Parameter(hidden = true) page: Pageable + @Parameter(hidden = true) page: Pageable, ): Page { val sort = when { @@ -148,7 +148,7 @@ class SeriesController( else PageRequest.of( page.pageNumber, page.pageSize, - sort + sort, ) val seriesSearch = SeriesSearchWithReadProgress( @@ -172,7 +172,7 @@ class SeriesController( tags = tags, ageRatings = ageRatings?.map { it.toIntOrNull() }, releaseYears = release_years, - authors = authors + authors = authors, ) return seriesDtoRepository.findAll(seriesSearch, principal.user.id, pageRequest) @@ -183,8 +183,8 @@ class SeriesController( @Parameters( Parameter( description = "Search by regex criteria, in the form: regex,field. Supported fields are TITLE and TITLE_SORT.", - `in` = ParameterIn.QUERY, name = "search_regex", schema = Schema(type = "string") - ) + `in` = ParameterIn.QUERY, name = "search_regex", schema = Schema(type = "string"), + ), ) @GetMapping("v1/series/alphabetical-groups") fun getAlphabeticalGroups( @@ -204,7 +204,7 @@ class SeriesController( @RequestParam(name = "deleted", required = false) deleted: Boolean?, @RequestParam(name = "complete", required = false) complete: Boolean?, @Parameter(hidden = true) @Authors authors: List?, - @Parameter(hidden = true) page: Pageable + @Parameter(hidden = true) page: Pageable, ): List { val seriesSearch = SeriesSearchWithReadProgress( libraryIds = principal.user.getAuthorizedLibraryIds(libraryIds), @@ -227,7 +227,7 @@ class SeriesController( tags = tags, ageRatings = ageRatings?.map { it.toIntOrNull() }, releaseYears = release_years, - authors = authors + authors = authors, ) return seriesDtoRepository.countByFirstCharacter(seriesSearch, principal.user.id) @@ -241,7 +241,7 @@ class SeriesController( @RequestParam(name = "library_id", required = false) libraryIds: List?, @RequestParam(name = "deleted", required = false) deleted: Boolean?, @RequestParam(name = "unpaged", required = false) unpaged: Boolean = false, - @Parameter(hidden = true) page: Pageable + @Parameter(hidden = true) page: Pageable, ): Page { val sort = Sort.by(Sort.Order.desc("lastModified")) @@ -250,7 +250,7 @@ class SeriesController( else PageRequest.of( page.pageNumber, page.pageSize, - sort + sort, ) return seriesDtoRepository.findAll( @@ -259,7 +259,7 @@ class SeriesController( deleted = deleted, ), principal.user.id, - pageRequest + pageRequest, ).map { it.restrictUrl(!principal.user.roleAdmin) } } @@ -271,7 +271,7 @@ class SeriesController( @RequestParam(name = "library_id", required = false) libraryIds: List?, @RequestParam(name = "deleted", required = false) deleted: Boolean?, @RequestParam(name = "unpaged", required = false) unpaged: Boolean = false, - @Parameter(hidden = true) page: Pageable + @Parameter(hidden = true) page: Pageable, ): Page { val sort = Sort.by(Sort.Order.desc("created")) @@ -280,7 +280,7 @@ class SeriesController( else PageRequest.of( page.pageNumber, page.pageSize, - sort + sort, ) return seriesDtoRepository.findAll( @@ -289,7 +289,7 @@ class SeriesController( deleted = deleted, ), principal.user.id, - pageRequest + pageRequest, ).map { it.restrictUrl(!principal.user.roleAdmin) } } @@ -301,7 +301,7 @@ class SeriesController( @RequestParam(name = "library_id", required = false) libraryIds: List?, @RequestParam(name = "deleted", required = false) deleted: Boolean?, @RequestParam(name = "unpaged", required = false) unpaged: Boolean = false, - @Parameter(hidden = true) page: Pageable + @Parameter(hidden = true) page: Pageable, ): Page { val sort = Sort.by(Sort.Order.desc("lastModified")) @@ -310,7 +310,7 @@ class SeriesController( else PageRequest.of( page.pageNumber, page.pageSize, - sort + sort, ) return seriesDtoRepository.findAllRecentlyUpdated( @@ -319,14 +319,14 @@ class SeriesController( deleted = deleted, ), principal.user.id, - pageRequest + pageRequest, ).map { it.restrictUrl(!principal.user.roleAdmin) } } @GetMapping("v1/series/{seriesId}") fun getOneSeries( @AuthenticationPrincipal principal: KomgaPrincipal, - @PathVariable(name = "seriesId") id: String + @PathVariable(name = "seriesId") id: String, ): SeriesDto = seriesDtoRepository.findByIdOrNull(id, principal.user.id)?.let { if (!principal.user.canAccessLibrary(it.libraryId)) throw ResponseStatusException(HttpStatus.FORBIDDEN) @@ -352,7 +352,7 @@ class SeriesController( fun getSeriesThumbnailById( @AuthenticationPrincipal principal: KomgaPrincipal, @PathVariable(name = "seriesId") seriesId: String, - @PathVariable(name = "thumbnailId") thumbnailId: String + @PathVariable(name = "thumbnailId") thumbnailId: String, ): ByteArray { seriesRepository.getLibraryId(seriesId)?.let { if (!principal.user.canAccessLibrary(it)) throw ResponseStatusException(HttpStatus.FORBIDDEN) @@ -365,7 +365,7 @@ class SeriesController( @GetMapping(value = ["v1/series/{seriesId}/thumbnails"], produces = [MediaType.APPLICATION_JSON_VALUE]) fun getSeriesThumbnails( @AuthenticationPrincipal principal: KomgaPrincipal, - @PathVariable(name = "seriesId") seriesId: String + @PathVariable(name = "seriesId") seriesId: String, ): Collection { seriesRepository.getLibraryId(seriesId)?.let { if (!principal.user.canAccessLibrary(it)) throw ResponseStatusException(HttpStatus.FORBIDDEN) @@ -391,9 +391,9 @@ class SeriesController( ThumbnailSeries( seriesId = series.id, thumbnail = file.bytes, - type = ThumbnailSeries.Type.USER_UPLOADED + type = ThumbnailSeries.Type.USER_UPLOADED, ), - if (selected) MarkSelectedPreference.YES else MarkSelectedPreference.NO + if (selected) MarkSelectedPreference.YES else MarkSelectedPreference.NO, ) } @@ -440,7 +440,7 @@ class SeriesController( @RequestParam(name = "deleted", required = false) deleted: Boolean?, @RequestParam(name = "unpaged", required = false) unpaged: Boolean = false, @Parameter(hidden = true) @Authors authors: List?, - @Parameter(hidden = true) page: Pageable + @Parameter(hidden = true) page: Pageable, ): Page { seriesRepository.getLibraryId(seriesId)?.let { if (!principal.user.canAccessLibrary(it)) throw ResponseStatusException(HttpStatus.FORBIDDEN) @@ -454,7 +454,7 @@ class SeriesController( else PageRequest.of( page.pageNumber, page.pageSize, - sort + sort, ) return bookDtoRepository.findAll( @@ -467,14 +467,14 @@ class SeriesController( authors = authors, ), principal.user.id, - pageRequest + pageRequest, ).map { it.restrictUrl(!principal.user.roleAdmin) } } @GetMapping("v1/series/{seriesId}/collections") fun getAllCollectionsBySeries( @AuthenticationPrincipal principal: KomgaPrincipal, - @PathVariable(name = "seriesId") seriesId: String + @PathVariable(name = "seriesId") seriesId: String, ): List { seriesRepository.getLibraryId(seriesId)?.let { if (!principal.user.canAccessLibrary(it)) throw ResponseStatusException(HttpStatus.FORBIDDEN) @@ -511,7 +511,7 @@ class SeriesController( @PathVariable seriesId: String, @Parameter(description = "Metadata fields to update. Set a field to null to unset the metadata. You can omit fields you don't want to update.") @Valid @RequestBody newMetadata: SeriesMetadataUpdateDto, - @AuthenticationPrincipal principal: KomgaPrincipal + @AuthenticationPrincipal principal: KomgaPrincipal, ) = seriesMetadataRepository.findByIdOrNull(seriesId)?.let { existing -> val updated = with(newMetadata) { @@ -554,7 +554,7 @@ class SeriesController( @ResponseStatus(HttpStatus.NO_CONTENT) fun markAsRead( @PathVariable seriesId: String, - @AuthenticationPrincipal principal: KomgaPrincipal + @AuthenticationPrincipal principal: KomgaPrincipal, ) { seriesRepository.getLibraryId(seriesId)?.let { if (!principal.user.canAccessLibrary(it)) throw ResponseStatusException(HttpStatus.FORBIDDEN) @@ -568,7 +568,7 @@ class SeriesController( @ResponseStatus(HttpStatus.NO_CONTENT) fun markAsUnread( @PathVariable seriesId: String, - @AuthenticationPrincipal principal: KomgaPrincipal + @AuthenticationPrincipal principal: KomgaPrincipal, ) { seriesRepository.getLibraryId(seriesId)?.let { if (!principal.user.canAccessLibrary(it)) throw ResponseStatusException(HttpStatus.FORBIDDEN) @@ -647,7 +647,7 @@ class SeriesController( @PreAuthorize("hasRole('$ROLE_FILE_DOWNLOAD')") fun getSeriesFile( @AuthenticationPrincipal principal: KomgaPrincipal, - @PathVariable seriesId: String + @PathVariable seriesId: String, ): ResponseEntity { seriesRepository.getLibraryId(seriesId)?.let { if (!principal.user.canAccessLibrary(it)) throw ResponseStatusException(HttpStatus.FORBIDDEN) @@ -682,7 +682,7 @@ class SeriesController( contentDisposition = ContentDisposition.builder("attachment") .filename(seriesMetadataRepository.findById(seriesId).title + ".zip") .build() - } + }, ) .contentType(MediaType.parseMediaType("application/zip")) .body(streamingResponse) @@ -692,7 +692,7 @@ class SeriesController( @PreAuthorize("hasRole('$ROLE_ADMIN')") @ResponseStatus(HttpStatus.ACCEPTED) fun deleteSeries( - @PathVariable seriesId: String + @PathVariable seriesId: String, ) { taskReceiver.deleteSeries( seriesId = seriesId, diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/TransientBooksController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/TransientBooksController.kt index be85e1ac6..ec333adef 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/TransientBooksController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/TransientBooksController.kt @@ -37,7 +37,7 @@ class TransientBooksController( @PostMapping fun scanForTransientBooks( - @RequestBody request: ScanRequestDto + @RequestBody request: ScanRequestDto, ): List = try { transientBookLifecycle.scanAndPersist(request.path) @@ -56,7 +56,7 @@ class TransientBooksController( @GetMapping( value = ["{id}/pages/{pageNumber}"], - produces = [MediaType.ALL_VALUE] + produces = [MediaType.ALL_VALUE], ) fun getSourcePage( @PathVariable id: String, diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/UserController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/UserController.kt index 809e8fcc0..0d32b5027 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/UserController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/UserController.kt @@ -53,7 +53,7 @@ class UserController( private val userRepository: KomgaUserRepository, private val libraryRepository: LibraryRepository, private val authenticationActivityRepository: AuthenticationActivityRepository, - env: Environment + env: Environment, ) { private val demo = env.activeProfiles.contains("demo") @@ -66,7 +66,7 @@ class UserController( @ResponseStatus(HttpStatus.NO_CONTENT) fun updateMyPassword( @AuthenticationPrincipal principal: KomgaPrincipal, - @Valid @RequestBody newPasswordDto: PasswordUpdateDto + @Valid @RequestBody newPasswordDto: PasswordUpdateDto, ) { if (demo) throw ResponseStatusException(HttpStatus.FORBIDDEN) userRepository.findByEmailIgnoreCaseOrNull(principal.username)?.let { user -> @@ -94,7 +94,7 @@ class UserController( @PreAuthorize("hasRole('$ROLE_ADMIN') and #principal.user.id != #id") fun delete( @PathVariable id: String, - @AuthenticationPrincipal principal: KomgaPrincipal + @AuthenticationPrincipal principal: KomgaPrincipal, ) { userRepository.findByIdOrNull(id)?.let { userLifecycle.deleteUser(it) @@ -107,13 +107,13 @@ class UserController( fun updateUserRoles( @PathVariable id: String, @Valid @RequestBody patch: RolesUpdateDto, - @AuthenticationPrincipal principal: KomgaPrincipal + @AuthenticationPrincipal principal: KomgaPrincipal, ) { userRepository.findByIdOrNull(id)?.let { user -> val updatedUser = user.copy( roleAdmin = patch.roles.contains(ROLE_ADMIN), roleFileDownload = patch.roles.contains(ROLE_FILE_DOWNLOAD), - rolePageStreaming = patch.roles.contains(ROLE_PAGE_STREAMING) + rolePageStreaming = patch.roles.contains(ROLE_PAGE_STREAMING), ) userRepository.update(updatedUser) logger.info { "Updated user roles: $updatedUser" } @@ -126,7 +126,7 @@ class UserController( fun updatePassword( @PathVariable id: String, @AuthenticationPrincipal principal: KomgaPrincipal, - @Valid @RequestBody newPasswordDto: PasswordUpdateDto + @Valid @RequestBody newPasswordDto: PasswordUpdateDto, ) { if (demo) throw ResponseStatusException(HttpStatus.FORBIDDEN) userRepository.findByIdOrNull(id)?.let { user -> @@ -139,7 +139,7 @@ class UserController( @PreAuthorize("hasRole('$ROLE_ADMIN')") fun updateSharesLibraries( @PathVariable id: String, - @Valid @RequestBody sharedLibrariesUpdateDto: SharedLibrariesUpdateDto + @Valid @RequestBody sharedLibrariesUpdateDto: SharedLibrariesUpdateDto, ) { userRepository.findByIdOrNull(id)?.let { user -> val updatedUser = user.copy( @@ -147,7 +147,7 @@ class UserController( sharedLibrariesIds = if (sharedLibrariesUpdateDto.all) emptySet() else libraryRepository.findAllByIds(sharedLibrariesUpdateDto.libraryIds) .map { it.id } - .toSet() + .toSet(), ) userRepository.update(updatedUser) logger.info { "Updated user shared libraries: $updatedUser" } @@ -171,7 +171,7 @@ class UserController( else PageRequest.of( page.pageNumber, page.pageSize, - sort + sort, ) return authenticationActivityRepository.findAllByUser(principal.user, pageRequest).map { it.toDto() } @@ -193,7 +193,7 @@ class UserController( else PageRequest.of( page.pageNumber, page.pageSize, - sort + sort, ) return authenticationActivityRepository.findAll(pageRequest).map { it.toDto() } diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/AuthorDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/AuthorDto.kt index 69677c976..f91cf3773 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/AuthorDto.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/AuthorDto.kt @@ -4,7 +4,7 @@ import org.gotson.komga.domain.model.Author data class AuthorDto( val name: String, - val role: String + val role: String, ) fun Author.toDto() = AuthorDto(name, role) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/BookDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/BookDto.kt index 5e2528e94..279b4992c 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/BookDto.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/BookDto.kt @@ -35,7 +35,7 @@ data class MediaDto( val status: String, val mediaType: String, val pagesCount: Int, - val comment: String + val comment: String, ) data class BookMetadataDto( @@ -62,7 +62,7 @@ data class BookMetadataDto( @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") val created: LocalDateTime, @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") - val lastModified: LocalDateTime + val lastModified: LocalDateTime, ) data class ReadProgressDto( @@ -73,5 +73,5 @@ data class ReadProgressDto( @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") val created: LocalDateTime, @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") - val lastModified: LocalDateTime + val lastModified: LocalDateTime, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/CollectionCreationDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/CollectionCreationDto.kt index cd6d4a612..997ea6983 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/CollectionCreationDto.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/CollectionCreationDto.kt @@ -7,5 +7,5 @@ import javax.validation.constraints.NotEmpty data class CollectionCreationDto( @get:NotBlank val name: String, val ordered: Boolean, - @get:NotEmpty @get:UniqueElements val seriesIds: List + @get:NotEmpty @get:UniqueElements val seriesIds: List, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/CollectionDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/CollectionDto.kt index 4d07128ca..265a148ad 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/CollectionDto.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/CollectionDto.kt @@ -17,7 +17,7 @@ data class CollectionDto( @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") val lastModifiedDate: LocalDateTime, - val filtered: Boolean + val filtered: Boolean, ) fun SeriesCollection.toDto() = @@ -28,5 +28,5 @@ fun SeriesCollection.toDto() = seriesIds = seriesIds, createdDate = createdDate.toUTC(), lastModifiedDate = lastModifiedDate.toUTC(), - filtered = filtered + filtered = filtered, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/CollectionUpdateDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/CollectionUpdateDto.kt index 908586244..d45985285 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/CollectionUpdateDto.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/CollectionUpdateDto.kt @@ -7,5 +7,5 @@ import org.hibernate.validator.constraints.UniqueElements data class CollectionUpdateDto( @get:NullOrNotBlank val name: String?, val ordered: Boolean?, - @get:NullOrNotEmpty @get:UniqueElements val seriesIds: List? + @get:NullOrNotEmpty @get:UniqueElements val seriesIds: List?, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/PageDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/PageDto.kt index c4eafef71..a2ceb4b8b 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/PageDto.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/PageDto.kt @@ -5,5 +5,5 @@ data class PageDto( val fileName: String, val mediaType: String, val width: Int?, - val height: Int? + val height: Int?, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ReadListCreationDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ReadListCreationDto.kt index f3777ff9d..610dfd592 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ReadListCreationDto.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ReadListCreationDto.kt @@ -7,5 +7,5 @@ import javax.validation.constraints.NotEmpty data class ReadListCreationDto( @get:NotBlank val name: String, val summary: String = "", - @get:NotEmpty @get:UniqueElements val bookIds: List + @get:NotEmpty @get:UniqueElements val bookIds: List, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ReadListDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ReadListDto.kt index e3e788857..f5c1812fe 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ReadListDto.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ReadListDto.kt @@ -17,7 +17,7 @@ data class ReadListDto( @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") val lastModifiedDate: LocalDateTime, - val filtered: Boolean + val filtered: Boolean, ) fun ReadList.toDto() = @@ -28,5 +28,5 @@ fun ReadList.toDto() = bookIds = bookIds.values.toList(), createdDate = createdDate.toUTC(), lastModifiedDate = lastModifiedDate.toUTC(), - filtered = filtered + filtered = filtered, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ReadListUpdateDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ReadListUpdateDto.kt index d506d14df..302b26d97 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ReadListUpdateDto.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ReadListUpdateDto.kt @@ -7,5 +7,5 @@ import org.hibernate.validator.constraints.UniqueElements data class ReadListUpdateDto( @get:NullOrNotBlank val name: String?, val summary: String?, - @get:NullOrNotEmpty @get:UniqueElements val bookIds: List? + @get:NullOrNotEmpty @get:UniqueElements val bookIds: List?, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ReadProgressUpdateDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ReadProgressUpdateDto.kt index 8f9315c30..12ca94190 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ReadProgressUpdateDto.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ReadProgressUpdateDto.kt @@ -9,7 +9,7 @@ import kotlin.reflect.KClass @ReadProgressUpdateDtoConstraint data class ReadProgressUpdateDto( @get:Positive val page: Int?, - val completed: Boolean? + val completed: Boolean?, ) @Constraint(validatedBy = [ReadProgressUpdateDtoValidator::class]) @@ -18,7 +18,7 @@ data class ReadProgressUpdateDto( annotation class ReadProgressUpdateDtoConstraint( val message: String = "page must be specified if completed is false or null", val groups: Array> = [], - val payload: Array> = [] + val payload: Array> = [], ) class ReadProgressUpdateDtoValidator : ConstraintValidator { diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/SeriesDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/SeriesDto.kt index 4649c2645..d6cd6b154 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/SeriesDto.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/SeriesDto.kt @@ -54,7 +54,7 @@ data class SeriesMetadataDto( @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") val created: LocalDateTime, @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") - val lastModified: LocalDateTime + val lastModified: LocalDateTime, ) data class BookMetadataAggregationDto( @@ -68,5 +68,5 @@ data class BookMetadataAggregationDto( @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") val created: LocalDateTime, @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") - val lastModified: LocalDateTime + val lastModified: LocalDateTime, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/SeriesThumbnailDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/SeriesThumbnailDto.kt index 48249e187..c5ba3cd03 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/SeriesThumbnailDto.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/SeriesThumbnailDto.kt @@ -6,7 +6,7 @@ data class SeriesThumbnailDto( val id: String, val seriesId: String, val type: String, - val selected: Boolean + val selected: Boolean, ) fun ThumbnailSeries.toDto() = @@ -14,5 +14,5 @@ fun ThumbnailSeries.toDto() = id = id, seriesId = seriesId, type = type.toString(), - selected = selected + selected = selected, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ThumbnailBookDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ThumbnailBookDto.kt index bfeb9dc4f..cecb85312 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ThumbnailBookDto.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ThumbnailBookDto.kt @@ -6,7 +6,7 @@ data class ThumbnailBookDto( val id: String, val bookId: String, val type: String, - val selected: Boolean + val selected: Boolean, ) fun ThumbnailBook.toDto() = @@ -14,5 +14,5 @@ fun ThumbnailBook.toDto() = id = id, bookId = bookId, type = type.toString(), - selected = selected + selected = selected, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ThumbnailReadListDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ThumbnailReadListDto.kt index a158f0928..c07f1c8b9 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ThumbnailReadListDto.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ThumbnailReadListDto.kt @@ -6,7 +6,7 @@ data class ThumbnailReadListDto( val id: String, val readListId: String, val type: String, - val selected: Boolean + val selected: Boolean, ) fun ThumbnailReadList.toDto() = @@ -14,5 +14,5 @@ fun ThumbnailReadList.toDto() = id = id, readListId = readListId, type = type.toString(), - selected = selected + selected = selected, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ThumbnailSeriesCollectionDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ThumbnailSeriesCollectionDto.kt index a898ffea0..c1e3807c4 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ThumbnailSeriesCollectionDto.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/ThumbnailSeriesCollectionDto.kt @@ -6,7 +6,7 @@ data class ThumbnailSeriesCollectionDto( val id: String, val collectionId: String, val type: String, - val selected: Boolean + val selected: Boolean, ) fun ThumbnailSeriesCollection.toDto() = @@ -14,5 +14,5 @@ fun ThumbnailSeriesCollection.toDto() = id = id, collectionId = collectionId, type = type.toString(), - selected = selected + selected = selected, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/UserDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/UserDto.kt index 9b09cdf8f..b128eec54 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/UserDto.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/api/rest/dto/UserDto.kt @@ -11,14 +11,14 @@ import javax.validation.constraints.NotBlank data class UserDto( val id: String, val email: String, - val roles: List + val roles: List, ) fun KomgaUser.toDto() = UserDto( id = id, email = email, - roles = roles().toList() + roles = roles().toList(), ) fun KomgaPrincipal.toDto() = user.toDto() @@ -28,11 +28,11 @@ data class UserWithSharedLibrariesDto( val email: String, val roles: List, val sharedAllLibraries: Boolean, - val sharedLibraries: List + val sharedLibraries: List, ) data class SharedLibraryDto( - val id: String + val id: String, ) fun KomgaUser.toWithSharedLibrariesDto() = @@ -41,13 +41,13 @@ fun KomgaUser.toWithSharedLibrariesDto() = email = email, roles = roles().toList(), sharedAllLibraries = sharedAllLibraries, - sharedLibraries = sharedLibrariesIds.map { SharedLibraryDto(it) } + sharedLibraries = sharedLibrariesIds.map { SharedLibraryDto(it) }, ) data class UserCreationDto( @get:Email(regexp = ".+@.+\\..+") val email: String, @get:NotBlank val password: String, - val roles: List = emptyList() + val roles: List = emptyList(), ) { fun toDomain(): KomgaUser = KomgaUser( @@ -55,19 +55,19 @@ data class UserCreationDto( password, roleAdmin = roles.contains(ROLE_ADMIN), roleFileDownload = roles.contains(ROLE_FILE_DOWNLOAD), - rolePageStreaming = roles.contains(ROLE_PAGE_STREAMING) + rolePageStreaming = roles.contains(ROLE_PAGE_STREAMING), ) } data class PasswordUpdateDto( - @get:NotBlank val password: String + @get:NotBlank val password: String, ) data class SharedLibrariesUpdateDto( val all: Boolean, - val libraryIds: Set + val libraryIds: Set, ) data class RolesUpdateDto( - val roles: List + val roles: List, ) diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/mvc/IndexController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/mvc/IndexController.kt index dc485bde8..3d3d15771 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/mvc/IndexController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/mvc/IndexController.kt @@ -7,7 +7,7 @@ import javax.servlet.ServletContext @Controller class IndexController( - servletContext: ServletContext + servletContext: ServletContext, ) { private val baseUrl: String = "${servletContext.contextPath}/" diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/scheduler/InitialUserController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/scheduler/InitialUserController.kt index ed2e0b64c..4b79fddb8 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/scheduler/InitialUserController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/scheduler/InitialUserController.kt @@ -17,7 +17,7 @@ private val logger = KotlinLogging.logger {} @Component class InitialUserController( private val userLifecycle: KomgaUserLifecycle, - private val initialUsers: List + private val initialUsers: List, ) { @EventListener(ApplicationReadyEvent::class) @@ -40,7 +40,7 @@ class InitialUsersDevConfiguration { @Bean fun initialUsers(): List = listOf( KomgaUser("admin@example.org", "admin", roleAdmin = true), - KomgaUser("user@example.org", "user", roleAdmin = false) + KomgaUser("user@example.org", "user", roleAdmin = false), ) } @@ -49,6 +49,6 @@ class InitialUsersDevConfiguration { class InitialUsersProdConfiguration { @Bean fun initialUsers(): List = listOf( - KomgaUser("admin@example.org", RandomStringUtils.randomAlphanumeric(12), roleAdmin = true) + KomgaUser("admin@example.org", RandomStringUtils.randomAlphanumeric(12), roleAdmin = true), ) } diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/scheduler/PeriodicScannerController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/scheduler/PeriodicScannerController.kt index 9471db669..88c84197f 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/scheduler/PeriodicScannerController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/scheduler/PeriodicScannerController.kt @@ -13,7 +13,7 @@ private val logger = KotlinLogging.logger {} @Profile("!test") @Component class PeriodicScannerController( - private val taskReceiver: TaskReceiver + private val taskReceiver: TaskReceiver, ) { @EventListener(classes = [ApplicationReadyEvent::class], condition = "@komgaProperties.librariesScanStartup") diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/sse/SseController.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/sse/SseController.kt index 7082bb175..6110aa4e4 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/sse/SseController.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/sse/SseController.kt @@ -124,7 +124,7 @@ class SseController( emitter.send( SseEmitter.event() .name(name) - .data(data, MediaType.APPLICATION_JSON) + .data(data, MediaType.APPLICATION_JSON), ) } catch (e: IOException) { } diff --git a/komga/src/main/kotlin/org/gotson/komga/interfaces/sse/dto/TaskQueueSseDto.kt b/komga/src/main/kotlin/org/gotson/komga/interfaces/sse/dto/TaskQueueSseDto.kt index 357531c0b..07dd6258b 100644 --- a/komga/src/main/kotlin/org/gotson/komga/interfaces/sse/dto/TaskQueueSseDto.kt +++ b/komga/src/main/kotlin/org/gotson/komga/interfaces/sse/dto/TaskQueueSseDto.kt @@ -2,5 +2,5 @@ package org.gotson.komga.interfaces.sse.dto data class TaskQueueSseDto( val count: Int, - val countByType: Map + val countByType: Map, ) diff --git a/komga/src/test/kotlin/org/gotson/komga/architecture/DomainDrivenDesignRulesTest.kt b/komga/src/test/kotlin/org/gotson/komga/architecture/DomainDrivenDesignRulesTest.kt index b6355cf80..95b61d86e 100644 --- a/komga/src/test/kotlin/org/gotson/komga/architecture/DomainDrivenDesignRulesTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/architecture/DomainDrivenDesignRulesTest.kt @@ -19,7 +19,7 @@ class DomainDrivenDesignRulesTest { "..infrastructure..", "..interfaces..", "..domain.persistence..", - "..domain.service.." + "..domain.service..", ) @ArchTest diff --git a/komga/src/test/kotlin/org/gotson/komga/domain/model/Utils.kt b/komga/src/test/kotlin/org/gotson/komga/domain/model/Utils.kt index 51543e5d1..b27bc3371 100644 --- a/komga/src/test/kotlin/org/gotson/komga/domain/model/Utils.kt +++ b/komga/src/test/kotlin/org/gotson/komga/domain/model/Utils.kt @@ -11,7 +11,7 @@ fun makeBook(name: String, fileLastModified: LocalDateTime = LocalDateTime.now() url = url ?: URL("file:/${name.replace(" ", "_")}"), fileLastModified = fileLastModified, libraryId = libraryId, - seriesId = seriesId + seriesId = seriesId, ) } @@ -21,7 +21,7 @@ fun makeSeries(name: String, libraryId: String = "", url: URL? = null): Series { name = name, url = url ?: URL("file:/${name.replace(" ", "_")}"), fileLastModified = LocalDateTime.now(), - libraryId = libraryId + libraryId = libraryId, ) } @@ -29,7 +29,7 @@ fun makeLibrary(name: String = "default", path: String = "file:/${name.replace(" return Library( name = name, root = url ?: URL(path), - id = id + id = id, ) } diff --git a/komga/src/test/kotlin/org/gotson/komga/domain/service/BookAnalyzerTest.kt b/komga/src/test/kotlin/org/gotson/komga/domain/service/BookAnalyzerTest.kt index 3eb9640e8..79484c2bc 100644 --- a/komga/src/test/kotlin/org/gotson/komga/domain/service/BookAnalyzerTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/domain/service/BookAnalyzerTest.kt @@ -16,7 +16,7 @@ import java.time.LocalDateTime @ExtendWith(SpringExtension::class) @SpringBootTest class BookAnalyzerTest( - @Autowired private val bookAnalyzer: BookAnalyzer + @Autowired private val bookAnalyzer: BookAnalyzer, ) { @Test @@ -34,8 +34,8 @@ class BookAnalyzerTest( @ParameterizedTest @ValueSource( strings = [ - "rar4-solid.rar", "rar4-encrypted.rar" - ] + "rar4-solid.rar", "rar4-encrypted.rar", + ], ) fun `given rar4 solid or encrypted archive when analyzing then media status is UNSUPPORTED`(fileName: String) { val file = ClassPathResource("archives/rar4-solid.rar") @@ -50,8 +50,8 @@ class BookAnalyzerTest( @ParameterizedTest @ValueSource( strings = [ - "rar5.rar", "rar5-solid.rar", "rar5-encrypted.rar" - ] + "rar5.rar", "rar5-solid.rar", "rar5-encrypted.rar", + ], ) fun `given rar5 archive when analyzing then media status is UNSUPPORTED`(fileName: String) { val file = ClassPathResource("archives/$fileName") @@ -66,8 +66,8 @@ class BookAnalyzerTest( @ParameterizedTest @ValueSource( strings = [ - "7zip.7z", "7zip-encrypted.7z" - ] + "7zip.7z", "7zip-encrypted.7z", + ], ) fun `given 7zip archive when analyzing then media status is UNSUPPORTED`(fileName: String) { val file = ClassPathResource("archives/$fileName") @@ -82,8 +82,8 @@ class BookAnalyzerTest( @ParameterizedTest @ValueSource( strings = [ - "zip.zip", "zip-bzip2.zip", "zip-copy.zip", "zip-deflate64.zip", "zip-lzma.zip", "zip-ppmd.zip" - ] + "zip.zip", "zip-bzip2.zip", "zip-copy.zip", "zip-deflate64.zip", "zip-lzma.zip", "zip-ppmd.zip", + ], ) fun `given zip archive when analyzing then media status is READY`(fileName: String) { val file = ClassPathResource("archives/$fileName") diff --git a/komga/src/test/kotlin/org/gotson/komga/domain/service/BookImporterTest.kt b/komga/src/test/kotlin/org/gotson/komga/domain/service/BookImporterTest.kt index aee817183..5cb3fddbc 100644 --- a/komga/src/test/kotlin/org/gotson/komga/domain/service/BookImporterTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/domain/service/BookImporterTest.kt @@ -357,7 +357,7 @@ class BookImporterTest( numberLock = true, numberSort = 100F, numberSortLock = true, - ) + ), ) } @@ -449,8 +449,8 @@ class BookImporterTest( mediaRepository.update( media.copy( status = Media.Status.READY, - pages = (1..10).map { BookPage("$it", "image/jpeg") } - ) + pages = (1..10).map { BookPage("$it", "image/jpeg") }, + ), ) } diff --git a/komga/src/test/kotlin/org/gotson/komga/domain/service/BookLifecycleTest.kt b/komga/src/test/kotlin/org/gotson/komga/domain/service/BookLifecycleTest.kt index a66b0e088..dc875b76f 100644 --- a/komga/src/test/kotlin/org/gotson/komga/domain/service/BookLifecycleTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/domain/service/BookLifecycleTest.kt @@ -89,8 +89,8 @@ class BookLifecycleTest( mediaRepository.update( media.copy( status = Media.Status.OUTDATED, - pages = (1..10).map { BookPage("$it", "image/jpeg") } - ) + pages = (1..10).map { BookPage("$it", "image/jpeg") }, + ), ) } @@ -122,8 +122,8 @@ class BookLifecycleTest( mediaRepository.update( media.copy( status = Media.Status.OUTDATED, - pages = (1..10).map { BookPage("$it", "image/jpeg") } - ) + pages = (1..10).map { BookPage("$it", "image/jpeg") }, + ), ) } diff --git a/komga/src/test/kotlin/org/gotson/komga/domain/service/FileSystemScannerTest.kt b/komga/src/test/kotlin/org/gotson/komga/domain/service/FileSystemScannerTest.kt index 5140be9a8..1b7e32c79 100644 --- a/komga/src/test/kotlin/org/gotson/komga/domain/service/FileSystemScannerTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/domain/service/FileSystemScannerTest.kt @@ -123,7 +123,7 @@ class FileSystemScannerTest { val subDirs = listOf( "series1" to listOf("volume1.cbz", "volume2.cbz"), - "series2" to listOf("book1.cbz", "book2.cbz") + "series2" to listOf("book1.cbz", "book2.cbz"), ).toMap() subDirs.forEach { (dir, files) -> @@ -140,13 +140,13 @@ class FileSystemScannerTest { assertThat(series.map { it.name }).containsExactlyInAnyOrderElementsOf(subDirs.keys) series.forEach { s -> assertThat( - scan.getValue(s).map { it.name } + scan.getValue(s).map { it.name }, ).containsExactlyInAnyOrderElementsOf( subDirs[s.name]?.map { FilenameUtils.removeExtension( - it + it, ) - } + }, ) } } @@ -164,7 +164,7 @@ class FileSystemScannerTest { val subDirs = listOf( "series1" to listOf("volume1.cbz", "volume2.cbz"), - "series2" to listOf("book1.cbz", "book2.cbz") + "series2" to listOf("book1.cbz", "book2.cbz"), ).toMap() subDirs.forEach { (dir, files) -> @@ -181,13 +181,13 @@ class FileSystemScannerTest { assertThat(series.map { it.name }).containsExactlyInAnyOrderElementsOf(subDirs.keys) series.forEach { s -> assertThat( - scan.getValue(s).map { it.name } + scan.getValue(s).map { it.name }, ).containsExactlyInAnyOrderElementsOf( subDirs[s.name]?.map { FilenameUtils.removeExtension( - it + it, ) - } + }, ) } } @@ -202,7 +202,7 @@ class FileSystemScannerTest { val subDirs = listOf( "series1" to listOf("volume1.cbz", "volume2.cbz"), - "series2" to listOf("book1.cbz", "book2.cbz") + "series2" to listOf("book1.cbz", "book2.cbz"), ).toMap() subDirs.forEach { (dir, files) -> @@ -220,13 +220,13 @@ class FileSystemScannerTest { assertThat(series.map { it.name }).containsExactlyInAnyOrderElementsOf(subDirs.keys + subDirs.keys.map { "${it}_link" }) series.forEach { s -> assertThat( - scan.getValue(s).map { it.name } + scan.getValue(s).map { it.name }, ).containsExactlyInAnyOrderElementsOf( subDirs[s.name.removeSuffix("_link")]?.map { FilenameUtils.removeExtension( - it + it, ) - } + }, ) } } diff --git a/komga/src/test/kotlin/org/gotson/komga/domain/service/LibraryContentLifecycleTest.kt b/komga/src/test/kotlin/org/gotson/komga/domain/service/LibraryContentLifecycleTest.kt index 6ef366605..71c44bc42 100644 --- a/komga/src/test/kotlin/org/gotson/komga/domain/service/LibraryContentLifecycleTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/domain/service/LibraryContentLifecycleTest.kt @@ -760,7 +760,7 @@ class LibraryContentLifecycleTest( bookMetadataRepository.findById(it.id).copy( title = "Updated Title", titleLock = true, - ) + ), ) } @@ -1130,7 +1130,7 @@ class LibraryContentLifecycleTest( bookMetadataRepository.findById(it.id).copy( title = "Updated Title", titleLock = true, - ) + ), ) } diff --git a/komga/src/test/kotlin/org/gotson/komga/domain/service/LibraryLifecycleTest.kt b/komga/src/test/kotlin/org/gotson/komga/domain/service/LibraryLifecycleTest.kt index e50039a62..7304a510b 100644 --- a/komga/src/test/kotlin/org/gotson/komga/domain/service/LibraryLifecycleTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/domain/service/LibraryLifecycleTest.kt @@ -22,7 +22,7 @@ import java.nio.file.Files @SpringBootTest class LibraryLifecycleTest( @Autowired private val libraryRepository: LibraryRepository, - @Autowired private val libraryLifecycle: LibraryLifecycle + @Autowired private val libraryLifecycle: LibraryLifecycle, ) { @AfterEach diff --git a/komga/src/test/kotlin/org/gotson/komga/domain/service/ReadListMatcherTest.kt b/komga/src/test/kotlin/org/gotson/komga/domain/service/ReadListMatcherTest.kt index f096f5790..2d40aed00 100644 --- a/komga/src/test/kotlin/org/gotson/komga/domain/service/ReadListMatcherTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/domain/service/ReadListMatcherTest.kt @@ -103,7 +103,7 @@ class ReadListMatcherTest( ReadListRequestBook(series = "joker", number = "02"), ReadListRequestBook(series = "Batman: White Knight", number = "2"), ReadListRequestBook(series = "joker", number = "25"), - ) + ), ) // when @@ -123,7 +123,7 @@ class ReadListMatcherTest( 1 to booksSeries2[1].id, 2 to booksSeries1[1].id, 3 to booksSeries2[0].id, - ) + ), ) } } @@ -133,7 +133,7 @@ class ReadListMatcherTest( fun `given request with existing read list when matching then result has no readlist and appropriate error code`() { // given readListLifecycle.addReadList( - ReadList(name = "my ReadList") + ReadList(name = "my ReadList"), ) val request = ReadListRequest( @@ -143,7 +143,7 @@ class ReadListMatcherTest( ReadListRequestBook(series = "joker", number = "2"), ReadListRequestBook(series = "BATMAN: WHITE KNIGHT", number = "2"), ReadListRequestBook(series = "joker", number = "25"), - ) + ), ) // when @@ -194,7 +194,7 @@ class ReadListMatcherTest( ReadListRequestBook(series = "batman", number = "3"), ReadListRequestBook(series = "joker", number = "3"), ReadListRequestBook(series = "batman", number = "2"), - ) + ), ) // when @@ -240,7 +240,7 @@ class ReadListMatcherTest( ReadListRequestBook(series = "batman", number = "1"), ReadListRequestBook(series = "batman", number = "2"), ReadListRequestBook(series = "batman", number = "2"), - ) + ), ) // when @@ -256,7 +256,7 @@ class ReadListMatcherTest( mapOf( 0 to booksSeries1[0].id, 1 to booksSeries1[1].id, - ) + ), ) } diff --git a/komga/src/test/kotlin/org/gotson/komga/domain/service/SeriesLifecycleTest.kt b/komga/src/test/kotlin/org/gotson/komga/domain/service/SeriesLifecycleTest.kt index 20c8a73c1..4886abaef 100644 --- a/komga/src/test/kotlin/org/gotson/komga/domain/service/SeriesLifecycleTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/domain/service/SeriesLifecycleTest.kt @@ -45,7 +45,7 @@ class SeriesLifecycleTest( @Autowired private val bookRepository: BookRepository, @Autowired private val libraryRepository: LibraryRepository, @Autowired private val thumbnailSeriesRepository: ThumbnailSeriesRepository, - @Autowired private val thumbnailBookRepository: ThumbnailBookRepository + @Autowired private val thumbnailBookRepository: ThumbnailBookRepository, ) { @SpykBean @@ -86,7 +86,7 @@ class SeriesLifecycleTest( makeBook(" book 3", libraryId = library.id), makeBook("book 4 ", libraryId = library.id), makeBook("book 6", libraryId = library.id), - makeBook("book 002", libraryId = library.id) + makeBook("book 002", libraryId = library.id), ) val createdSeries = makeSeries(name = "series", libraryId = library.id).let { seriesLifecycle.createSeries(it) @@ -112,7 +112,7 @@ class SeriesLifecycleTest( makeBook("book 1", libraryId = library.id), makeBook("book 2", libraryId = library.id), makeBook("book 3", libraryId = library.id), - makeBook("book 4", libraryId = library.id) + makeBook("book 4", libraryId = library.id), ) val createdSeries = makeSeries(name = "series", libraryId = library.id).let { seriesLifecycle.createSeries(it) @@ -141,7 +141,7 @@ class SeriesLifecycleTest( makeBook("book 1", libraryId = library.id), makeBook("book 2", libraryId = library.id), makeBook("book 4", libraryId = library.id), - makeBook("book 5", libraryId = library.id) + makeBook("book 5", libraryId = library.id), ) val createdSeries = makeSeries(name = "series", libraryId = library.id).let { seriesLifecycle.createSeries(it) diff --git a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jms/ArtemisConfigTest.kt b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jms/ArtemisConfigTest.kt index 5b153f5fd..66bc1dac3 100644 --- a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jms/ArtemisConfigTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jms/ArtemisConfigTest.kt @@ -18,7 +18,7 @@ private val logger = KotlinLogging.logger {} @ExtendWith(SpringExtension::class) @SpringBootTest class ArtemisConfigTest( - @Autowired private val jmsTemplate: JmsTemplate + @Autowired private val jmsTemplate: JmsTemplate, ) { init { @@ -37,7 +37,7 @@ class ArtemisConfigTest( for (i in 1..5) { jmsTemplate.convertAndSend( QUEUE_TASKS, - "message $i" + "message $i", ) { it.apply { setStringProperty(QUEUE_UNIQUE_ID, "1") } } @@ -58,7 +58,7 @@ class ArtemisConfigTest( for (i in 1..6) { jmsTemplate.convertAndSend( QUEUE_TASKS, - "message $i" + "message $i", ) { it.apply { setStringProperty(QUEUE_UNIQUE_ID, i.rem(2).toString()) } } @@ -79,7 +79,7 @@ class ArtemisConfigTest( for (i in 1..5) { jmsTemplate.convertAndSend( QUEUE_TASKS, - "message $i" + "message $i", ) } @@ -100,7 +100,7 @@ class ArtemisConfigTest( jmsTemplate.isExplicitQosEnabled = true jmsTemplate.convertAndSend( QUEUE_TASKS, - "message A $i" + "message A $i", ) } @@ -109,7 +109,7 @@ class ArtemisConfigTest( jmsTemplate.isExplicitQosEnabled = true jmsTemplate.convertAndSend( QUEUE_TASKS, - "message B $i" + "message B $i", ) } diff --git a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/BookDaoTest.kt b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/BookDaoTest.kt index f7e39d7d4..ccc44185a 100644 --- a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/BookDaoTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/BookDaoTest.kt @@ -24,7 +24,7 @@ import java.time.LocalDateTime class BookDaoTest( @Autowired private val bookDao: BookDao, @Autowired private val seriesRepository: SeriesRepository, - @Autowired private val libraryRepository: LibraryRepository + @Autowired private val libraryRepository: LibraryRepository, ) { private val library = makeLibrary() @@ -125,7 +125,7 @@ class BookDaoTest( fileLastModified = LocalDateTime.now(), fileSize = 3, seriesId = series.id, - libraryId = library.id + libraryId = library.id, ) bookDao.insert(book) @@ -159,7 +159,7 @@ class BookDaoTest( val search = BookSearch( libraryIds = listOf(library.id), - seriesIds = listOf(series.id) + seriesIds = listOf(series.id), ) val found = bookDao.findAll(search) diff --git a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/BookDtoDaoTest.kt b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/BookDtoDaoTest.kt index 2c7b24695..4c83502a9 100644 --- a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/BookDtoDaoTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/BookDtoDaoTest.kt @@ -102,7 +102,7 @@ class BookDtoDaoTest( series, (1..3).map { makeBook("$it", seriesId = series.id, libraryId = library.id) - } + }, ) val books = bookRepository.findAll().sortedBy { it.name } @@ -121,7 +121,7 @@ class BookDtoDaoTest( val found = bookDtoDao.findAll( BookSearchWithReadProgress(readStatus = listOf(ReadStatus.READ)), user.id, - PageRequest.of(0, 20) + PageRequest.of(0, 20), ) // then @@ -139,7 +139,7 @@ class BookDtoDaoTest( val found = bookDtoDao.findAll( BookSearchWithReadProgress(readStatus = listOf(ReadStatus.UNREAD)), user.id, - PageRequest.of(0, 20) + PageRequest.of(0, 20), ) // then @@ -157,7 +157,7 @@ class BookDtoDaoTest( val found = bookDtoDao.findAll( BookSearchWithReadProgress(readStatus = listOf(ReadStatus.IN_PROGRESS)), user.id, - PageRequest.of(0, 20) + PageRequest.of(0, 20), ) // then @@ -175,7 +175,7 @@ class BookDtoDaoTest( val found = bookDtoDao.findAll( BookSearchWithReadProgress(readStatus = listOf(ReadStatus.READ, ReadStatus.UNREAD)), user.id, - PageRequest.of(0, 20) + PageRequest.of(0, 20), ) // then @@ -192,7 +192,7 @@ class BookDtoDaoTest( val found = bookDtoDao.findAll( BookSearchWithReadProgress(readStatus = listOf(ReadStatus.READ, ReadStatus.IN_PROGRESS)), user.id, - PageRequest.of(0, 20) + PageRequest.of(0, 20), ) // then @@ -209,7 +209,7 @@ class BookDtoDaoTest( val found = bookDtoDao.findAll( BookSearchWithReadProgress(readStatus = listOf(ReadStatus.UNREAD, ReadStatus.IN_PROGRESS)), user.id, - PageRequest.of(0, 20) + PageRequest.of(0, 20), ) // then @@ -226,7 +226,7 @@ class BookDtoDaoTest( val found = bookDtoDao.findAll( BookSearchWithReadProgress(readStatus = listOf(ReadStatus.UNREAD, ReadStatus.IN_PROGRESS, ReadStatus.READ)), user.id, - PageRequest.of(0, 20) + PageRequest.of(0, 20), ) // then @@ -243,7 +243,7 @@ class BookDtoDaoTest( val found = bookDtoDao.findAll( BookSearchWithReadProgress(), user.id, - PageRequest.of(0, 20) + PageRequest.of(0, 20), ) // then @@ -263,7 +263,7 @@ class BookDtoDaoTest( val found = bookDtoDao.findAllOnDeck( user.id, null, - PageRequest.of(0, 20) + PageRequest.of(0, 20), ) // then @@ -277,14 +277,14 @@ class BookDtoDaoTest( series, (1..3).map { makeBook("$it", seriesId = series.id, libraryId = library.id) - } + }, ) // when val found = bookDtoDao.findAllOnDeck( user.id, null, - PageRequest.of(0, 20) + PageRequest.of(0, 20), ) // then @@ -298,7 +298,7 @@ class BookDtoDaoTest( series, (1..3).map { makeBook("$it", seriesId = series.id, libraryId = library.id) - } + }, ) val books = bookRepository.findAll().sortedBy { it.name } @@ -308,7 +308,7 @@ class BookDtoDaoTest( val found = bookDtoDao.findAllOnDeck( user.id, null, - PageRequest.of(0, 20) + PageRequest.of(0, 20), ) // then @@ -329,7 +329,7 @@ class BookDtoDaoTest( makeBook("Robin", seriesId = series.id, libraryId = library.id), makeBook("Batman and Robin", seriesId = series.id, libraryId = library.id), makeBook("Batman", seriesId = series.id, libraryId = library.id), - ) + ), ) searchIndexLifecycle.rebuildIndex() @@ -357,7 +357,7 @@ class BookDtoDaoTest( makeBook("Robin", seriesId = series.id, libraryId = library.id), makeBook("Batman and Robin", seriesId = series.id, libraryId = library.id), makeBook("Batman", seriesId = series.id, libraryId = library.id), - ) + ), ) bookMetadataRepository.findById(book1.id).let { @@ -389,7 +389,7 @@ class BookDtoDaoTest( makeBook("Robin", seriesId = series.id, libraryId = library.id), makeBook("Batman and Robin", seriesId = series.id, libraryId = library.id), makeBook("Batman", seriesId = series.id, libraryId = library.id), - ) + ), ) bookMetadataRepository.findById(book1.id).let { @@ -418,7 +418,7 @@ class BookDtoDaoTest( series, listOf( book1, - ) + ), ) bookMetadataRepository.findById(book1.id).let { @@ -447,7 +447,7 @@ class BookDtoDaoTest( series, listOf( book1, - ) + ), ) bookMetadataRepository.findById(book1.id).let { @@ -567,7 +567,7 @@ class BookDtoDaoTest( listOf( book1, makeBook("Batman", seriesId = series.id, libraryId = library.id), - ) + ), ) searchIndexLifecycle.rebuildIndex() @@ -592,7 +592,7 @@ class BookDtoDaoTest( listOf( makeBook("S.W.O.R.D.", seriesId = series.id, libraryId = library.id), makeBook("Batman", seriesId = series.id, libraryId = library.id), - ) + ), ) searchIndexLifecycle.rebuildIndex() @@ -619,7 +619,7 @@ class BookDtoDaoTest( makeBook("Robin and Batman", seriesId = series.id, libraryId = library.id), makeBook("Batman and Robin", seriesId = series.id, libraryId = library.id), makeBook("Batman", seriesId = series.id, libraryId = library.id), - ) + ), ) searchIndexLifecycle.rebuildIndex() @@ -645,7 +645,7 @@ class BookDtoDaoTest( makeBook("Batman", seriesId = series.id, libraryId = library.id), makeBook("Another X-Men adventure", seriesId = series.id, libraryId = library.id), makeBook("X-Men", seriesId = series.id, libraryId = library.id), - ) + ), ) searchIndexLifecycle.rebuildIndex() @@ -684,7 +684,7 @@ class BookDtoDaoTest( series, listOf( makeBook("[不道德公會][河添太一 ][東立]Vol.04-搬运", seriesId = series.id, libraryId = library.id, url = URL("file:/file.cbz")), - ) + ), ) searchIndexLifecycle.rebuildIndex() diff --git a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/BookMetadataAggregationDaoTest.kt b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/BookMetadataAggregationDaoTest.kt index 323ba6eba..747398b61 100644 --- a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/BookMetadataAggregationDaoTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/BookMetadataAggregationDaoTest.kt @@ -24,7 +24,7 @@ import java.time.LocalDateTime class BookMetadataAggregationDaoTest( @Autowired private val bookMetadataAggregationDao: BookMetadataAggregationDao, @Autowired private val seriesRepository: SeriesRepository, - @Autowired private val libraryRepository: LibraryRepository + @Autowired private val libraryRepository: LibraryRepository, ) { private val library = makeLibrary() @@ -58,7 +58,7 @@ class BookMetadataAggregationDaoTest( releaseDate = LocalDate.now(), summary = "Summary", summaryNumber = "1", - seriesId = series.id + seriesId = series.id, ) bookMetadataAggregationDao.insert(metadata) @@ -84,7 +84,7 @@ class BookMetadataAggregationDaoTest( val now = LocalDateTime.now() val metadata = BookMetadataAggregation( - seriesId = series.id + seriesId = series.id, ) bookMetadataAggregationDao.insert(metadata) @@ -109,7 +109,7 @@ class BookMetadataAggregationDaoTest( tags = setOf("tag1", "tag2"), releaseDate = LocalDate.now(), summary = "Summary", - seriesId = series.id + seriesId = series.id, ) bookMetadataAggregationDao.insert(metadata) @@ -144,7 +144,7 @@ class BookMetadataAggregationDaoTest( releaseDate = LocalDate.now(), summary = "Summary", summaryNumber = "1", - seriesId = series.id + seriesId = series.id, ) bookMetadataAggregationDao.insert(metadata) val created = bookMetadataAggregationDao.findById(metadata.seriesId) diff --git a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/KomgaUserDaoTest.kt b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/KomgaUserDaoTest.kt index 5cc7c204c..2f0c44c26 100644 --- a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/KomgaUserDaoTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/KomgaUserDaoTest.kt @@ -18,7 +18,7 @@ import java.time.LocalDateTime @SpringBootTest class KomgaUserDaoTest( @Autowired private val komgaUserDao: KomgaUserDao, - @Autowired private val libraryRepository: LibraryRepository + @Autowired private val libraryRepository: LibraryRepository, ) { private val library = makeLibrary() @@ -47,7 +47,7 @@ class KomgaUserDaoTest( password = "password", roleAdmin = false, sharedLibrariesIds = setOf(library.id), - sharedAllLibraries = false + sharedAllLibraries = false, ) komgaUserDao.insert(user) @@ -72,7 +72,7 @@ class KomgaUserDaoTest( password = "password", roleAdmin = false, sharedLibrariesIds = setOf(library.id), - sharedAllLibraries = false + sharedAllLibraries = false, ) komgaUserDao.insert(user) @@ -83,7 +83,7 @@ class KomgaUserDaoTest( password = "password2", roleAdmin = true, sharedLibrariesIds = emptySet(), - sharedAllLibraries = true + sharedAllLibraries = true, ) val modifiedDate = LocalDateTime.now() komgaUserDao.update(modified) @@ -113,7 +113,7 @@ class KomgaUserDaoTest( assertThat(users).hasSize(2) assertThat(users.map { it.email }).containsExactlyInAnyOrder( "user1@example.org", - "user2@example.org" + "user2@example.org", ) } @@ -157,7 +157,7 @@ class KomgaUserDaoTest( @Test fun `given users when checking if exists by email then return true or false`() { komgaUserDao.insert( - KomgaUser("user1@example.org", "p", false) + KomgaUser("user1@example.org", "p", false), ) val exists = komgaUserDao.existsByEmailIgnoreCase("USER1@EXAMPLE.ORG") @@ -170,7 +170,7 @@ class KomgaUserDaoTest( @Test fun `given users when finding by email then return user`() { komgaUserDao.insert( - KomgaUser("user1@example.org", "p", false) + KomgaUser("user1@example.org", "p", false), ) val found = komgaUserDao.findByEmailIgnoreCaseOrNull("USER1@EXAMPLE.ORG") diff --git a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/LibraryDaoTest.kt b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/LibraryDaoTest.kt index c70a80f73..dc8b91377 100644 --- a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/LibraryDaoTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/LibraryDaoTest.kt @@ -14,7 +14,7 @@ import java.time.LocalDateTime @ExtendWith(SpringExtension::class) @SpringBootTest class LibraryDaoTest( - @Autowired private val libraryDao: LibraryDao + @Autowired private val libraryDao: LibraryDao, ) { @AfterEach @@ -28,7 +28,7 @@ class LibraryDaoTest( val now = LocalDateTime.now() val library = Library( name = "Library", - root = URL("file://library") + root = URL("file://library"), ) libraryDao.insert(library) @@ -45,7 +45,7 @@ class LibraryDaoTest( fun `given existing library when updating then it is persisted`() { val library = Library( name = "Library", - root = URL("file://library") + root = URL("file://library"), ) libraryDao.insert(library) @@ -101,7 +101,7 @@ class LibraryDaoTest( fun `given a library when deleting then it is deleted`() { val library = Library( name = "Library", - root = URL("file://library") + root = URL("file://library"), ) libraryDao.insert(library) @@ -116,11 +116,11 @@ class LibraryDaoTest( fun `given libraries when deleting all then all are deleted`() { val library = Library( name = "Library", - root = URL("file://library") + root = URL("file://library"), ) val library2 = Library( name = "Library2", - root = URL("file://library2") + root = URL("file://library2"), ) libraryDao.insert(library) @@ -136,11 +136,11 @@ class LibraryDaoTest( fun `given libraries when finding all then all are returned`() { val library = Library( name = "Library", - root = URL("file://library") + root = URL("file://library"), ) val library2 = Library( name = "Library2", - root = URL("file://library2") + root = URL("file://library2"), ) libraryDao.insert(library) @@ -156,11 +156,11 @@ class LibraryDaoTest( fun `given libraries when finding all by id then all are returned`() { val library = Library( name = "Library", - root = URL("file://library") + root = URL("file://library"), ) val library2 = Library( name = "Library2", - root = URL("file://library2") + root = URL("file://library2"), ) libraryDao.insert(library) @@ -176,7 +176,7 @@ class LibraryDaoTest( fun `given existing library when finding by id then library is returned`() { val library = Library( name = "Library", - root = URL("file://library") + root = URL("file://library"), ) libraryDao.insert(library) diff --git a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/MediaDaoTest.kt b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/MediaDaoTest.kt index 80bca15d0..791d8ccae 100644 --- a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/MediaDaoTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/MediaDaoTest.kt @@ -26,7 +26,7 @@ class MediaDaoTest( @Autowired private val mediaDao: MediaDao, @Autowired private val bookRepository: BookRepository, @Autowired private val seriesRepository: SeriesRepository, - @Autowired private val libraryRepository: LibraryRepository + @Autowired private val libraryRepository: LibraryRepository, ) { private val library = makeLibrary() private val series = makeSeries("Series") @@ -64,12 +64,12 @@ class MediaDaoTest( pages = listOf( BookPage( fileName = "1.jpg", - mediaType = "image/jpeg" - ) + mediaType = "image/jpeg", + ), ), files = listOf("ComicInfo.xml"), comment = "comment", - bookId = book.id + bookId = book.id, ) mediaDao.insert(media) @@ -113,12 +113,12 @@ class MediaDaoTest( pages = listOf( BookPage( fileName = "1.jpg", - mediaType = "image/jpeg" - ) + mediaType = "image/jpeg", + ), ), files = listOf("ComicInfo.xml"), comment = "comment", - bookId = book.id + bookId = book.id, ) mediaDao.insert(media) @@ -131,11 +131,11 @@ class MediaDaoTest( pages = listOf( BookPage( fileName = "2.png", - mediaType = "image/png" - ) + mediaType = "image/png", + ), ), files = listOf("id.txt"), - comment = "comment2" + comment = "comment2", ) } @@ -163,12 +163,12 @@ class MediaDaoTest( pages = listOf( BookPage( fileName = "1.jpg", - mediaType = "image/jpeg" - ) + mediaType = "image/jpeg", + ), ), files = listOf("ComicInfo.xml"), comment = "comment", - bookId = book.id + bookId = book.id, ) mediaDao.insert(media) diff --git a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/ReadListDaoTest.kt b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/ReadListDaoTest.kt index 575e3c237..21dd6d974 100644 --- a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/ReadListDaoTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/ReadListDaoTest.kt @@ -26,7 +26,7 @@ class ReadListDaoTest( @Autowired private val readListDao: ReadListDao, @Autowired private val bookRepository: BookRepository, @Autowired private val seriesRepository: SeriesRepository, - @Autowired private val libraryRepository: LibraryRepository + @Autowired private val libraryRepository: LibraryRepository, ) { private val library = makeLibrary() @@ -61,7 +61,7 @@ class ReadListDaoTest( val readList = ReadList( name = "MyReadList", summary = "summary", - bookIds = books.map { it.id }.toIndexedMap() + bookIds = books.map { it.id }.toIndexedMap(), ) // when @@ -89,7 +89,7 @@ class ReadListDaoTest( val readList = ReadList( name = "MyReadList", - bookIds = books.map { it.id }.toIndexedMap() + bookIds = books.map { it.id }.toIndexedMap(), ) readListDao.insert(readList) @@ -98,7 +98,7 @@ class ReadListDaoTest( val updatedReadList = readList.copy( name = "UpdatedReadList", summary = "summary", - bookIds = readList.bookIds.values.take(5).toIndexedMap() + bookIds = readList.bookIds.values.take(5).toIndexedMap(), ) val now = LocalDateTime.now() @@ -125,13 +125,13 @@ class ReadListDaoTest( val readList1 = ReadList( name = "MyReadList", - bookIds = books.map { it.id }.toIndexedMap() + bookIds = books.map { it.id }.toIndexedMap(), ) readListDao.insert(readList1) val readList2 = ReadList( name = "MyReadList", - bookIds = books.map { it.id }.take(5).toIndexedMap() + bookIds = books.map { it.id }.take(5).toIndexedMap(), ) readListDao.insert(readList2) @@ -161,22 +161,22 @@ class ReadListDaoTest( readListDao.insert( ReadList( name = "readListLibrary1", - bookIds = listOf(bookLibrary1.id).toIndexedMap() - ) + bookIds = listOf(bookLibrary1.id).toIndexedMap(), + ), ) readListDao.insert( ReadList( name = "readListLibrary2", - bookIds = listOf(bookLibrary2.id).toIndexedMap() - ) + bookIds = listOf(bookLibrary2.id).toIndexedMap(), + ), ) readListDao.insert( ReadList( name = "readListLibraryBoth", - bookIds = listOf(bookLibrary1.id, bookLibrary2.id).toIndexedMap() - ) + bookIds = listOf(bookLibrary1.id, bookLibrary2.id).toIndexedMap(), + ), ) // when diff --git a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/ReadProgressDaoTest.kt b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/ReadProgressDaoTest.kt index ac4126a5e..a01cf19cc 100644 --- a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/ReadProgressDaoTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/ReadProgressDaoTest.kt @@ -27,7 +27,7 @@ class ReadProgressDaoTest( @Autowired private val userRepository: KomgaUserRepository, @Autowired private val bookRepository: BookRepository, @Autowired private val seriesRepository: SeriesRepository, - @Autowired private val libraryRepository: LibraryRepository + @Autowired private val libraryRepository: LibraryRepository, ) { private val library = makeLibrary() private val series = makeSeries("Series") @@ -70,8 +70,8 @@ class ReadProgressDaoTest( book1.id, user1.id, 5, - false - ) + false, + ), ) val readProgressList = readProgressDao.findAllByUserId(user1.id) @@ -95,8 +95,8 @@ class ReadProgressDaoTest( book1.id, user1.id, 5, - false - ) + false, + ), ) val modificationDate = LocalDateTime.now() @@ -109,7 +109,7 @@ class ReadProgressDaoTest( 10, true, readDate = readDateInThePast, - ) + ), ) val readProgressList = readProgressDao.findAllByUserId(user1.id) diff --git a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/SeriesCollectionDaoTest.kt b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/SeriesCollectionDaoTest.kt index 2f0390a36..b5ab2d5fe 100644 --- a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/SeriesCollectionDaoTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/SeriesCollectionDaoTest.kt @@ -22,7 +22,7 @@ import java.time.LocalDateTime class SeriesCollectionDaoTest( @Autowired private val collectionDao: SeriesCollectionDao, @Autowired private val seriesRepository: SeriesRepository, - @Autowired private val libraryRepository: LibraryRepository + @Autowired private val libraryRepository: LibraryRepository, ) { private val library = makeLibrary() @@ -53,7 +53,7 @@ class SeriesCollectionDaoTest( val collection = SeriesCollection( name = "MyCollection", - seriesIds = series.map { it.id } + seriesIds = series.map { it.id }, ) // when @@ -79,7 +79,7 @@ class SeriesCollectionDaoTest( val collection = SeriesCollection( name = "MyCollection", - seriesIds = series.map { it.id } + seriesIds = series.map { it.id }, ) collectionDao.insert(collection) @@ -88,7 +88,7 @@ class SeriesCollectionDaoTest( val updatedCollection = collection.copy( name = "UpdatedCollection", ordered = true, - seriesIds = collection.seriesIds.take(5) + seriesIds = collection.seriesIds.take(5), ) val now = LocalDateTime.now() @@ -113,13 +113,13 @@ class SeriesCollectionDaoTest( val collection1 = SeriesCollection( name = "MyCollection", - seriesIds = series.map { it.id } + seriesIds = series.map { it.id }, ) collectionDao.insert(collection1) val collection2 = SeriesCollection( name = "MyCollection2", - seriesIds = series.map { it.id }.take(5) + seriesIds = series.map { it.id }.take(5), ) collectionDao.insert(collection2) @@ -147,22 +147,22 @@ class SeriesCollectionDaoTest( collectionDao.insert( SeriesCollection( name = "collectionLibrary1", - seriesIds = listOf(seriesLibrary1.id) - ) + seriesIds = listOf(seriesLibrary1.id), + ), ) collectionDao.insert( SeriesCollection( name = "collectionLibrary2", - seriesIds = listOf(seriesLibrary2.id) - ) + seriesIds = listOf(seriesLibrary2.id), + ), ) collectionDao.insert( SeriesCollection( name = "collectionLibraryBoth", - seriesIds = listOf(seriesLibrary1.id, seriesLibrary2.id) - ) + seriesIds = listOf(seriesLibrary1.id, seriesLibrary2.id), + ), ) // when diff --git a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDaoTest.kt b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDaoTest.kt index 3497de2c4..307bafe8a 100644 --- a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDaoTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDaoTest.kt @@ -20,7 +20,7 @@ import java.time.LocalDateTime @SpringBootTest class SeriesDaoTest( @Autowired private val seriesDao: SeriesDao, - @Autowired private val libraryRepository: LibraryRepository + @Autowired private val libraryRepository: LibraryRepository, ) { private val library = makeLibrary() @@ -107,7 +107,7 @@ class SeriesDaoTest( name = "Series", url = URL("file://series"), fileLastModified = LocalDateTime.now(), - libraryId = library.id + libraryId = library.id, ) seriesDao.insert(series) @@ -125,14 +125,14 @@ class SeriesDaoTest( name = "Series", url = URL("file://series"), fileLastModified = now, - libraryId = library.id + libraryId = library.id, ) val series2 = Series( name = "Series2", url = URL("file://series2"), fileLastModified = now, - libraryId = library.id + libraryId = library.id, ) seriesDao.insert(series) @@ -151,14 +151,14 @@ class SeriesDaoTest( name = "Series", url = URL("file://series"), fileLastModified = now, - libraryId = library.id + libraryId = library.id, ) val series2 = Series( name = "Series2", url = URL("file://series2"), fileLastModified = now, - libraryId = library.id + libraryId = library.id, ) seriesDao.insert(series) @@ -176,7 +176,7 @@ class SeriesDaoTest( name = "Series", url = URL("file://series"), fileLastModified = LocalDateTime.now(), - libraryId = library.id + libraryId = library.id, ) seriesDao.insert(series) @@ -200,13 +200,13 @@ class SeriesDaoTest( name = "Series", url = URL("file://series"), fileLastModified = LocalDateTime.now(), - libraryId = library.id + libraryId = library.id, ) seriesDao.insert(series) val search = SeriesSearch( - libraryIds = listOf(library.id) + libraryIds = listOf(library.id), ) val found = seriesDao.findAll(search) @@ -219,7 +219,7 @@ class SeriesDaoTest( name = "my Series", url = URL("file://series"), fileLastModified = LocalDateTime.now(), - libraryId = library.id + libraryId = library.id, ) seriesDao.insert(series) @@ -234,7 +234,7 @@ class SeriesDaoTest( name = "Series", url = URL("file://series"), fileLastModified = LocalDateTime.now(), - libraryId = library.id + libraryId = library.id, ) seriesDao.insert(series) @@ -250,7 +250,7 @@ class SeriesDaoTest( name = "Series", url = URL("file://series"), fileLastModified = LocalDateTime.now(), - libraryId = library.id + libraryId = library.id, ) seriesDao.insert(series) @@ -265,7 +265,7 @@ class SeriesDaoTest( name = "Series", url = URL("file://series"), fileLastModified = LocalDateTime.now(), - libraryId = library.id + libraryId = library.id, ) seriesDao.insert(series) @@ -284,7 +284,7 @@ class SeriesDaoTest( name = "Series", url = URL("file://series"), fileLastModified = LocalDateTime.now(), - libraryId = library.id + libraryId = library.id, ) seriesDao.insert(series) diff --git a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDtoDaoTest.kt b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDtoDaoTest.kt index fdcf579cc..6f44e6ae5 100644 --- a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDtoDaoTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/SeriesDtoDaoTest.kt @@ -103,7 +103,7 @@ class SeriesDtoDaoTest( created, (1..3).map { makeBook("$it", seriesId = created.id, libraryId = library.id) - } + }, ) seriesLifecycle.sortBooks(created) } @@ -137,7 +137,7 @@ class SeriesDtoDaoTest( val found = seriesDtoDao.findAll( SeriesSearchWithReadProgress(readStatus = listOf(ReadStatus.READ)), user.id, - PageRequest.of(0, 20) + PageRequest.of(0, 20), ).sortedBy { it.name } // then @@ -156,7 +156,7 @@ class SeriesDtoDaoTest( val found = seriesDtoDao.findAll( SeriesSearchWithReadProgress(readStatus = listOf(ReadStatus.UNREAD)), user.id, - PageRequest.of(0, 20) + PageRequest.of(0, 20), ).sortedBy { it.name } // then @@ -175,7 +175,7 @@ class SeriesDtoDaoTest( val found = seriesDtoDao.findAll( SeriesSearchWithReadProgress(readStatus = listOf(ReadStatus.IN_PROGRESS)), user.id, - PageRequest.of(0, 20) + PageRequest.of(0, 20), ).sortedBy { it.name } // then @@ -197,7 +197,7 @@ class SeriesDtoDaoTest( val found = seriesDtoDao.findAll( SeriesSearchWithReadProgress(readStatus = listOf(ReadStatus.READ, ReadStatus.UNREAD)), user.id, - PageRequest.of(0, 20) + PageRequest.of(0, 20), ).sortedBy { it.name } // then @@ -214,7 +214,7 @@ class SeriesDtoDaoTest( val found = seriesDtoDao.findAll( SeriesSearchWithReadProgress(readStatus = listOf(ReadStatus.READ, ReadStatus.IN_PROGRESS)), user.id, - PageRequest.of(0, 20) + PageRequest.of(0, 20), ).sortedBy { it.name } // then @@ -231,7 +231,7 @@ class SeriesDtoDaoTest( val found = seriesDtoDao.findAll( SeriesSearchWithReadProgress(readStatus = listOf(ReadStatus.UNREAD, ReadStatus.IN_PROGRESS)), user.id, - PageRequest.of(0, 20) + PageRequest.of(0, 20), ).sortedBy { it.name } // then @@ -248,7 +248,7 @@ class SeriesDtoDaoTest( val found = seriesDtoDao.findAll( SeriesSearchWithReadProgress(readStatus = listOf(ReadStatus.READ, ReadStatus.IN_PROGRESS, ReadStatus.UNREAD)), user.id, - PageRequest.of(0, 20) + PageRequest.of(0, 20), ).sortedBy { it.name } // then @@ -265,7 +265,7 @@ class SeriesDtoDaoTest( val found = seriesDtoDao.findAll( SeriesSearchWithReadProgress(), user.id, - PageRequest.of(0, 20) + PageRequest.of(0, 20), ).sortedBy { it.name } // then @@ -546,8 +546,8 @@ class SeriesDtoDaoTest( series, listOf( makeBook("Batman 01", seriesId = series.id, libraryId = library.id), - makeBook("Batman 02", seriesId = series.id, libraryId = library.id) - ) + makeBook("Batman 02", seriesId = series.id, libraryId = library.id), + ), ) seriesLifecycle.sortBooks(series) seriesLifecycle.createSeries(makeSeries("Batman and Robin", library.id)) @@ -582,9 +582,9 @@ class SeriesDtoDaoTest( bookMetadataRepository.update( it.copy( authors = listOf( - Author("David", "penciller") - ) - ) + Author("David", "penciller"), + ), + ), ) } diff --git a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/SeriesMetadataDaoTest.kt b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/SeriesMetadataDaoTest.kt index 31946709c..abf9b874f 100644 --- a/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/SeriesMetadataDaoTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/infrastructure/jooq/SeriesMetadataDaoTest.kt @@ -22,7 +22,7 @@ import java.time.LocalDateTime class SeriesMetadataDaoTest( @Autowired private val seriesMetadataDao: SeriesMetadataDao, @Autowired private val seriesRepository: SeriesRepository, - @Autowired private val libraryRepository: LibraryRepository + @Autowired private val libraryRepository: LibraryRepository, ) { private val library = makeLibrary() @@ -72,7 +72,7 @@ class SeriesMetadataDaoTest( languageLock = true, tagsLock = true, totalBookCountLock = true, - seriesId = series.id + seriesId = series.id, ) seriesMetadataDao.insert(metadata) @@ -114,7 +114,7 @@ class SeriesMetadataDaoTest( val now = LocalDateTime.now() val metadata = SeriesMetadata( title = "Series", - seriesId = series.id + seriesId = series.id, ) seriesMetadataDao.insert(metadata) @@ -157,7 +157,7 @@ class SeriesMetadataDaoTest( status = SeriesMetadata.Status.ENDED, title = "Series", titleSort = "Series, The", - seriesId = series.id + seriesId = series.id, ) seriesMetadataDao.insert(metadata) @@ -198,7 +198,7 @@ class SeriesMetadataDaoTest( genres = setOf("Action"), tags = setOf("tag"), totalBookCount = 3, - seriesId = series.id + seriesId = series.id, ) seriesMetadataDao.insert(metadata) val created = seriesMetadataDao.findById(metadata.seriesId) diff --git a/komga/src/test/kotlin/org/gotson/komga/infrastructure/metadata/localartwork/LocalArtworkProviderTest.kt b/komga/src/test/kotlin/org/gotson/komga/infrastructure/metadata/localartwork/LocalArtworkProviderTest.kt index 5d4dedb88..3e99b52a3 100644 --- a/komga/src/test/kotlin/org/gotson/komga/infrastructure/metadata/localartwork/LocalArtworkProviderTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/infrastructure/metadata/localartwork/LocalArtworkProviderTest.kt @@ -48,8 +48,8 @@ class LocalArtworkProviderTest { Book( name = "Book", url = bookFile.toUri().toURL(), - fileLastModified = LocalDateTime.now() - ) + fileLastModified = LocalDateTime.now(), + ), ) every { book.path } returns bookFile @@ -82,8 +82,8 @@ class LocalArtworkProviderTest { Series( name = "Series", url = seriesFile.toUri().toURL(), - fileLastModified = LocalDateTime.now() - ) + fileLastModified = LocalDateTime.now(), + ), ) every { series.path } returns seriesFile diff --git a/komga/src/test/kotlin/org/gotson/komga/interfaces/api/opds/OpdsControllerTest.kt b/komga/src/test/kotlin/org/gotson/komga/interfaces/api/opds/OpdsControllerTest.kt index 912daa25b..b989503a9 100644 --- a/komga/src/test/kotlin/org/gotson/komga/interfaces/api/opds/OpdsControllerTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/interfaces/api/opds/OpdsControllerTest.kt @@ -44,7 +44,7 @@ class OpdsControllerTest( @Autowired private val mediaRepository: MediaRepository, @Autowired private val userRepository: KomgaUserRepository, @Autowired private val userLifecycle: KomgaUserLifecycle, - @Autowired private val mockMvc: MockMvc + @Autowired private val mockMvc: MockMvc, ) { private val library = makeLibrary(id = "1") diff --git a/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/BookControllerTest.kt b/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/BookControllerTest.kt index 299697565..45345bb79 100644 --- a/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/BookControllerTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/BookControllerTest.kt @@ -65,7 +65,7 @@ class BookControllerTest( @Autowired private val bookLifecycle: BookLifecycle, @Autowired private val userRepository: KomgaUserRepository, @Autowired private val userLifecycle: KomgaUserLifecycle, - @Autowired private val mockMvc: MockMvc + @Autowired private val mockMvc: MockMvc, ) { private val library = makeLibrary(id = "1") @@ -333,8 +333,8 @@ class BookControllerTest( mediaRepository.update( it.copy( status = Media.Status.READY, - pages = listOf(BookPage("file", "image/jpeg")) - ) + pages = listOf(BookPage("file", "image/jpeg")), + ), ) } @@ -474,9 +474,9 @@ class BookControllerTest( ThumbnailBook( thumbnail = Random.nextBytes(100), bookId = book.id, - type = ThumbnailBook.Type.GENERATED + type = ThumbnailBook.Type.GENERATED, ), - MarkSelectedPreference.YES + MarkSelectedPreference.YES, ) val url = "/api/v1/books/${book.id}/thumbnail" @@ -534,9 +534,9 @@ class BookControllerTest( ThumbnailBook( thumbnail = Random.nextBytes(1), bookId = book.id, - type = ThumbnailBook.Type.GENERATED + type = ThumbnailBook.Type.GENERATED, ), - MarkSelectedPreference.YES + MarkSelectedPreference.YES, ) val url = "/api/v1/books/${book.id}/thumbnail" @@ -548,9 +548,9 @@ class BookControllerTest( ThumbnailBook( thumbnail = Random.nextBytes(1), bookId = book.id, - type = ThumbnailBook.Type.GENERATED + type = ThumbnailBook.Type.GENERATED, ), - MarkSelectedPreference.YES + MarkSelectedPreference.YES, ) mockMvc.get(url) { @@ -584,7 +584,7 @@ class BookControllerTest( """{"authors":"[{"name":""}]"}""", """{"isbn":"1617290459"}""", // isbn 10 """{"isbn":"978-123-456-789-6"}""", // invalid check digit - ] + ], ) @WithMockCustomUser(roles = [ROLE_ADMIN]) fun `given invalid json when updating metadata then raise validation error`(jsonString: String) { @@ -657,7 +657,7 @@ class BookControllerTest( .extracting("name", "role") .containsExactlyInAnyOrder( tuple("newAuthor", "newauthorrole"), - tuple("newAuthor2", "newauthorrole2") + tuple("newAuthor2", "newauthorrole2"), ) assertThat(tags).containsExactly("tag") assertThat(isbn).isEqualTo("9781617290459") @@ -834,8 +834,8 @@ class BookControllerTest( strings = [ """{"completed": false}""", """{}""", - """{"page":0}""" - ] + """{"page":0}""", + ], ) @WithMockCustomUser fun `given invalid payload when marking book in progress then validation error is returned`(jsonString: String) { @@ -862,8 +862,8 @@ class BookControllerTest( mediaRepository.update( media.copy( status = Media.Status.READY, - pages = (1..10).map { BookPage("$it", "image/jpeg") } - ) + pages = (1..10).map { BookPage("$it", "image/jpeg") }, + ), ) } @@ -903,8 +903,8 @@ class BookControllerTest( mediaRepository.update( media.copy( status = Media.Status.READY, - pages = (1..10).map { BookPage("$it", "image/jpeg") } - ) + pages = (1..10).map { BookPage("$it", "image/jpeg") }, + ), ) } @@ -944,8 +944,8 @@ class BookControllerTest( mediaRepository.update( media.copy( status = Media.Status.READY, - pages = (1..10).map { BookPage("$it", "image/jpeg") } - ) + pages = (1..10).map { BookPage("$it", "image/jpeg") }, + ), ) } @@ -991,8 +991,8 @@ class BookControllerTest( mediaRepository.update( media.copy( status = Media.Status.READY, - pages = (1..10).map { BookPage("$it", "image/jpeg") } - ) + pages = (1..10).map { BookPage("$it", "image/jpeg") }, + ), ) } @@ -1007,25 +1007,25 @@ class BookControllerTest( .patch("/api/v1/books/${book.id}/read-progress") .with(user(KomgaPrincipal(user))) .contentType(MediaType.APPLICATION_JSON) - .content(jsonString) + .content(jsonString), ) mockMvc.perform( MockMvcRequestBuilders .get("/api/v1/books") .with(user(KomgaPrincipal(user))) - .contentType(MediaType.APPLICATION_JSON) + .contentType(MediaType.APPLICATION_JSON), ).andExpect( - jsonPath("$.totalElements").value(2) + jsonPath("$.totalElements").value(2), ) mockMvc.perform( MockMvcRequestBuilders .get("/api/v1/books") .with(user(KomgaPrincipal(user2))) - .contentType(MediaType.APPLICATION_JSON) + .contentType(MediaType.APPLICATION_JSON), ).andExpect( - jsonPath("$.totalElements").value(2) + jsonPath("$.totalElements").value(2), ) } } diff --git a/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/ClaimControllerTest.kt b/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/ClaimControllerTest.kt index 0ad473ab8..81e37ba33 100644 --- a/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/ClaimControllerTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/ClaimControllerTest.kt @@ -16,7 +16,7 @@ import org.springframework.test.web.servlet.post @AutoConfigureMockMvc(printOnlyOnFailure = false) @ActiveProfiles("test") class ClaimControllerTest( - @Autowired private val mockMvc: MockMvc + @Autowired private val mockMvc: MockMvc, ) { @ParameterizedTest diff --git a/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/FileSystemControllerTest.kt b/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/FileSystemControllerTest.kt index 3b6b79c3f..cf7763038 100644 --- a/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/FileSystemControllerTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/FileSystemControllerTest.kt @@ -19,7 +19,7 @@ import java.nio.file.Files @SpringBootTest @AutoConfigureMockMvc(printOnlyOnFailure = false) class FileSystemControllerTest( - @Autowired private val mockMvc: MockMvc + @Autowired private val mockMvc: MockMvc, ) { private val route = "/api/v1/filesystem" diff --git a/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/LibraryControllerTest.kt b/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/LibraryControllerTest.kt index 94b97746f..ceb331a61 100644 --- a/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/LibraryControllerTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/LibraryControllerTest.kt @@ -26,7 +26,7 @@ import org.springframework.test.web.servlet.post @AutoConfigureMockMvc(printOnlyOnFailure = false) class LibraryControllerTest( @Autowired private val mockMvc: MockMvc, - @Autowired private val libraryRepository: LibraryRepository + @Autowired private val libraryRepository: LibraryRepository, ) { private val route = "/api/v1/libraries" diff --git a/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/MockSpringSecurity.kt b/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/MockSpringSecurity.kt index 9b3cbbc14..0a11c5bf6 100644 --- a/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/MockSpringSecurity.kt +++ b/komga/src/test/kotlin/org/gotson/komga/interfaces/api/rest/MockSpringSecurity.kt @@ -19,7 +19,7 @@ annotation class WithMockCustomUser( val roles: Array = [ROLE_FILE_DOWNLOAD, ROLE_PAGE_STREAMING], val sharedAllLibraries: Boolean = true, val sharedLibraries: Array = [], - val id: String = "0" + val id: String = "0", ) class WithMockCustomUserSecurityContextFactory : WithSecurityContextFactory { @@ -35,8 +35,8 @@ class WithMockCustomUserSecurityContextFactory : WithSecurityContextFactory