refactor: rename REST controller operations for better clarity in generated openapi spec

This commit is contained in:
Gauthier Roebroeck 2025-03-12 16:48:43 +08:00
parent e0a8edfdd5
commit 95afb4b560
21 changed files with 126 additions and 126 deletions

View file

@ -25,7 +25,7 @@ class BrowseBenchmark : AbstractRestBenchmark() {
// find series with most books // find series with most books
biggestSeriesId = biggestSeriesId =
seriesController seriesController
.getAllSeries(principal, page = PageRequest.of(0, 1, Sort.by(Sort.Order.desc("booksCount")))) .getSeriesDeprecated(principal, page = PageRequest.of(0, 1, Sort.by(Sort.Order.desc("booksCount"))))
.content .content
.first() .first()
.id .id
@ -33,11 +33,11 @@ class BrowseBenchmark : AbstractRestBenchmark() {
@Benchmark @Benchmark
fun browseSeries() { fun browseSeries() {
seriesController.getAllSeries(principal, page = PageRequest.of(0, pageSize, Sort.by(Sort.Order.asc("metadata.titleSort")))) seriesController.getSeriesDeprecated(principal, page = PageRequest.of(0, pageSize, Sort.by(Sort.Order.asc("metadata.titleSort"))))
} }
@Benchmark @Benchmark
fun browseSeriesBooks() { fun browseSeriesBooks() {
seriesController.getAllBooksBySeries(principal, biggestSeriesId, page = PageRequest.of(0, pageSize, Sort.by(Sort.Order.asc("metadata.numberSort")))) seriesController.getBooksBySeriesId(principal, biggestSeriesId, page = PageRequest.of(0, pageSize, Sort.by(Sort.Order.asc("metadata.numberSort"))))
} }
} }

View file

