feat: table series avec UUID PK — migration complète backend + frontend
Migration DB (0070 + 0071): - Backup automatique de book_reading_progress avant migration - Crée table series (fusion de series_metadata) avec UUID PK - Ajoute series_id FK à books, external_metadata_links, anilist_series_links, available_downloads, download_detection_results - Supprime les colonnes TEXT legacy et la table series_metadata Backend API + Indexer: - Toutes les queries SQL migrées vers series_id FK + JOIN series - Routes /series/:name → /series/:series_id (UUID) - Nouvel endpoint GET /series/by-name/:name pour lookup par nom - match_title_volumes() factorisé entre prowlarr.rs et download_detection.rs - Fix scheduler.rs: settings → app_settings - OpenAPI mis à jour avec les nouveaux endpoints Frontend: - Routes /libraries/[id]/series/[name] → /series/[seriesId] - Tous les composants (Edit, Delete, MarkRead, Prowlarr, Metadata, ReadingStatus) utilisent seriesId - compressVolumes() pour afficher T1→3 au lieu de T1 T2 T3 - Titre release en entier (plus de truncate) dans available downloads Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@ import { useRouter } from "next/navigation";
|
||||
import { Button, Icon, Modal } from "./ui";
|
||||
import { useTranslation } from "@/lib/i18n/context";
|
||||
|
||||
export function DeleteSeriesButton({ libraryId, seriesName }: { libraryId: string; seriesName: string }) {
|
||||
export function DeleteSeriesButton({ libraryId, seriesId }: { libraryId: string; seriesId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const router = useRouter();
|
||||
const [showConfirm, setShowConfirm] = useState(false);
|
||||
@@ -16,7 +16,7 @@ export function DeleteSeriesButton({ libraryId, seriesName }: { libraryId: strin
|
||||
setShowConfirm(false);
|
||||
try {
|
||||
const resp = await fetch(
|
||||
`/api/libraries/${libraryId}/series/${encodeURIComponent(seriesName)}`,
|
||||
`/api/libraries/${libraryId}/series/${seriesId}`,
|
||||
{ method: "DELETE" }
|
||||
);
|
||||
if (resp.ok) {
|
||||
|
||||
@@ -44,6 +44,7 @@ const SERIES_STATUS_VALUES = ["", "ongoing", "ended", "hiatus", "cancelled", "up
|
||||
|
||||
interface EditSeriesFormProps {
|
||||
libraryId: string;
|
||||
seriesId: string;
|
||||
seriesName: string;
|
||||
currentAuthors: string[];
|
||||
currentPublishers: string[];
|
||||
@@ -58,6 +59,7 @@ interface EditSeriesFormProps {
|
||||
|
||||
export function EditSeriesForm({
|
||||
libraryId,
|
||||
seriesId,
|
||||
seriesName,
|
||||
currentAuthors,
|
||||
currentPublishers,
|
||||
@@ -199,7 +201,7 @@ export function EditSeriesForm({
|
||||
}
|
||||
|
||||
const res = await fetch(
|
||||
`/api/libraries/${libraryId}/series/${encodeURIComponent(seriesName)}`,
|
||||
`/api/libraries/${libraryId}/series/${seriesId}`,
|
||||
{
|
||||
method: "PATCH",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
@@ -212,12 +214,7 @@ export function EditSeriesForm({
|
||||
return;
|
||||
}
|
||||
setIsOpen(false);
|
||||
|
||||
if (effectiveName !== seriesName) {
|
||||
router.push(`/libraries/${libraryId}/series/${encodeURIComponent(effectiveName)}` as any);
|
||||
} else {
|
||||
router.refresh();
|
||||
}
|
||||
router.refresh();
|
||||
} catch {
|
||||
setError(t("common.networkError"));
|
||||
}
|
||||
|
||||
@@ -5,12 +5,13 @@ import { useRouter } from "next/navigation";
|
||||
import { useTranslation } from "../../lib/i18n/context";
|
||||
|
||||
interface MarkSeriesReadButtonProps {
|
||||
seriesId: string;
|
||||
seriesName: string;
|
||||
bookCount: number;
|
||||
booksReadCount: number;
|
||||
}
|
||||
|
||||
export function MarkSeriesReadButton({ seriesName, bookCount, booksReadCount }: MarkSeriesReadButtonProps) {
|
||||
export function MarkSeriesReadButton({ seriesId, seriesName, bookCount, booksReadCount }: MarkSeriesReadButtonProps) {
|
||||
const { t } = useTranslation();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const router = useRouter();
|
||||
@@ -27,7 +28,7 @@ export function MarkSeriesReadButton({ seriesName, bookCount, booksReadCount }:
|
||||
const res = await fetch("/api/series/mark-read", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ series: seriesName, status: targetStatus }),
|
||||
body: JSON.stringify({ series: seriesId, status: targetStatus }),
|
||||
});
|
||||
if (!res.ok) {
|
||||
const body = await res.json().catch(() => ({ error: res.statusText }));
|
||||
|
||||
@@ -6,6 +6,7 @@ import { Icon } from "./ui";
|
||||
import type { ProwlarrRelease, ProwlarrSearchResponse } from "../../lib/api";
|
||||
import { useTranslation } from "../../lib/i18n/context";
|
||||
import { QbittorrentProvider, QbittorrentDownloadButton } from "./QbittorrentDownloadButton";
|
||||
import { compressVolumes } from "@/lib/volumeRanges";
|
||||
|
||||
interface MissingBookItem {
|
||||
title: string | null;
|
||||
@@ -251,9 +252,9 @@ export function ProwlarrSearchModal({ seriesName, libraryId, missingBooks, initi
|
||||
</span>
|
||||
{hasMissing && (
|
||||
<div className="flex flex-wrap items-center gap-1 mt-1">
|
||||
{first.matchedMissingVolumes!.map((vol) => (
|
||||
<span key={vol} className="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-green-500/20 text-green-600">
|
||||
{t("prowlarr.missingVol", { vol })}
|
||||
{compressVolumes(first.matchedMissingVolumes!).map((range) => (
|
||||
<span key={range} className="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-green-500/20 text-green-600">
|
||||
{range}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -9,6 +9,7 @@ import type { AnilistMediaResultDto, AnilistSeriesLinkDto } from "../../lib/api"
|
||||
|
||||
interface ReadingStatusModalProps {
|
||||
libraryId: string;
|
||||
seriesId: string;
|
||||
seriesName: string;
|
||||
readingStatusProvider: string | null;
|
||||
existingLink: AnilistSeriesLinkDto | null;
|
||||
@@ -18,6 +19,7 @@ type ModalStep = "idle" | "searching" | "results" | "linked";
|
||||
|
||||
export function ReadingStatusModal({
|
||||
libraryId,
|
||||
seriesId,
|
||||
seriesName,
|
||||
readingStatusProvider,
|
||||
existingLink,
|
||||
@@ -67,7 +69,7 @@ export function ReadingStatusModal({
|
||||
setError(null);
|
||||
try {
|
||||
const resp = await fetch(
|
||||
`/api/anilist/series/${libraryId}/${encodeURIComponent(seriesName)}`,
|
||||
`/api/anilist/series/${libraryId}/${seriesId}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
@@ -91,7 +93,7 @@ export function ReadingStatusModal({
|
||||
setError(null);
|
||||
try {
|
||||
const resp = await fetch(
|
||||
`/api/anilist/series/${libraryId}/${encodeURIComponent(seriesName)}`,
|
||||
`/api/anilist/series/${libraryId}/${seriesId}`,
|
||||
{ method: "DELETE" }
|
||||
);
|
||||
if (!resp.ok) throw new Error("Unlink failed");
|
||||
|
||||
Reference in New Issue
Block a user