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 });