feat: nextbook on next page if last page

This commit is contained in:
Julien Froidefond
2025-03-07 08:15:34 +01:00
parent 591a41149f
commit 66f467c66b
8 changed files with 66 additions and 10 deletions

View File

@@ -5,6 +5,7 @@ import { ImageService } from "./image.service";
import { PreferencesService } from "./preferences.service";
import { ERROR_CODES } from "../../constants/errorCodes";
import { AppError } from "../../utils/errors";
import { SeriesService } from "./series.service";
export class BookService extends BaseApiService {
static async getBook(bookId: string): Promise<KomgaBookWithPages> {
@@ -31,6 +32,11 @@ export class BookService extends BaseApiService {
throw new AppError(ERROR_CODES.BOOK.NOT_FOUND, {}, error);
}
}
public static async getNextBook(bookId: string, seriesId: string): Promise<KomgaBook | null> {
const books = await SeriesService.getAllSeriesBooks(seriesId);
const currentIndex = books.findIndex((book) => book.id === bookId);
return books[currentIndex + 1] || null;
}
static async updateReadProgress(
bookId: string,