All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 40s
- Ajout DELETE /books/:id : supprime le fichier physique, la thumbnail, le book en DB et queue un scan de la lib. Bouton avec confirmation sur la page de détail du livre. - L'import torrent utilise unaccent() en SQL pour matcher les séries indépendamment des accents (ex: "les géants" = "les geants"). - Fallback filesystem avec strip_accents pour les séries sans livre en DB. - Migration 0069: activation de l'extension PostgreSQL unaccent. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
32 lines
1012 B
TypeScript
32 lines
1012 B
TypeScript
import { NextRequest, NextResponse } from "next/server";
|
|
import { updateBook, apiFetch } from "@/lib/api";
|
|
|
|
export async function PATCH(
|
|
request: NextRequest,
|
|
{ params }: { params: Promise<{ bookId: string }> }
|
|
) {
|
|
const { bookId } = await params;
|
|
try {
|
|
const body = await request.json();
|
|
const data = await updateBook(bookId, body);
|
|
return NextResponse.json(data);
|
|
} catch (error) {
|
|
const message = error instanceof Error ? error.message : "Failed to update book";
|
|
return NextResponse.json({ error: message }, { status: 500 });
|
|
}
|
|
}
|
|
|
|
export async function DELETE(
|
|
_request: NextRequest,
|
|
{ params }: { params: Promise<{ bookId: string }> }
|
|
) {
|
|
const { bookId } = await params;
|
|
try {
|
|
const data = await apiFetch(`/books/${bookId}`, { method: "DELETE" });
|
|
return NextResponse.json(data);
|
|
} catch (error) {
|
|
const message = error instanceof Error ? error.message : "Failed to delete book";
|
|
return NextResponse.json({ error: message }, { status: 500 });
|
|
}
|
|
}
|