refactor: revew all design of services, clients, deadcode, ...

This commit is contained in:
Julien Froidefond
2025-08-24 22:03:15 +02:00
parent f4dcc89c11
commit 6fba622003
63 changed files with 969 additions and 1846 deletions

View File

@@ -1,6 +1,5 @@
import { NextRequest, NextResponse } from "next/server";
import { getPool } from "@/services/database";
import { isUserAuthenticated } from "@/lib/server-auth";
// Configuration pour éviter la génération statique
export const dynamic = "force-dynamic";
@@ -8,12 +7,6 @@ export const dynamic = "force-dynamic";
// GET - Récupérer toutes les skills
export async function GET() {
try {
// Vérifier l'authentification
const isAuthenticated = await isUserAuthenticated();
if (!isAuthenticated) {
return NextResponse.json({ error: "Non autorisé" }, { status: 401 });
}
const pool = getPool();
const query = `
SELECT
@@ -56,12 +49,6 @@ export async function GET() {
// POST - Créer une nouvelle skill
export async function POST(request: NextRequest) {
try {
// Vérifier l'authentification
const isAuthenticated = await isUserAuthenticated();
if (!isAuthenticated) {
return NextResponse.json({ error: "Non autorisé" }, { status: 401 });
}
const { name, categoryId, description, icon } = await request.json();
if (!name || !categoryId) {
@@ -125,12 +112,6 @@ export async function POST(request: NextRequest) {
// PUT - Mettre à jour une skill
export async function PUT(request: NextRequest) {
try {
// Vérifier l'authentification
const isAuthenticated = await isUserAuthenticated();
if (!isAuthenticated) {
return NextResponse.json({ error: "Non autorisé" }, { status: 401 });
}
const { id, name, categoryId, description, icon } = await request.json();
if (!id || !name || !categoryId) {
@@ -204,12 +185,6 @@ export async function PUT(request: NextRequest) {
// DELETE - Supprimer une skill
export async function DELETE(request: NextRequest) {
try {
// Vérifier l'authentification
const isAuthenticated = await isUserAuthenticated();
if (!isAuthenticated) {
return NextResponse.json({ error: "Non autorisé" }, { status: 401 });
}
const { searchParams } = new URL(request.url);
const id = searchParams.get("id");