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:
2026-03-29 22:51:00 +02:00
parent 292e9bc77f
commit ccc7f375f6
38 changed files with 463 additions and 286 deletions

View File

@@ -7,6 +7,7 @@ import { TorrentDownloadDto, LatestFoundPerLibraryDto } from "@/lib/api";
import { Card, CardContent, CardHeader, CardTitle, Button, Icon } from "@/app/components/ui";
import { QbittorrentProvider, QbittorrentDownloadButton } from "@/app/components/QbittorrentDownloadButton";
import { useTranslation } from "@/lib/i18n/context";
import { compressVolumes } from "@/lib/volumeRanges";
import type { TranslationKey } from "@/lib/i18n/fr";
type TFunction = (key: TranslationKey, vars?: Record<string, string | number>) => string;
@@ -260,7 +261,7 @@ function DownloadRow({ dl, onDeleted }: { dl: TorrentDownloadDto; onDeleted: ()
<div className="flex-1 min-w-0">
{/* Desktop: single row */}
<div className="hidden sm:flex items-center gap-2">
<Link href={`/libraries/${dl.library_id}/series/${encodeURIComponent(dl.series_name)}`} className="text-sm font-medium text-primary hover:underline truncate">{dl.series_name}</Link>
<Link href={`/libraries/${dl.library_id}/series/${dl.series_id ?? encodeURIComponent(dl.series_name)}`} className="text-sm font-medium text-primary hover:underline truncate">{dl.series_name}</Link>
<span className={`text-[10px] font-medium px-1.5 py-0.5 rounded-full ${statusClass(dl.status)}`}>
{statusLabel(dl.status, t)}
</span>
@@ -275,7 +276,7 @@ function DownloadRow({ dl, onDeleted }: { dl: TorrentDownloadDto; onDeleted: ()
{/* Mobile: stacked */}
<div className="sm:hidden">
<div className="flex items-center gap-1.5">
<Link href={`/libraries/${dl.library_id}/series/${encodeURIComponent(dl.series_name)}`} className="text-sm font-medium text-primary hover:underline truncate">{dl.series_name}</Link>
<Link href={`/libraries/${dl.library_id}/series/${dl.series_id ?? encodeURIComponent(dl.series_name)}`} className="text-sm font-medium text-primary hover:underline truncate">{dl.series_name}</Link>
<span className={`text-[10px] font-medium px-1.5 py-0.5 rounded-full shrink-0 ${statusClass(dl.status)}`}>
{statusLabel(dl.status, t)}
</span>
@@ -389,7 +390,7 @@ function AvailableLibraryCard({ lib, onDeleted }: { lib: LatestFoundPerLibraryDt
<div key={r.id} className="rounded-lg border border-border/40 bg-background/60 p-2 sm:p-3">
<div className="flex items-center justify-between gap-2 mb-1.5">
<Link
href={`/libraries/${lib.library_id}/series/${encodeURIComponent(r.series_name)}`}
href={`/libraries/${lib.library_id}/series/${r.series_id ?? encodeURIComponent(r.series_name)}`}
className="font-semibold text-xs sm:text-sm text-primary hover:underline truncate"
>
{r.series_name}
@@ -403,11 +404,11 @@ function AvailableLibraryCard({ lib, onDeleted }: { lib: LatestFoundPerLibraryDt
{groupReleasesByTitle(r.available_releases).map((group) => (
<div key={group.title} className="rounded bg-muted/30 overflow-hidden">
{/* Title + matched volumes (shown once) */}
<div className="flex items-center gap-2 py-1 px-2">
<p className="text-[11px] sm:text-xs font-mono text-foreground truncate flex-1" title={group.title}>{group.title}</p>
<div className="flex flex-wrap items-center gap-1 shrink-0">
{group.items[0].matched_missing_volumes.map(vol => (
<span key={vol} className="text-[10px] px-1 py-0.5 rounded-full bg-success/20 text-success font-medium">T{vol}</span>
<div className="py-1 px-2">
<p className="text-[11px] sm:text-xs font-mono text-foreground break-all">{group.title}</p>
<div className="flex flex-wrap items-center gap-1 mt-1">
{compressVolumes(group.items[0].matched_missing_volumes).map(range => (
<span key={range} className="text-[10px] px-1 py-0.5 rounded-full bg-success/20 text-success font-medium">{range}</span>
))}
</div>
</div>