refactor: remove caching-related API endpoints and configurations, update preferences structure, and clean up unused services
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 7m22s

This commit is contained in:
Julien Froidefond
2026-01-03 18:55:12 +01:00
parent acd26ea427
commit 512e9a480f
49 changed files with 244 additions and 4073 deletions

View File

@@ -2,7 +2,6 @@ import { BaseApiService } from "./base-api.service";
import type { KomgaBook, KomgaSeries } from "@/types/komga";
import type { LibraryResponse } from "@/types/library";
import type { HomeData } from "@/types/home";
import { getServerCacheService } from "./server-cache.service";
import { ERROR_CODES } from "../../constants/errorCodes";
import { AppError } from "../../utils/errors";
@@ -12,80 +11,55 @@ export class HomeService extends BaseApiService {
static async getHomeData(): Promise<HomeData> {
try {
const [ongoing, ongoingBooks, recentlyRead, onDeck, latestSeries] = await Promise.all([
this.fetchWithCache<LibraryResponse<KomgaSeries>>(
"home-ongoing",
async () =>
this.fetchFromApi<LibraryResponse<KomgaSeries>>({
path: "series",
params: {
read_status: "IN_PROGRESS",
sort: "readDate,desc",
page: "0",
size: "10",
media_status: "READY",
},
}),
"HOME"
),
this.fetchWithCache<LibraryResponse<KomgaBook>>(
"home-ongoing-books",
async () =>
this.fetchFromApi<LibraryResponse<KomgaBook>>({
path: "books",
params: {
read_status: "IN_PROGRESS",
sort: "readProgress.readDate,desc",
page: "0",
size: "10",
media_status: "READY",
},
}),
"HOME"
),
this.fetchWithCache<LibraryResponse<KomgaBook>>(
"home-recently-read",
async () =>
this.fetchFromApi<LibraryResponse<KomgaBook>>({
path: "books/latest",
params: {
page: "0",
size: "10",
media_status: "READY",
},
}),
"HOME"
),
this.fetchWithCache<LibraryResponse<KomgaBook>>(
"home-on-deck",
async () =>
this.fetchFromApi<LibraryResponse<KomgaBook>>({
path: "books/ondeck",
params: {
page: "0",
size: "10",
media_status: "READY",
},
}),
"HOME"
),
this.fetchWithCache<LibraryResponse<KomgaSeries>>(
"home-latest-series",
async () =>
this.fetchFromApi<LibraryResponse<KomgaSeries>>({
path: "series/latest",
params: {
page: "0",
size: "10",
media_status: "READY",
},
}),
"HOME"
),
this.fetchFromApi<LibraryResponse<KomgaSeries>>({
path: "series",
params: {
read_status: "IN_PROGRESS",
sort: "readDate,desc",
page: "0",
size: "10",
media_status: "READY",
},
}),
this.fetchFromApi<LibraryResponse<KomgaBook>>({
path: "books",
params: {
read_status: "IN_PROGRESS",
sort: "readProgress.readDate,desc",
page: "0",
size: "10",
media_status: "READY",
},
}),
this.fetchFromApi<LibraryResponse<KomgaBook>>({
path: "books/latest",
params: {
page: "0",
size: "10",
media_status: "READY",
},
}),
this.fetchFromApi<LibraryResponse<KomgaBook>>({
path: "books/ondeck",
params: {
page: "0",
size: "10",
media_status: "READY",
},
}),
this.fetchFromApi<LibraryResponse<KomgaSeries>>({
path: "series/latest",
params: {
page: "0",
size: "10",
media_status: "READY",
},
}),
]);
return {
ongoing: ongoing.content || [],
ongoingBooks: ongoingBooks.content || [], // Nouveau champ
ongoingBooks: ongoingBooks.content || [],
recentlyRead: recentlyRead.content || [],
onDeck: onDeck.content || [],
latestSeries: latestSeries.content || [],
@@ -97,17 +71,4 @@ export class HomeService extends BaseApiService {
throw new AppError(ERROR_CODES.HOME.FETCH_ERROR, {}, error);
}
}
static async invalidateHomeCache(): Promise<void> {
try {
const cacheService = await getServerCacheService();
await cacheService.delete("home-ongoing");
await cacheService.delete("home-ongoing-books"); // Nouvelle clé de cache
await cacheService.delete("home-recently-read");
await cacheService.delete("home-on-deck");
await cacheService.delete("home-latest-series");
} catch (error) {
throw new AppError(ERROR_CODES.CACHE.DELETE_ERROR, {}, error);
}
}
}