Merge branch 'main' into feat/debugmode

This commit is contained in:
Julien Froidefond
2025-02-23 21:30:34 +01:00
20 changed files with 548 additions and 223 deletions

View File

@@ -1,15 +1,8 @@
import { NextResponse } from "next/server";
import { serverCacheService } from "@/lib/services/server-cache.service";
import { getServerCacheService } from "@/lib/services/server-cache.service";
export async function POST() {
try {
serverCacheService.clear();
return NextResponse.json({ message: "Cache serveur supprimé avec succès" });
} catch (error) {
console.error("Erreur lors de la suppression du cache serveur:", error);
return NextResponse.json(
{ error: "Erreur lors de la suppression du cache serveur" },
{ status: 500 }
);
}
const cacheService = await getServerCacheService();
cacheService.clear();
return NextResponse.json({ message: "Cache cleared" });
}

View File

@@ -1,8 +1,9 @@
import { NextResponse } from "next/server";
import { serverCacheService } from "@/lib/services/server-cache.service";
import { getServerCacheService } from "@/lib/services/server-cache.service";
export async function GET() {
return NextResponse.json({ mode: serverCacheService.getCacheMode() });
const cacheService = await getServerCacheService();
return NextResponse.json({ mode: cacheService.getCacheMode() });
}
export async function POST(request: Request) {
@@ -15,8 +16,9 @@ export async function POST(request: Request) {
);
}
serverCacheService.setCacheMode(mode);
return NextResponse.json({ mode: serverCacheService.getCacheMode() });
const cacheService = await getServerCacheService();
cacheService.setCacheMode(mode);
return NextResponse.json({ mode: cacheService.getCacheMode() });
} catch (error) {
console.error("Erreur lors de la mise à jour du mode de cache:", error);
return NextResponse.json({ error: "Invalid request" }, { status: 400 });

View File

@@ -16,7 +16,7 @@ async function refreshLibrary(libraryId: string) {
"use server";
try {
await LibraryService.clearLibrarySeriesCache(libraryId);
await LibraryService.invalidateLibrarySeriesCache(libraryId);
revalidatePath(`/libraries/${libraryId}`);
return { success: true };

View File

@@ -8,7 +8,7 @@ async function refreshHome() {
"use server";
try {
await HomeService.clearHomeCache();
await HomeService.invalidateHomeCache();
revalidatePath("/");
return { success: true };
} catch (error) {

View File

@@ -29,8 +29,8 @@ async function refreshSeries(seriesId: string) {
"use server";
try {
await SeriesService.clearSeriesBooksCache(seriesId);
await SeriesService.clearSeriesCache(seriesId);
await SeriesService.invalidateSeriesBooksCache(seriesId);
await SeriesService.invalidateSeriesCache(seriesId);
revalidatePath(`/series/${seriesId}`);
return { success: true };
} catch (error) {