@ -28,10 +28,10 @@ class DashboardBenchmark : AbstractRestBenchmark() {
super.prepareData() super.prepareData()
// mark some books in progress // mark some books in progress
bookController.getAllBooks(principal, readStatus = listOf(ReadStatus.IN_PROGRESS), page = Pageable.ofSize(DEFAULT_PAGE_SIZE)).let { page -> bookController.getAllBooksDeprecated(principal, readStatus = listOf(ReadStatus.IN_PROGRESS), page = Pageable.ofSize(DEFAULT_PAGE_SIZE)).let { page ->
if (page.totalElements < DEFAULT_PAGE_SIZE) { if (page.totalElements < DEFAULT_PAGE_SIZE) {
bookController.getAllBooks(principal, readStatus = listOf(ReadStatus.UNREAD), page = Pageable.ofSize(DEFAULT_PAGE_SIZE)).content.forEach { book -> bookController.getAllBooksDeprecated(principal, readStatus = listOf(ReadStatus.UNREAD), page = Pageable.ofSize(DEFAULT_PAGE_SIZE)).content.forEach { book ->
bookController.markReadProgress(book.id, ReadProgressUpdateDto(2, false), principal) bookController.markBookReadProgress(book.id, ReadProgressUpdateDto(2, false), principal)
} }
} }
} }
@ -39,16 +39,16 @@ class DashboardBenchmark : AbstractRestBenchmark() {
// mark some books read for on deck // mark some books read for on deck
bookController.getBooksOnDeck(principal, page = Pageable.ofSize(DEFAULT_PAGE_SIZE)).let { page -> bookController.getBooksOnDeck(principal, page = Pageable.ofSize(DEFAULT_PAGE_SIZE)).let { page ->
if (page.totalElements < DEFAULT_PAGE_SIZE) { if (page.totalElements < DEFAULT_PAGE_SIZE) {
seriesController.getAllSeries(principal, readStatus = listOf(ReadStatus.UNREAD), oneshot = false, page = Pageable.ofSize(DEFAULT_PAGE_SIZE)).content.forEach { series -> seriesController.getSeriesDeprecated(principal, readStatus = listOf(ReadStatus.UNREAD), oneshot = false, page = Pageable.ofSize(DEFAULT_PAGE_SIZE)).content.forEach { series ->
val book = seriesController.getAllBooksBySeries(principal, series.id, page = Pageable.ofSize(1)).content.first() val book = seriesController.getBooksBySeriesId(principal, series.id, page = Pageable.ofSize(1)).content.first()
bookController.markReadProgress(book.id, ReadProgressUpdateDto(null, true), principal) bookController.markBookReadProgress(book.id, ReadProgressUpdateDto(null, true), principal)
} }
} }
} }
// retrieve most recent book release date // retrieve most recent book release date
bookLatestReleaseDate = bookController bookLatestReleaseDate = bookController
.getAllBooks(principal, page = PageRequest.of(0, 1, Sort.by(Sort.Order.desc("metadata.releaseDate")))) .getAllBooksDeprecated(principal, page = PageRequest.of(0, 1, Sort.by(Sort.Order.desc("metadata.releaseDate"))))
.content .content
.firstOrNull() .firstOrNull()
?.metadata ?.metadata
@ -73,7 +73,7 @@ class DashboardBenchmark : AbstractRestBenchmark() {
@Benchmark @Benchmark
fun getBooksInProgress() { fun getBooksInProgress() {
bookController.getAllBooks(principal, readStatus = listOf(ReadStatus.IN_PROGRESS), page = pageableBooksInProgress) bookController.getAllBooksDeprecated(principal, readStatus = listOf(ReadStatus.IN_PROGRESS), page = pageableBooksInProgress)
} }
val pageableBooksOnDeck = Pageable.ofSize(DEFAULT_PAGE_SIZE) val pageableBooksOnDeck = Pageable.ofSize(DEFAULT_PAGE_SIZE)
@ -87,34 +87,34 @@ class DashboardBenchmark : AbstractRestBenchmark() {
@Benchmark @Benchmark
fun getBooksLatest() { fun getBooksLatest() {
bookController.getAllBooks(principal, page = pageableBooksLatest) bookController.getAllBooksDeprecated(principal, page = pageableBooksLatest)
} }
val pageableBooksRecentlyReleased = PageRequest.of(0, DEFAULT_PAGE_SIZE, Sort.by(Sort.Order.desc("metadata.releaseDate"))) val pageableBooksRecentlyReleased = PageRequest.of(0, DEFAULT_PAGE_SIZE, Sort.by(Sort.Order.desc("metadata.releaseDate")))
@Benchmark @Benchmark
fun getBooksRecentlyReleased() { fun getBooksRecentlyReleased() {
bookController.getAllBooks(principal, releasedAfter = bookLatestReleaseDate.minusMonths(1), page = pageableBooksRecentlyReleased) bookController.getAllBooksDeprecated(principal, releasedAfter = bookLatestReleaseDate.minusMonths(1), page = pageableBooksRecentlyReleased)
} }
val pageableSeriesNew = Pageable.ofSize(DEFAULT_PAGE_SIZE) val pageableSeriesNew = Pageable.ofSize(DEFAULT_PAGE_SIZE)
@Benchmark @Benchmark
fun getSeriesNew() { fun getSeriesNew() {
seriesController.getNewSeries(principal, page = pageableSeriesNew) seriesController.getSeriesNew(principal, page = pageableSeriesNew)
} }
val pageableSeriesUpdated = Pageable.ofSize(DEFAULT_PAGE_SIZE) val pageableSeriesUpdated = Pageable.ofSize(DEFAULT_PAGE_SIZE)
@Benchmark @Benchmark
fun getSeriesUpdated() { fun getSeriesUpdated() {
seriesController.getUpdatedSeries(principal, page = pageableSeriesUpdated) seriesController.getSeriesUpdated(principal, page = pageableSeriesUpdated)
} }
val pageableBooksToCheck = Pageable.ofSize(1) val pageableBooksToCheck = Pageable.ofSize(1)
@Benchmark @Benchmark
fun getBooksToCheck() { fun getBooksToCheck() {
bookController.getAllBooks(principal, mediaStatus = listOf(Media.Status.ERROR, Media.Status.UNSUPPORTED), page = pageableBooksToCheck) bookController.getAllBooksDeprecated(principal, mediaStatus = listOf(Media.Status.ERROR, Media.Status.UNSUPPORTED), page = pageableBooksToCheck)
} }
} }

View file

@ -24,7 +24,7 @@ class UnsortedBenchmark : AbstractRestBenchmark() {
// find series with most books // find series with most books
biggestSeriesId = biggestSeriesId =
seriesController seriesController
.getAllSeries(principal, page = PageRequest.of(0, 1, Sort.by(Sort.Order.desc("booksCount")))) .getSeriesDeprecated(principal, page = PageRequest.of(0, 1, Sort.by(Sort.Order.desc("booksCount"))))
.content .content
.first() .first()
.id .id
@ -32,11 +32,11 @@ class UnsortedBenchmark : AbstractRestBenchmark() {
@Benchmark @Benchmark
fun getAllSeries() { fun getAllSeries() {
seriesController.getAllSeries(principal, page = Pageable.ofSize(pageSize)) seriesController.getSeriesDeprecated(principal, page = Pageable.ofSize(pageSize))
} }
@Benchmark @Benchmark
fun getAllBooks() { fun getAllBooks() {
bookController.getAllBooks(principal, page = Pageable.ofSize(pageSize)) bookController.getAllBooksDeprecated(principal, page = Pageable.ofSize(pageSize))
} }
} }

View file

@ -201,7 +201,7 @@ class CommonBookController(
produces = [MediaType.ALL_VALUE], produces = [MediaType.ALL_VALUE],
) )
@PreAuthorize("hasRole('PAGE_STREAMING')") @PreAuthorize("hasRole('PAGE_STREAMING')")
fun getBookPageRaw( fun getBookPageRawByNumber(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
request: ServletWebRequest, request: ServletWebRequest,
@PathVariable bookId: String, @PathVariable bookId: String,
@ -264,7 +264,7 @@ class CommonBookController(
], ],
produces = ["*/*"], produces = ["*/*"],
) )
fun getBookResource( fun getBookEpubResource(
request: HttpServletRequest, request: HttpServletRequest,
@AuthenticationPrincipal principal: KomgaPrincipal?, @AuthenticationPrincipal principal: KomgaPrincipal?,
@PathVariable bookId: String, @PathVariable bookId: String,
@ -323,7 +323,7 @@ class CommonBookController(
produces = [MediaType.APPLICATION_OCTET_STREAM_VALUE], produces = [MediaType.APPLICATION_OCTET_STREAM_VALUE],
) )
@PreAuthorize("hasRole('FILE_DOWNLOAD')") @PreAuthorize("hasRole('FILE_DOWNLOAD')")
fun getBookFile( fun downloadBookFile(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable bookId: String, @PathVariable bookId: String,
): ResponseEntity<StreamingResponseBody> = getBookFileInternal(principal, bookId) ): ResponseEntity<StreamingResponseBody> = getBookFileInternal(principal, bookId)
@ -373,7 +373,7 @@ class CommonBookController(
], ],
produces = [MEDIATYPE_PROGRESSION_JSON_VALUE], produces = [MEDIATYPE_PROGRESSION_JSON_VALUE],
) )
fun getProgression( fun getBookProgression(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable bookId: String, @PathVariable bookId: String,
): ResponseEntity<R2Progression> = ): ResponseEntity<R2Progression> =
@ -393,7 +393,7 @@ class CommonBookController(
], ],
) )
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
fun markProgression( fun updateBookProgression(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable bookId: String, @PathVariable bookId: String,
@RequestBody progression: R2Progression, @RequestBody progression: R2Progression,

View file

@ -120,7 +120,7 @@ class BookController(
@PageableAsQueryParam @PageableAsQueryParam
@GetMapping("api/v1/books") @GetMapping("api/v1/books")
@Operation(summary = "List books", description = "Use POST /api/v1/books/list instead. Deprecated since 1.19.0.", tags = [OpenApiConfiguration.TagNames.BOOKS, OpenApiConfiguration.TagNames.DEPRECATED]) @Operation(summary = "List books", description = "Use POST /api/v1/books/list instead. Deprecated since 1.19.0.", tags = [OpenApiConfiguration.TagNames.BOOKS, OpenApiConfiguration.TagNames.DEPRECATED])
fun getAllBooks( fun getAllBooksDeprecated(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestParam(name = "search", required = false) searchTerm: String? = null, @RequestParam(name = "search", required = false) searchTerm: String? = null,
@RequestParam(name = "library_id", required = false) libraryIds: List<String>? = null, @RequestParam(name = "library_id", required = false) libraryIds: List<String>? = null,
@ -172,7 +172,7 @@ class BookController(
@PageableAsQueryParam @PageableAsQueryParam
@PostMapping("api/v1/books/list") @PostMapping("api/v1/books/list")
@Operation(summary = "List books", tags = [OpenApiConfiguration.TagNames.BOOKS]) @Operation(summary = "List books", tags = [OpenApiConfiguration.TagNames.BOOKS])
fun getBooksList( fun getBooks(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestBody search: BookSearch, @RequestBody search: BookSearch,
@RequestParam(name = "unpaged", required = false) unpaged: Boolean = false, @RequestParam(name = "unpaged", required = false) unpaged: Boolean = false,
@ -203,7 +203,7 @@ class BookController(
@Operation(summary = "List latest books", description = "Return newly added or updated books.", tags = [OpenApiConfiguration.TagNames.BOOKS]) @Operation(summary = "List latest books", description = "Return newly added or updated books.", tags = [OpenApiConfiguration.TagNames.BOOKS])
@PageableWithoutSortAsQueryParam @PageableWithoutSortAsQueryParam
@GetMapping("api/v1/books/latest") @GetMapping("api/v1/books/latest")
fun getLatestBooks( fun getBooksLatest(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestParam(name = "unpaged", required = false) unpaged: Boolean = false, @RequestParam(name = "unpaged", required = false) unpaged: Boolean = false,
@Parameter(hidden = true) page: Pageable, @Parameter(hidden = true) page: Pageable,
@ -247,7 +247,7 @@ class BookController(
@PageableAsQueryParam @PageableAsQueryParam
@GetMapping("api/v1/books/duplicates") @GetMapping("api/v1/books/duplicates")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
fun getDuplicateBooks( fun getBooksDuplicates(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestParam(name = "unpaged", required = false) unpaged: Boolean = false, @RequestParam(name = "unpaged", required = false) unpaged: Boolean = false,
@Parameter(hidden = true) page: Pageable, @Parameter(hidden = true) page: Pageable,
@ -273,7 +273,7 @@ class BookController(
@Operation(summary = "Get book details", tags = [OpenApiConfiguration.TagNames.BOOKS]) @Operation(summary = "Get book details", tags = [OpenApiConfiguration.TagNames.BOOKS])
@GetMapping("api/v1/books/{bookId}") @GetMapping("api/v1/books/{bookId}")
fun getOneBook( fun getBookById(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable bookId: String, @PathVariable bookId: String,
): BookDto = ): BookDto =
@ -313,7 +313,7 @@ class BookController(
@Operation(summary = "List book's readlists", tags = [OpenApiConfiguration.TagNames.BOOKS]) @Operation(summary = "List book's readlists", tags = [OpenApiConfiguration.TagNames.BOOKS])
@GetMapping("api/v1/books/{bookId}/readlists") @GetMapping("api/v1/books/{bookId}/readlists")
fun getAllReadListsByBook( fun getReadListsByBookId(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable(name = "bookId") bookId: String, @PathVariable(name = "bookId") bookId: String,
): List<ReadListDto> { ): List<ReadListDto> {
@ -400,7 +400,7 @@ class BookController(
@PutMapping("api/v1/books/{bookId}/thumbnails/{thumbnailId}/selected") @PutMapping("api/v1/books/{bookId}/thumbnails/{thumbnailId}/selected")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.ACCEPTED) @ResponseStatus(HttpStatus.ACCEPTED)
fun markSelectedBookThumbnail( fun markBookThumbnailSelected(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable(name = "bookId") bookId: String, @PathVariable(name = "bookId") bookId: String,
@PathVariable(name = "thumbnailId") thumbnailId: String, @PathVariable(name = "thumbnailId") thumbnailId: String,
@ -471,7 +471,7 @@ class BookController(
produces = [MediaType.ALL_VALUE], produces = [MediaType.ALL_VALUE],
) )
@PreAuthorize("hasRole('PAGE_STREAMING')") @PreAuthorize("hasRole('PAGE_STREAMING')")
fun getBookPage( fun getBookPageByNumber(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
request: ServletWebRequest, request: ServletWebRequest,
@PathVariable bookId: String, @PathVariable bookId: String,
@ -498,7 +498,7 @@ class BookController(
value = ["api/v1/books/{bookId}/pages/{pageNumber}/thumbnail"], value = ["api/v1/books/{bookId}/pages/{pageNumber}/thumbnail"],
produces = [MediaType.IMAGE_JPEG_VALUE], produces = [MediaType.IMAGE_JPEG_VALUE],
) )
fun getBookPageThumbnail( fun getBookPageThumbnailByNumber(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
request: WebRequest, request: WebRequest,
@PathVariable bookId: String, @PathVariable bookId: String,
@ -540,7 +540,7 @@ class BookController(
value = ["api/v1/books/{bookId}/manifest"], value = ["api/v1/books/{bookId}/manifest"],
produces = [MEDIATYPE_WEBPUB_JSON_VALUE, MEDIATYPE_DIVINA_JSON_VALUE], produces = [MEDIATYPE_WEBPUB_JSON_VALUE, MEDIATYPE_DIVINA_JSON_VALUE],
) )
fun getWebPubManifest( fun getBookWebPubManifest(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable bookId: String, @PathVariable bookId: String,
): ResponseEntity<WPPublicationDto> { ): ResponseEntity<WPPublicationDto> {
@ -556,7 +556,7 @@ class BookController(
value = ["api/v1/books/{bookId}/positions"], value = ["api/v1/books/{bookId}/positions"],
produces = [MEDIATYPE_POSITION_LIST_JSON_VALUE], produces = [MEDIATYPE_POSITION_LIST_JSON_VALUE],
) )
fun getPositions( fun getBookPositions(
request: HttpServletRequest, request: HttpServletRequest,
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable bookId: String, @PathVariable bookId: String,
@ -589,7 +589,7 @@ class BookController(
value = ["api/v1/books/{bookId}/manifest/epub"], value = ["api/v1/books/{bookId}/manifest/epub"],
produces = [MEDIATYPE_WEBPUB_JSON_VALUE], produces = [MEDIATYPE_WEBPUB_JSON_VALUE],
) )
fun getWebPubManifestEpub( fun getBookWebPubManifestEpub(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable bookId: String, @PathVariable bookId: String,
): WPPublicationDto = commonBookController.getWebPubManifestEpubInternal(principal, bookId, webPubGenerator) ): WPPublicationDto = commonBookController.getWebPubManifestEpubInternal(principal, bookId, webPubGenerator)
@ -599,7 +599,7 @@ class BookController(
value = ["api/v1/books/{bookId}/manifest/pdf"], value = ["api/v1/books/{bookId}/manifest/pdf"],
produces = [MEDIATYPE_WEBPUB_JSON_VALUE], produces = [MEDIATYPE_WEBPUB_JSON_VALUE],
) )
fun getWebPubManifestPdf( fun getBookWebPubManifestPdf(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable bookId: String, @PathVariable bookId: String,
): WPPublicationDto = commonBookController.getWebPubManifestPdfInternal(principal, bookId, webPubGenerator) ): WPPublicationDto = commonBookController.getWebPubManifestPdfInternal(principal, bookId, webPubGenerator)
@ -609,7 +609,7 @@ class BookController(
value = ["api/v1/books/{bookId}/manifest/divina"], value = ["api/v1/books/{bookId}/manifest/divina"],
produces = [MEDIATYPE_DIVINA_JSON_VALUE], produces = [MEDIATYPE_DIVINA_JSON_VALUE],
) )
fun getWebPubManifestDivina( fun getBookWebPubManifestDivina(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable bookId: String, @PathVariable bookId: String,
): WPPublicationDto = commonBookController.getWebPubManifestDivinaInternal(principal, bookId, webPubGenerator) ): WPPublicationDto = commonBookController.getWebPubManifestDivinaInternal(principal, bookId, webPubGenerator)
@ -618,7 +618,7 @@ class BookController(
@PostMapping("api/v1/books/{bookId}/analyze") @PostMapping("api/v1/books/{bookId}/analyze")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.ACCEPTED) @ResponseStatus(HttpStatus.ACCEPTED)
fun analyze( fun bookAnalyze(
@PathVariable bookId: String, @PathVariable bookId: String,
) { ) {
bookRepository.findByIdOrNull(bookId)?.let { book -> bookRepository.findByIdOrNull(bookId)?.let { book ->
@ -630,7 +630,7 @@ class BookController(
@PostMapping("api/v1/books/{bookId}/metadata/refresh") @PostMapping("api/v1/books/{bookId}/metadata/refresh")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.ACCEPTED) @ResponseStatus(HttpStatus.ACCEPTED)
fun refreshMetadata( fun bookRefreshMetadata(
@PathVariable bookId: String, @PathVariable bookId: String,
) { ) {
bookRepository.findByIdOrNull(bookId)?.let { book -> bookRepository.findByIdOrNull(bookId)?.let { book ->
@ -643,7 +643,7 @@ class BookController(
@PatchMapping("api/v1/books/{bookId}/metadata") @PatchMapping("api/v1/books/{bookId}/metadata")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
fun updateMetadata( fun updateBookMetadata(
@PathVariable bookId: String, @PathVariable bookId: 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.") @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 @Valid
@ -663,7 +663,7 @@ class BookController(
@PatchMapping("api/v1/books/metadata") @PatchMapping("api/v1/books/metadata")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
fun updateBatchMetadata( fun updateBookMetadataByBatch(
@Parameter(description = "A map of book IDs which values are the metadata fields to update. Set a field to null to unset the metadata. You can omit fields you don't want to update.") @Parameter(description = "A map of book IDs which values are the metadata fields to update. Set a field to null to unset the metadata. You can omit fields you don't want to update.")
@Valid @Valid
@RequestBody @RequestBody
@ -686,7 +686,7 @@ class BookController(
@Operation(summary = "Mark book's read progress", description = "Mark book as read and/or change page progress.", tags = [OpenApiConfiguration.TagNames.BOOKS]) @Operation(summary = "Mark book's read progress", description = "Mark book as read and/or change page progress.", tags = [OpenApiConfiguration.TagNames.BOOKS])
@PatchMapping("api/v1/books/{bookId}/read-progress") @PatchMapping("api/v1/books/{bookId}/read-progress")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
fun markReadProgress( fun markBookReadProgress(
@PathVariable bookId: String, @PathVariable bookId: String,
@Parameter(description = "page can be omitted if completed is set to true. completed can be omitted, and will be set accordingly depending on the page passed and the total number of pages in the book.") @Parameter(description = "page can be omitted if completed is set to true. completed can be omitted, and will be set accordingly depending on the page passed and the total number of pages in the book.")
@Valid @Valid
@ -711,7 +711,7 @@ class BookController(
@Operation(summary = "Mark book as unread", description = "Mark book as unread", tags = [OpenApiConfiguration.TagNames.BOOKS]) @Operation(summary = "Mark book as unread", description = "Mark book as unread", tags = [OpenApiConfiguration.TagNames.BOOKS])
@DeleteMapping("api/v1/books/{bookId}/read-progress") @DeleteMapping("api/v1/books/{bookId}/read-progress")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
fun deleteReadProgress( fun deleteBookReadProgress(
@PathVariable bookId: String, @PathVariable bookId: String,
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
) { ) {
@ -762,7 +762,7 @@ class BookController(
@PutMapping("api/v1/books/thumbnails") @PutMapping("api/v1/books/thumbnails")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.ACCEPTED) @ResponseStatus(HttpStatus.ACCEPTED)
fun regenerateThumbnails( fun booksRegenerateThumbnails(
@RequestParam(name = "for_bigger_result_only", required = false) forBiggerResultOnly: Boolean = false, @RequestParam(name = "for_bigger_result_only", required = false) forBiggerResultOnly: Boolean = false,
) { ) {
taskEmitter.findBookThumbnailsToRegenerate(forBiggerResultOnly, LOWEST_PRIORITY) taskEmitter.findBookThumbnailsToRegenerate(forBiggerResultOnly, LOWEST_PRIORITY)

View file

@ -35,7 +35,7 @@ class ClaimController(
@PostMapping @PostMapping
@Operation(summary = "Claim server", description = "Creates an admin user with the provided credentials.") @Operation(summary = "Claim server", description = "Creates an admin user with the provided credentials.")
fun claimAdmin( fun claimServer(
@Email(regexp = ".+@.+\\..+") @Email(regexp = ".+@.+\\..+")
@RequestHeader("X-Komga-Email") @RequestHeader("X-Komga-Email")
email: String, email: String,

View file

@ -142,7 +142,7 @@ class ClientSettingsController(
), ),
], ],
) )
fun deleteGlobalSetting( fun deleteGlobalSettings(
@RequestBody keysToDelete: Set< @RequestBody keysToDelete: Set<
@Pattern(regexp = KEY_REGEX) @Pattern(regexp = KEY_REGEX)
String, String,
@ -164,7 +164,7 @@ class ClientSettingsController(
), ),
], ],
) )
fun deleteGlobalSetting( fun deleteUserSettings(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestBody keysToDelete: Set< @RequestBody keysToDelete: Set<
@Pattern(regexp = KEY_REGEX) @Pattern(regexp = KEY_REGEX)

View file

@ -88,7 +88,7 @@ class FontsController(
@GetMapping("families") @GetMapping("families")
@Operation(summary = "List font families", description = "List all available font families.") @Operation(summary = "List font families", description = "List all available font families.")
fun listFonts(): Set<String> = fonts.keys fun getFonts(): Set<String> = fonts.keys
@GetMapping("resource/{fontFamily}/{fontFile}") @GetMapping("resource/{fontFamily}/{fontFile}")
@Operation(summary = "Download font file") @Operation(summary = "Download font file")

View file

@ -27,7 +27,7 @@ class HistoricalEventController(
@GetMapping @GetMapping
@PageableAsQueryParam @PageableAsQueryParam
@Operation(summary = "List historical events") @Operation(summary = "List historical events")
fun getAll( fun getHistoricalEvents(
@Parameter(hidden = true) page: Pageable, @Parameter(hidden = true) page: Pageable,
): Page<HistoricalEventDto> { ): Page<HistoricalEventDto> {
val sort = val sort =

View file

@ -60,7 +60,7 @@ class LibraryController(
summary = "List all libraries", summary = "List all libraries",
description = "The libraries are filtered based on the current user's permissions", description = "The libraries are filtered based on the current user's permissions",
) )
fun getAll( fun getLibraries(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
): List<LibraryDto> = ): List<LibraryDto> =
if (principal.user.canAccessAllLibraries()) { if (principal.user.canAccessAllLibraries()) {
@ -71,7 +71,7 @@ class LibraryController(
@GetMapping("{libraryId}") @GetMapping("{libraryId}")
@Operation(summary = "Get details for a single library") @Operation(summary = "Get details for a single library")
fun getOne( fun getLibraryById(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable libraryId: String, @PathVariable libraryId: String,
): LibraryDto = ): LibraryDto =
@ -83,7 +83,7 @@ class LibraryController(
@PostMapping @PostMapping
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@Operation(summary = "Create a library") @Operation(summary = "Create a library")
fun addOne( fun addLibrary(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@Valid @RequestBody @Valid @RequestBody
library: LibraryCreationDto, library: LibraryCreationDto,
@ -140,19 +140,19 @@ class LibraryController(
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
@Deprecated("Use PATCH /v1/libraries/{libraryId} instead", ReplaceWith("patchOne")) @Deprecated("Use PATCH /v1/libraries/{libraryId} instead", ReplaceWith("patchOne"))
@Operation(summary = "Update a library", description = "Use PATCH /api/v1/libraries/{libraryId} instead. Deprecated since 1.3.0.", tags = [OpenApiConfiguration.TagNames.DEPRECATED]) @Operation(summary = "Update a library", description = "Use PATCH /api/v1/libraries/{libraryId} instead. Deprecated since 1.3.0.", tags = [OpenApiConfiguration.TagNames.DEPRECATED])
fun updateOne( fun updateLibraryByIdDeprecated(
@PathVariable libraryId: String, @PathVariable libraryId: String,
@Valid @RequestBody @Valid @RequestBody
library: LibraryUpdateDto, library: LibraryUpdateDto,
) { ) {
patchOne(libraryId, library) updateLibraryById(libraryId, library)
} }
@PatchMapping("/{libraryId}") @PatchMapping("/{libraryId}")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
@Operation(summary = "Update a library", description = "You can omit fields you don't want to update") @Operation(summary = "Update a library", description = "You can omit fields you don't want to update")
fun patchOne( fun updateLibraryById(
@PathVariable libraryId: String, @PathVariable libraryId: String,
@Parameter(description = "Fields to update. You can omit fields you don't want to update.") @Parameter(description = "Fields to update. You can omit fields you don't want to update.")
@Valid @Valid
@ -215,7 +215,7 @@ class LibraryController(
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
@Operation(summary = "Delete a library") @Operation(summary = "Delete a library")
fun deleteOne( fun deleteLibraryById(
@PathVariable libraryId: String, @PathVariable libraryId: String,
) { ) {
libraryRepository.findByIdOrNull(libraryId)?.let { libraryRepository.findByIdOrNull(libraryId)?.let {
@ -227,7 +227,7 @@ class LibraryController(
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.ACCEPTED) @ResponseStatus(HttpStatus.ACCEPTED)
@Operation(summary = "Scan a library") @Operation(summary = "Scan a library")
fun scan( fun libraryScan(
@PathVariable libraryId: String, @PathVariable libraryId: String,
@RequestParam(required = false) deep: Boolean = false, @RequestParam(required = false) deep: Boolean = false,
) { ) {
@ -240,7 +240,7 @@ class LibraryController(
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.ACCEPTED) @ResponseStatus(HttpStatus.ACCEPTED)
@Operation(summary = "Analyze a library") @Operation(summary = "Analyze a library")
fun analyze( fun libraryAnalyze(
@PathVariable libraryId: String, @PathVariable libraryId: String,
) { ) {
val books = val books =
@ -257,7 +257,7 @@ class LibraryController(
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.ACCEPTED) @ResponseStatus(HttpStatus.ACCEPTED)
@Operation(summary = "Refresh metadata for a library") @Operation(summary = "Refresh metadata for a library")
fun refreshMetadata( fun libraryRefreshMetadata(
@PathVariable libraryId: String, @PathVariable libraryId: String,
) { ) {
val books = val books =
@ -276,7 +276,7 @@ class LibraryController(
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.ACCEPTED) @ResponseStatus(HttpStatus.ACCEPTED)
@Operation(summary = "Empty trash for a library") @Operation(summary = "Empty trash for a library")
fun emptyTrash( fun libraryEmptyTrash(
@PathVariable libraryId: String, @PathVariable libraryId: String,
) { ) {
libraryRepository.findByIdOrNull(libraryId)?.let { library -> libraryRepository.findByIdOrNull(libraryId)?.let { library ->

View file

@ -23,7 +23,7 @@ class LoginController(
@Operation(summary = "Set cookie", description = "Forcefully return Set-Cookie header, even if the session is contained in the X-Auth-Token header.") @Operation(summary = "Set cookie", description = "Forcefully return Set-Cookie header, even if the session is contained in the X-Auth-Token header.")
@GetMapping("api/v1/login/set-cookie") @GetMapping("api/v1/login/set-cookie")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
fun headerToCookie( fun convertHeaderSessionToCookie(
request: HttpServletRequest, request: HttpServletRequest,
response: HttpServletResponse, response: HttpServletResponse,
session: HttpSession, session: HttpSession,

View file

@ -24,7 +24,7 @@ class OAuth2Controller(
@GetMapping("providers") @GetMapping("providers")
@Operation(summary = "List registered OAuth2 providers") @Operation(summary = "List registered OAuth2 providers")
fun getProviders() = registrationIds fun getOAuth2Providers() = registrationIds
} }
data class OAuth2ClientDto( data class OAuth2ClientDto(

View file

@ -120,7 +120,7 @@ class PageHashController(
@Operation(summary = "Delete all duplicate pages by hash") @Operation(summary = "Delete all duplicate pages by hash")
@PostMapping("{pageHash}/delete-all") @PostMapping("{pageHash}/delete-all")
@ResponseStatus(HttpStatus.ACCEPTED) @ResponseStatus(HttpStatus.ACCEPTED)
fun performDelete( fun deleteDuplicatePagesByPageHash(
@PathVariable pageHash: String, @PathVariable pageHash: String,
) { ) {
val toRemove = val toRemove =
@ -145,7 +145,7 @@ class PageHashController(
@Operation(summary = "Delete specific duplicate page") @Operation(summary = "Delete specific duplicate page")
@PostMapping("{pageHash}/delete-match") @PostMapping("{pageHash}/delete-match")
@ResponseStatus(HttpStatus.ACCEPTED) @ResponseStatus(HttpStatus.ACCEPTED)
fun deleteSingleMatch( fun deleteSingleMatchByPageHash(
@PathVariable pageHash: String, @PathVariable pageHash: String,
@RequestBody matchDto: PageHashMatchDto, @RequestBody matchDto: PageHashMatchDto,
) { ) {

View file

@ -103,7 +103,7 @@ class ReadListController(
@Operation(summary = "List readlists", tags = [OpenApiConfiguration.TagNames.READLISTS]) @Operation(summary = "List readlists", tags = [OpenApiConfiguration.TagNames.READLISTS])
@PageableWithoutSortAsQueryParam @PageableWithoutSortAsQueryParam
@GetMapping @GetMapping
fun getAll( fun getReadLists(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestParam(name = "search", required = false) searchTerm: String?, @RequestParam(name = "search", required = false) searchTerm: String?,
@RequestParam(name = "library_id", required = false) libraryIds: List<String>?, @RequestParam(name = "library_id", required = false) libraryIds: List<String>?,
@ -134,7 +134,7 @@ class ReadListController(
@Operation(summary = "Get readlist details", tags = [OpenApiConfiguration.TagNames.READLISTS]) @Operation(summary = "Get readlist details", tags = [OpenApiConfiguration.TagNames.READLISTS])
@GetMapping("{id}") @GetMapping("{id}")
fun getOne( fun getReadListById(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable id: String, @PathVariable id: String,
): ReadListDto = ): ReadListDto =
@ -217,7 +217,7 @@ class ReadListController(
@PutMapping("{id}/thumbnails/{thumbnailId}/selected") @PutMapping("{id}/thumbnails/{thumbnailId}/selected")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.ACCEPTED) @ResponseStatus(HttpStatus.ACCEPTED)
fun markSelectedReadListThumbnail( fun markReadListThumbnailSelected(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable(name = "id") id: String, @PathVariable(name = "id") id: String,
@PathVariable(name = "thumbnailId") thumbnailId: String, @PathVariable(name = "thumbnailId") thumbnailId: String,
@ -249,7 +249,7 @@ class ReadListController(
@Operation(summary = "Create readlist", tags = [OpenApiConfiguration.TagNames.READLISTS]) @Operation(summary = "Create readlist", tags = [OpenApiConfiguration.TagNames.READLISTS])
@PostMapping @PostMapping
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
fun addOne( fun createReadList(
@Valid @RequestBody @Valid @RequestBody
readList: ReadListCreationDto, readList: ReadListCreationDto,
): ReadListDto = ): ReadListDto =
@ -270,7 +270,7 @@ class ReadListController(
@Operation(summary = "Match ComicRack list", tags = [OpenApiConfiguration.TagNames.COMICRACK]) @Operation(summary = "Match ComicRack list", tags = [OpenApiConfiguration.TagNames.COMICRACK])
@PostMapping("match/comicrack") @PostMapping("match/comicrack")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
fun matchFromComicRackList( fun matchComicRackList(
@RequestParam("file") file: MultipartFile, @RequestParam("file") file: MultipartFile,
): ReadListRequestMatchDto = ): ReadListRequestMatchDto =
try { try {
@ -283,7 +283,7 @@ class ReadListController(
@PatchMapping("{id}") @PatchMapping("{id}")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
fun updateOne( fun updateReadListById(
@PathVariable id: String, @PathVariable id: String,
@Valid @RequestBody @Valid @RequestBody
readList: ReadListUpdateDto, readList: ReadListUpdateDto,
@ -308,7 +308,7 @@ class ReadListController(
@DeleteMapping("{id}") @DeleteMapping("{id}")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
fun deleteOne( fun deleteReadListById(
@PathVariable id: String, @PathVariable id: String,
) { ) {
readListRepository.findByIdOrNull(id)?.let { readListRepository.findByIdOrNull(id)?.let {
@ -320,7 +320,7 @@ class ReadListController(
@PageableWithoutSortAsQueryParam @PageableWithoutSortAsQueryParam
@AuthorsAsQueryParam @AuthorsAsQueryParam
@GetMapping("{id}/books") @GetMapping("{id}/books")
fun getBooksForReadList( fun getBooksByReadListId(
@PathVariable id: String, @PathVariable id: String,
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestParam(name = "library_id", required = false) libraryIds: List<String>?, @RequestParam(name = "library_id", required = false) libraryIds: List<String>?,
@ -370,7 +370,7 @@ class ReadListController(
@Operation(summary = "Get previous book in readlist", tags = [OpenApiConfiguration.TagNames.READLIST_BOOKS]) @Operation(summary = "Get previous book in readlist", tags = [OpenApiConfiguration.TagNames.READLIST_BOOKS])
@GetMapping("{id}/books/{bookId}/previous") @GetMapping("{id}/books/{bookId}/previous")
fun getBookSiblingPrevious( fun getBookSiblingPreviousInReadList(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable id: String, @PathVariable id: String,
@PathVariable bookId: String, @PathVariable bookId: String,
@ -388,7 +388,7 @@ class ReadListController(
@Operation(summary = "Get next book in readlist", tags = [OpenApiConfiguration.TagNames.READLIST_BOOKS]) @Operation(summary = "Get next book in readlist", tags = [OpenApiConfiguration.TagNames.READLIST_BOOKS])
@GetMapping("{id}/books/{bookId}/next") @GetMapping("{id}/books/{bookId}/next")
fun getBookSiblingNext( fun getBookSiblingNextInReadList(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable id: String, @PathVariable id: String,
@PathVariable bookId: String, @PathVariable bookId: String,
@ -406,7 +406,7 @@ class ReadListController(
@Operation(summary = "Get readlist read progress (Mihon)", description = "Mihon specific, due to how read progress is handled in Mihon.", tags = [OpenApiConfiguration.TagNames.MIHON]) @Operation(summary = "Get readlist read progress (Mihon)", description = "Mihon specific, due to how read progress is handled in Mihon.", tags = [OpenApiConfiguration.TagNames.MIHON])
@GetMapping("{id}/read-progress/tachiyomi") @GetMapping("{id}/read-progress/tachiyomi")
fun getReadProgress( fun getMihonReadProgressByReadListId(
@PathVariable id: String, @PathVariable id: String,
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
): TachiyomiReadProgressDto = ): TachiyomiReadProgressDto =
@ -417,7 +417,7 @@ class ReadListController(
@Operation(summary = "Update readlist read progress (Mihon)", description = "Mihon specific, due to how read progress is handled in Mihon.", tags = [OpenApiConfiguration.TagNames.MIHON]) @Operation(summary = "Update readlist read progress (Mihon)", description = "Mihon specific, due to how read progress is handled in Mihon.", tags = [OpenApiConfiguration.TagNames.MIHON])
@PutMapping("{id}/read-progress/tachiyomi") @PutMapping("{id}/read-progress/tachiyomi")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
fun markReadProgressTachiyomi( fun updateMihonReadProgressByReadListId(
@PathVariable id: String, @PathVariable id: String,
@Valid @RequestBody @Valid @RequestBody
readProgress: TachiyomiReadProgressUpdateDto, readProgress: TachiyomiReadProgressUpdateDto,
@ -437,7 +437,7 @@ class ReadListController(
@Operation(summary = "Download readlist", description = "Download the whole readlist as a ZIP file.", tags = [OpenApiConfiguration.TagNames.READLISTS]) @Operation(summary = "Download readlist", description = "Download the whole readlist as a ZIP file.", tags = [OpenApiConfiguration.TagNames.READLISTS])
@GetMapping("{id}/file", produces = [MediaType.APPLICATION_OCTET_STREAM_VALUE]) @GetMapping("{id}/file", produces = [MediaType.APPLICATION_OCTET_STREAM_VALUE])
@PreAuthorize("hasRole('FILE_DOWNLOAD')") @PreAuthorize("hasRole('FILE_DOWNLOAD')")
fun getReadListFile( fun downloadReadListAsZip(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable id: String, @PathVariable id: String,
): ResponseEntity<StreamingResponseBody> { ): ResponseEntity<StreamingResponseBody> {

View file

@ -28,7 +28,7 @@ class ReferentialController(
@GetMapping("v1/authors") @GetMapping("v1/authors")
@Deprecated("Use GET /v2/authors instead", ReplaceWith("getAuthors")) @Deprecated("Use GET /v2/authors instead", ReplaceWith("getAuthors"))
@Operation(summary = "List authors", description = "Use GET /api/v2/authors instead. Deprecated since 1.20.0.", tags = [OpenApiConfiguration.TagNames.DEPRECATED]) @Operation(summary = "List authors", description = "Use GET /api/v2/authors instead. Deprecated since 1.20.0.", tags = [OpenApiConfiguration.TagNames.DEPRECATED])
fun getAuthorsV1( fun getAuthorsDeprecated(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestParam(name = "search", defaultValue = "") search: String, @RequestParam(name = "search", defaultValue = "") search: String,
@RequestParam(name = "library_id", required = false) libraryId: String?, @RequestParam(name = "library_id", required = false) libraryId: String?,

View file

@ -82,7 +82,7 @@ class SeriesCollectionController(
@Operation(summary = "List collections", tags = [OpenApiConfiguration.TagNames.COLLECTIONS]) @Operation(summary = "List collections", tags = [OpenApiConfiguration.TagNames.COLLECTIONS])
@PageableWithoutSortAsQueryParam @PageableWithoutSortAsQueryParam
@GetMapping @GetMapping
fun getAll( fun getCollections(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestParam(name = "search", required = false) searchTerm: String?, @RequestParam(name = "search", required = false) searchTerm: String?,
@RequestParam(name = "library_id", required = false) libraryIds: List<String>?, @RequestParam(name = "library_id", required = false) libraryIds: List<String>?,
@ -112,7 +112,7 @@ class SeriesCollectionController(
@Operation(summary = "Get collection details", tags = [OpenApiConfiguration.TagNames.COLLECTIONS]) @Operation(summary = "Get collection details", tags = [OpenApiConfiguration.TagNames.COLLECTIONS])
@GetMapping("{id}") @GetMapping("{id}")
fun getOne( fun getCollectionById(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable id: String, @PathVariable id: String,
): CollectionDto = ): CollectionDto =
@ -195,7 +195,7 @@ class SeriesCollectionController(
@PutMapping("{id}/thumbnails/{thumbnailId}/selected") @PutMapping("{id}/thumbnails/{thumbnailId}/selected")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.ACCEPTED) @ResponseStatus(HttpStatus.ACCEPTED)
fun markSelectedCollectionThumbnail( fun markCollectionThumbnailSelected(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable(name = "id") id: String, @PathVariable(name = "id") id: String,
@PathVariable(name = "thumbnailId") thumbnailId: String, @PathVariable(name = "thumbnailId") thumbnailId: String,
@ -227,7 +227,7 @@ class SeriesCollectionController(
@Operation(summary = "Create collection", tags = [OpenApiConfiguration.TagNames.COLLECTIONS]) @Operation(summary = "Create collection", tags = [OpenApiConfiguration.TagNames.COLLECTIONS])
@PostMapping @PostMapping
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
fun addOne( fun createCollection(
@Valid @RequestBody @Valid @RequestBody
collection: CollectionCreationDto, collection: CollectionCreationDto,
): CollectionDto = ): CollectionDto =
@ -248,7 +248,7 @@ class SeriesCollectionController(
@PatchMapping("{id}") @PatchMapping("{id}")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
fun updateOne( fun updateCollectionById(
@PathVariable id: String, @PathVariable id: String,
@Valid @RequestBody @Valid @RequestBody
collection: CollectionUpdateDto, collection: CollectionUpdateDto,
@ -272,7 +272,7 @@ class SeriesCollectionController(
@DeleteMapping("{id}") @DeleteMapping("{id}")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
fun deleteOne( fun deleteCollectionById(
@PathVariable id: String, @PathVariable id: String,
) { ) {
collectionRepository.findByIdOrNull(id)?.let { collectionRepository.findByIdOrNull(id)?.let {
@ -284,7 +284,7 @@ class SeriesCollectionController(
@PageableWithoutSortAsQueryParam @PageableWithoutSortAsQueryParam
@AuthorsAsQueryParam @AuthorsAsQueryParam
@GetMapping("{id}/series") @GetMapping("{id}/series")
fun getSeriesForCollection( fun getSeriesByCollectionId(
@PathVariable id: String, @PathVariable id: String,
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestParam(name = "library_id", required = false) libraryIds: List<String>?, @RequestParam(name = "library_id", required = false) libraryIds: List<String>?,

View file

@ -133,7 +133,7 @@ class SeriesController(
), ),
) )
@GetMapping("v1/series") @GetMapping("v1/series")
fun getAllSeries( fun getSeriesDeprecated(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestParam(name = "search", required = false) searchTerm: String? = null, @RequestParam(name = "search", required = false) searchTerm: String? = null,
@Parameter(hidden = true) @Parameter(hidden = true)
@ -226,7 +226,7 @@ class SeriesController(
@Operation(summary = "List series", tags = [OpenApiConfiguration.TagNames.SERIES]) @Operation(summary = "List series", tags = [OpenApiConfiguration.TagNames.SERIES])
@PageableAsQueryParam @PageableAsQueryParam
@PostMapping("v1/series/list") @PostMapping("v1/series/list")
fun getSeriesList( fun getSeries(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestBody search: SeriesSearch, @RequestBody search: SeriesSearch,
@RequestParam(name = "unpaged", required = false) unpaged: Boolean = false, @RequestParam(name = "unpaged", required = false) unpaged: Boolean = false,
@ -266,7 +266,7 @@ class SeriesController(
), ),
) )
@GetMapping("v1/series/alphabetical-groups") @GetMapping("v1/series/alphabetical-groups")
fun getAlphabeticalGroups( fun getSeriesAlphabeticalGroupsDeprecated(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestParam(name = "search", required = false) searchTerm: String?, @RequestParam(name = "search", required = false) searchTerm: String?,
@Parameter(hidden = true) @Parameter(hidden = true)
@ -338,7 +338,7 @@ class SeriesController(
@Operation(summary = "List series groups", description = "List series grouped by the first character of their sort title.", tags = [OpenApiConfiguration.TagNames.SERIES]) @Operation(summary = "List series groups", description = "List series grouped by the first character of their sort title.", tags = [OpenApiConfiguration.TagNames.SERIES])
@PostMapping("v1/series/list/alphabetical-groups") @PostMapping("v1/series/list/alphabetical-groups")
fun getSeriesListByAlphabeticalGroups( fun getSeriesAlphabeticalGroups(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestBody search: SeriesSearch, @RequestBody search: SeriesSearch,
): List<GroupCountDto> = seriesDtoRepository.countByFirstCharacter(search, SearchContext(principal.user)) ): List<GroupCountDto> = seriesDtoRepository.countByFirstCharacter(search, SearchContext(principal.user))
@ -346,7 +346,7 @@ class SeriesController(
@Operation(summary = "List latest series", description = "Return recently added or updated series.", tags = [OpenApiConfiguration.TagNames.SERIES]) @Operation(summary = "List latest series", description = "Return recently added or updated series.", tags = [OpenApiConfiguration.TagNames.SERIES])
@PageableWithoutSortAsQueryParam @PageableWithoutSortAsQueryParam
@GetMapping("v1/series/latest") @GetMapping("v1/series/latest")
fun getLatestSeries( fun getSeriesLatest(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestParam(name = "library_id", required = false) libraryIds: List<String>?, @RequestParam(name = "library_id", required = false) libraryIds: List<String>?,
@RequestParam(name = "deleted", required = false) deleted: Boolean?, @RequestParam(name = "deleted", required = false) deleted: Boolean?,
@ -385,7 +385,7 @@ class SeriesController(
@Operation(summary = "List new series", description = "Return newly added series.", tags = [OpenApiConfiguration.TagNames.SERIES]) @Operation(summary = "List new series", description = "Return newly added series.", tags = [OpenApiConfiguration.TagNames.SERIES])
@PageableWithoutSortAsQueryParam @PageableWithoutSortAsQueryParam
@GetMapping("v1/series/new") @GetMapping("v1/series/new")
fun getNewSeries( fun getSeriesNew(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestParam(name = "library_id", required = false) libraryIds: List<String>? = null, @RequestParam(name = "library_id", required = false) libraryIds: List<String>? = null,
@RequestParam(name = "deleted", required = false) deleted: Boolean? = null, @RequestParam(name = "deleted", required = false) deleted: Boolean? = null,
@ -424,7 +424,7 @@ class SeriesController(
@Operation(summary = "List updated series", description = "Return recently updated series, but not newly added ones.", tags = [OpenApiConfiguration.TagNames.SERIES]) @Operation(summary = "List updated series", description = "Return recently updated series, but not newly added ones.", tags = [OpenApiConfiguration.TagNames.SERIES])
@PageableWithoutSortAsQueryParam @PageableWithoutSortAsQueryParam
@GetMapping("v1/series/updated") @GetMapping("v1/series/updated")
fun getUpdatedSeries( fun getSeriesUpdated(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestParam(name = "library_id", required = false) libraryIds: List<String>? = null, @RequestParam(name = "library_id", required = false) libraryIds: List<String>? = null,
@RequestParam(name = "deleted", required = false) deleted: Boolean? = null, @RequestParam(name = "deleted", required = false) deleted: Boolean? = null,
@ -462,7 +462,7 @@ class SeriesController(
@Operation(summary = "Get series details", tags = [OpenApiConfiguration.TagNames.SERIES]) @Operation(summary = "Get series details", tags = [OpenApiConfiguration.TagNames.SERIES])
@GetMapping("v1/series/{seriesId}") @GetMapping("v1/series/{seriesId}")
fun getOneSeries( fun getSeriesById(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable(name = "seriesId") id: String, @PathVariable(name = "seriesId") id: String,
): SeriesDto = ): SeriesDto =
@ -474,7 +474,7 @@ class SeriesController(
@Operation(summary = "Get series' poster image", tags = [OpenApiConfiguration.TagNames.SERIES_POSTER]) @Operation(summary = "Get series' poster image", tags = [OpenApiConfiguration.TagNames.SERIES_POSTER])
@ApiResponse(content = [Content(schema = Schema(type = "string", format = "binary"))]) @ApiResponse(content = [Content(schema = Schema(type = "string", format = "binary"))])
@GetMapping(value = ["v1/series/{seriesId}/thumbnail"], produces = [MediaType.IMAGE_JPEG_VALUE]) @GetMapping(value = ["v1/series/{seriesId}/thumbnail"], produces = [MediaType.IMAGE_JPEG_VALUE])
fun getSeriesDefaultThumbnail( fun getSeriesThumbnail(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable(name = "seriesId") seriesId: String, @PathVariable(name = "seriesId") seriesId: String,
): ByteArray { ): ByteArray {
@ -514,7 +514,7 @@ class SeriesController(
@Operation(summary = "Add series poster", tags = [OpenApiConfiguration.TagNames.SERIES_POSTER]) @Operation(summary = "Add series poster", tags = [OpenApiConfiguration.TagNames.SERIES_POSTER])
@PostMapping(value = ["v1/series/{seriesId}/thumbnails"], consumes = [MediaType.MULTIPART_FORM_DATA_VALUE]) @PostMapping(value = ["v1/series/{seriesId}/thumbnails"], consumes = [MediaType.MULTIPART_FORM_DATA_VALUE])
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
fun postUserUploadedSeriesThumbnail( fun addUserUploadedSeriesThumbnail(
@PathVariable(name = "seriesId") seriesId: String, @PathVariable(name = "seriesId") seriesId: String,
@RequestParam("file") file: MultipartFile, @RequestParam("file") file: MultipartFile,
@RequestParam("selected") selected: Boolean = true, @RequestParam("selected") selected: Boolean = true,
@ -544,7 +544,7 @@ class SeriesController(
@PutMapping("v1/series/{seriesId}/thumbnails/{thumbnailId}/selected") @PutMapping("v1/series/{seriesId}/thumbnails/{thumbnailId}/selected")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.ACCEPTED) @ResponseStatus(HttpStatus.ACCEPTED)
fun postMarkSelectedSeriesThumbnail( fun markSeriesThumbnailSelected(
@PathVariable(name = "seriesId") seriesId: String, @PathVariable(name = "seriesId") seriesId: String,
@PathVariable(name = "thumbnailId") thumbnailId: String, @PathVariable(name = "thumbnailId") thumbnailId: String,
) { ) {
@ -578,7 +578,7 @@ class SeriesController(
@PageableAsQueryParam @PageableAsQueryParam
@AuthorsAsQueryParam @AuthorsAsQueryParam
@GetMapping("v1/series/{seriesId}/books") @GetMapping("v1/series/{seriesId}/books")
fun getAllBooksBySeries( fun getBooksBySeriesId(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable(name = "seriesId") seriesId: String, @PathVariable(name = "seriesId") seriesId: String,
@RequestParam(name = "media_status", required = false) mediaStatus: List<Media.Status>? = null, @RequestParam(name = "media_status", required = false) mediaStatus: List<Media.Status>? = null,
@ -630,7 +630,7 @@ class SeriesController(
@Operation(summary = "List series' collections", tags = [OpenApiConfiguration.TagNames.SERIES]) @Operation(summary = "List series' collections", tags = [OpenApiConfiguration.TagNames.SERIES])
@GetMapping("v1/series/{seriesId}/collections") @GetMapping("v1/series/{seriesId}/collections")
fun getAllCollectionsBySeries( fun getCollectionsBySeriesId(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable(name = "seriesId") seriesId: String, @PathVariable(name = "seriesId") seriesId: String,
): List<CollectionDto> { ): List<CollectionDto> {
@ -645,7 +645,7 @@ class SeriesController(
@PostMapping("v1/series/{seriesId}/analyze") @PostMapping("v1/series/{seriesId}/analyze")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.ACCEPTED) @ResponseStatus(HttpStatus.ACCEPTED)
fun analyze( fun seriesAnalyze(
@PathVariable seriesId: String, @PathVariable seriesId: String,
) { ) {
taskEmitter.analyzeBook(bookRepository.findAllBySeriesId(seriesId), HIGH_PRIORITY) taskEmitter.analyzeBook(bookRepository.findAllBySeriesId(seriesId), HIGH_PRIORITY)
@ -655,7 +655,7 @@ class SeriesController(
@PostMapping("v1/series/{seriesId}/metadata/refresh") @PostMapping("v1/series/{seriesId}/metadata/refresh")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.ACCEPTED) @ResponseStatus(HttpStatus.ACCEPTED)
fun refreshMetadata( fun seriesRefreshMetadata(
@PathVariable seriesId: String, @PathVariable seriesId: String,
) { ) {
val books = bookRepository.findAllBySeriesId(seriesId) val books = bookRepository.findAllBySeriesId(seriesId)
@ -668,7 +668,7 @@ class SeriesController(
@PatchMapping("v1/series/{seriesId}/metadata") @PatchMapping("v1/series/{seriesId}/metadata")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
fun updateMetadata( fun updateSeriesMetadata(
@PathVariable seriesId: String, @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.") @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 @Valid
@ -742,7 +742,7 @@ class SeriesController(
@Operation(summary = "Mark series as read", description = "Mark all book for series as read", tags = [OpenApiConfiguration.TagNames.SERIES]) @Operation(summary = "Mark series as read", description = "Mark all book for series as read", tags = [OpenApiConfiguration.TagNames.SERIES])
@PostMapping("v1/series/{seriesId}/read-progress") @PostMapping("v1/series/{seriesId}/read-progress")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
fun markAsRead( fun markSeriesAsRead(
@PathVariable seriesId: String, @PathVariable seriesId: String,
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
) { ) {
@ -754,7 +754,7 @@ class SeriesController(
@Operation(summary = "Mark series as unread", description = "Mark all book for series as unread", tags = [OpenApiConfiguration.TagNames.SERIES]) @Operation(summary = "Mark series as unread", description = "Mark all book for series as unread", tags = [OpenApiConfiguration.TagNames.SERIES])
@DeleteMapping("v1/series/{seriesId}/read-progress") @DeleteMapping("v1/series/{seriesId}/read-progress")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
fun markAsUnread( fun markSeriesAsUnread(
@PathVariable seriesId: String, @PathVariable seriesId: String,
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
) { ) {
@ -765,7 +765,7 @@ class SeriesController(
@Operation(summary = "Get series read progress (Mihon)", description = "Mihon specific, due to how read progress is handled in Mihon.", tags = [OpenApiConfiguration.TagNames.MIHON]) @Operation(summary = "Get series read progress (Mihon)", description = "Mihon specific, due to how read progress is handled in Mihon.", tags = [OpenApiConfiguration.TagNames.MIHON])
@GetMapping("v2/series/{seriesId}/read-progress/tachiyomi") @GetMapping("v2/series/{seriesId}/read-progress/tachiyomi")
fun getReadProgressTachiyomiV2( fun getMihonReadProgressBySeriesId(
@PathVariable seriesId: String, @PathVariable seriesId: String,
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
): TachiyomiReadProgressV2Dto { ): TachiyomiReadProgressV2Dto {
@ -777,7 +777,7 @@ class SeriesController(
@Operation(summary = "Update series read progress (Mihon)", description = "Mihon specific, due to how read progress is handled in Mihon.", tags = [OpenApiConfiguration.TagNames.MIHON]) @Operation(summary = "Update series read progress (Mihon)", description = "Mihon specific, due to how read progress is handled in Mihon.", tags = [OpenApiConfiguration.TagNames.MIHON])
@PutMapping("v2/series/{seriesId}/read-progress/tachiyomi") @PutMapping("v2/series/{seriesId}/read-progress/tachiyomi")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
fun markReadProgressTachiyomiV2( fun updateMihonReadProgressBySeriesId(
@PathVariable seriesId: String, @PathVariable seriesId: String,
@RequestBody readProgress: TachiyomiReadProgressUpdateV2Dto, @RequestBody readProgress: TachiyomiReadProgressUpdateV2Dto,
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@ -800,7 +800,7 @@ class SeriesController(
@Operation(summary = "Download series", description = "Download the whole series as a ZIP file.", tags = [OpenApiConfiguration.TagNames.SERIES]) @Operation(summary = "Download series", description = "Download the whole series as a ZIP file.", tags = [OpenApiConfiguration.TagNames.SERIES])
@GetMapping("v1/series/{seriesId}/file", produces = [MediaType.APPLICATION_OCTET_STREAM_VALUE]) @GetMapping("v1/series/{seriesId}/file", produces = [MediaType.APPLICATION_OCTET_STREAM_VALUE])
@PreAuthorize("hasRole('FILE_DOWNLOAD')") @PreAuthorize("hasRole('FILE_DOWNLOAD')")
fun getSeriesFile( fun downloadSeriesAsZip(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable seriesId: String, @PathVariable seriesId: String,
): ResponseEntity<StreamingResponseBody> { ): ResponseEntity<StreamingResponseBody> {
@ -849,7 +849,7 @@ class SeriesController(
@DeleteMapping("v1/series/{seriesId}/file") @DeleteMapping("v1/series/{seriesId}/file")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@ResponseStatus(HttpStatus.ACCEPTED) @ResponseStatus(HttpStatus.ACCEPTED)
fun deleteSeries( fun deleteSeriesFile(
@PathVariable seriesId: String, @PathVariable seriesId: String,
) { ) {
taskEmitter.deleteSeries( taskEmitter.deleteSeries(

View file

@ -38,7 +38,7 @@ class SettingsController(
) { ) {
@GetMapping @GetMapping
@Operation(summary = "Retrieve server settings") @Operation(summary = "Retrieve server settings")
fun getSettings(): SettingsDto = fun getServerSettings(): SettingsDto =
SettingsDto( SettingsDto(
komgaSettingsProvider.deleteEmptyCollections, komgaSettingsProvider.deleteEmptyCollections,
komgaSettingsProvider.deleteEmptyReadLists, komgaSettingsProvider.deleteEmptyReadLists,
@ -55,7 +55,7 @@ class SettingsController(
@PatchMapping @PatchMapping
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
@Operation(summary = "Update server settings", description = "You can omit fields you don't want to update") @Operation(summary = "Update server settings", description = "You can omit fields you don't want to update")
fun updateSettings( fun updateServerSettings(
@Valid @RequestBody @Valid @RequestBody
@Parameter(description = "Fields to update. You can omit fields you don't want to update.") @Parameter(description = "Fields to update. You can omit fields you don't want to update.")
newSettings: SettingsUpdateDto, newSettings: SettingsUpdateDto,

View file

@ -26,7 +26,7 @@ class SyncPointController(
summary = "Delete all sync points", summary = "Delete all sync points",
description = "If an API Key ID is passed, deletes only the sync points associated with that API Key. Deleting sync points will allow a Kobo to sync from scratch upon the next sync.", description = "If an API Key ID is passed, deletes only the sync points associated with that API Key. Deleting sync points will allow a Kobo to sync from scratch upon the next sync.",
) )
fun deleteMySyncPointsByApiKey( fun deleteSyncPointsForCurrentUser(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestParam(required = false, name = "key_id") keyIds: Collection<String>?, @RequestParam(required = false, name = "key_id") keyIds: Collection<String>?,
) { ) {

View file

@ -42,7 +42,7 @@ class TransientBooksController(
) { ) {
@PostMapping @PostMapping
@Operation(summary = "Scan folder for transient books", description = "Scan provided folder for transient books.") @Operation(summary = "Scan folder for transient books", description = "Scan provided folder for transient books.")
fun scanForTransientBooks( fun scanTransientBooks(
@RequestBody request: ScanRequestDto, @RequestBody request: ScanRequestDto,
): List<TransientBookDto> = ): List<TransientBookDto> =
try { try {
@ -56,7 +56,7 @@ class TransientBooksController(
@PostMapping("{id}/analyze") @PostMapping("{id}/analyze")
@Operation(summary = "Analyze transient book") @Operation(summary = "Analyze transient book")
fun analyze( fun analyzeTransientBook(
@PathVariable id: String, @PathVariable id: String,
): TransientBookDto = ): TransientBookDto =
transientBookRepository.findByIdOrNull(id)?.let { transientBookRepository.findByIdOrNull(id)?.let {
@ -68,7 +68,7 @@ class TransientBooksController(
produces = [MediaType.ALL_VALUE], produces = [MediaType.ALL_VALUE],
) )
@Operation(summary = "Get transient book page") @Operation(summary = "Get transient book page")
fun getSourcePage( fun getPageByTransientBookId(
@PathVariable id: String, @PathVariable id: String,
@PathVariable pageNumber: Int, @PathVariable pageNumber: Int,
): ResponseEntity<ByteArray> = ): ResponseEntity<ByteArray> =

View file

@ -62,14 +62,14 @@ class UserController(
@GetMapping("me") @GetMapping("me")
@Operation(summary = "Retrieve current user", tags = [TagNames.CURRENT_USER]) @Operation(summary = "Retrieve current user", tags = [TagNames.CURRENT_USER])
fun getMe( fun getCurrentUser(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
): UserDto = principal.toDto() ): UserDto = principal.toDto()
@PatchMapping("me/password") @PatchMapping("me/password")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
@Operation(summary = "Update current user's password", tags = [TagNames.CURRENT_USER]) @Operation(summary = "Update current user's password", tags = [TagNames.CURRENT_USER])
fun updateMyPassword( fun updatePasswordForCurrentUser(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@Valid @RequestBody @Valid @RequestBody
newPasswordDto: PasswordUpdateDto, newPasswordDto: PasswordUpdateDto,
@ -83,13 +83,13 @@ class UserController(
@GetMapping @GetMapping
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@Operation(summary = "List users", tags = [TagNames.USERS]) @Operation(summary = "List users", tags = [TagNames.USERS])
fun getAll(): List<UserDto> = userRepository.findAll().map { it.toDto() } fun getUsers(): List<UserDto> = userRepository.findAll().map { it.toDto() }
@PostMapping @PostMapping
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@Operation(summary = "Create user", tags = [TagNames.USERS]) @Operation(summary = "Create user", tags = [TagNames.USERS])
fun addOne( fun addUser(
@Valid @RequestBody @Valid @RequestBody
newUser: UserCreationDto, newUser: UserCreationDto,
): UserDto = ): UserDto =
@ -103,7 +103,7 @@ class UserController(
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
@PreAuthorize("hasRole('ADMIN') and #principal.user.id != #id") @PreAuthorize("hasRole('ADMIN') and #principal.user.id != #id")
@Operation(summary = "Delete user", tags = [TagNames.USERS]) @Operation(summary = "Delete user", tags = [TagNames.USERS])
fun delete( fun deleteUserById(
@PathVariable id: String, @PathVariable id: String,
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
) { ) {
@ -116,7 +116,7 @@ class UserController(
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
@PreAuthorize("hasRole('ADMIN') and #principal.user.id != #id") @PreAuthorize("hasRole('ADMIN') and #principal.user.id != #id")
@Operation(summary = "Update user", tags = [TagNames.USERS]) @Operation(summary = "Update user", tags = [TagNames.USERS])
fun updateUser( fun updateUserById(
@PathVariable id: String, @PathVariable id: String,
@Valid @RequestBody @Valid @RequestBody
patch: UserUpdateDto, patch: UserUpdateDto,
@ -171,7 +171,7 @@ class UserController(
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
@PreAuthorize("hasRole('ADMIN') or #principal.user.id == #id") @PreAuthorize("hasRole('ADMIN') or #principal.user.id == #id")
@Operation(summary = "Update user's password", tags = [TagNames.USERS]) @Operation(summary = "Update user's password", tags = [TagNames.USERS])
fun updatePassword( fun updatePasswordByUserId(
@PathVariable id: String, @PathVariable id: String,
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@Valid @RequestBody @Valid @RequestBody
@ -186,7 +186,7 @@ class UserController(
@GetMapping("me/authentication-activity") @GetMapping("me/authentication-activity")
@PageableAsQueryParam @PageableAsQueryParam
@Operation(summary = "Retrieve authentication activity for the current user", tags = [TagNames.CURRENT_USER]) @Operation(summary = "Retrieve authentication activity for the current user", tags = [TagNames.CURRENT_USER])
fun getMyAuthenticationActivity( fun getAuthenticationActivityForCurrentUser(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestParam(name = "unpaged", required = false) unpaged: Boolean = false, @RequestParam(name = "unpaged", required = false) unpaged: Boolean = false,
@Parameter(hidden = true) page: Pageable, @Parameter(hidden = true) page: Pageable,
@ -241,7 +241,7 @@ class UserController(
@GetMapping("{id}/authentication-activity/latest") @GetMapping("{id}/authentication-activity/latest")
@PreAuthorize("hasRole('ADMIN') or #principal.user.id == #id") @PreAuthorize("hasRole('ADMIN') or #principal.user.id == #id")
@Operation(summary = "Retrieve latest authentication activity for a user", tags = [TagNames.USERS]) @Operation(summary = "Retrieve latest authentication activity for a user", tags = [TagNames.USERS])
fun getLatestAuthenticationActivityForUser( fun getLatestAuthenticationActivityByUserId(
@PathVariable id: String, @PathVariable id: String,
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@RequestParam(required = false, name = "apikey_id") apiKeyId: String?, @RequestParam(required = false, name = "apikey_id") apiKeyId: String?,
@ -253,7 +253,7 @@ class UserController(
@GetMapping("me/api-keys") @GetMapping("me/api-keys")
@Operation(summary = "Retrieve API keys", tags = [TagNames.API_KEYS]) @Operation(summary = "Retrieve API keys", tags = [TagNames.API_KEYS])
fun getApiKeys( fun getApiKeysForCurrentUser(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
): Collection<ApiKeyDto> { ): Collection<ApiKeyDto> {
if (demo && !principal.user.isAdmin) throw ResponseStatusException(HttpStatus.FORBIDDEN) if (demo && !principal.user.isAdmin) throw ResponseStatusException(HttpStatus.FORBIDDEN)
@ -262,7 +262,7 @@ class UserController(
@PostMapping("me/api-keys") @PostMapping("me/api-keys")
@Operation(summary = "Create API key", tags = [TagNames.API_KEYS]) @Operation(summary = "Create API key", tags = [TagNames.API_KEYS])
fun createApiKey( fun createApiKeyForCurrentUser(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@Valid @RequestBody apiKeyRequest: ApiKeyRequestDto, @Valid @RequestBody apiKeyRequest: ApiKeyRequestDto,
): ApiKeyDto { ): ApiKeyDto {
@ -278,7 +278,7 @@ class UserController(
@DeleteMapping("me/api-keys/{keyId}") @DeleteMapping("me/api-keys/{keyId}")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
@Operation(summary = "Delete API key", tags = [TagNames.API_KEYS]) @Operation(summary = "Delete API key", tags = [TagNames.API_KEYS])
fun deleteApiKey( fun deleteApiKeyByKeyId(
@AuthenticationPrincipal principal: KomgaPrincipal, @AuthenticationPrincipal principal: KomgaPrincipal,
@PathVariable keyId: String, @PathVariable keyId: String,
) { ) {