refactor: delete unused GET /api/komga/config route
Some checks failed
Deploy with Docker Compose / deploy (push) Failing after 2s

This commit is contained in:
2026-02-28 11:13:45 +01:00
parent eec51b7ef8
commit 7f361ce0a2
2 changed files with 63 additions and 55 deletions

View File

@@ -1,55 +0,0 @@
import { NextResponse } from "next/server";
import { ConfigDBService } from "@/lib/services/config-db.service";
import { ERROR_CODES } from "@/constants/errorCodes";
import type { KomgaConfig } from "@/types/komga";
import { getErrorMessage } from "@/utils/errors";
import logger from "@/lib/logger";
export const dynamic = "force-dynamic";
// GET reste utilisé pour récupérer la config
export async function GET() {
try {
const mongoConfig: KomgaConfig | null = await ConfigDBService.getConfig();
return NextResponse.json(mongoConfig, { status: 200 });
} catch (error) {
logger.error({ err: error }, "Erreur lors de la récupération de la configuration:");
if (error instanceof Error) {
if (error.message === "Utilisateur non authentifié") {
return NextResponse.json(
{
error: {
code: ERROR_CODES.MIDDLEWARE.UNAUTHORIZED,
name: "Unauthorized",
message: getErrorMessage(ERROR_CODES.MIDDLEWARE.UNAUTHORIZED),
},
},
{ status: 401 }
);
}
if (error.message === "Configuration non trouvée") {
return NextResponse.json(
{
error: {
code: ERROR_CODES.KOMGA.MISSING_CONFIG,
name: "Missing config",
message: getErrorMessage(ERROR_CODES.KOMGA.MISSING_CONFIG),
},
},
{ status: 404 }
);
}
}
return NextResponse.json(
{
error: {
code: ERROR_CODES.CONFIG.FETCH_ERROR,
name: "Config fetch error",
message: getErrorMessage(ERROR_CODES.CONFIG.FETCH_ERROR),
},
},
{ status: 500 }
);
}
}