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:
@@ -33,28 +33,20 @@ export default async function SeriesDetailPage({
|
||||
params,
|
||||
searchParams,
|
||||
}: {
|
||||
params: Promise<{ id: string; name: string }>;
|
||||
params: Promise<{ id: string; seriesId: string }>;
|
||||
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
|
||||
}) {
|
||||
const { id, name } = await params;
|
||||
const { id, seriesId } = await params;
|
||||
const { t } = await getServerTranslations();
|
||||
const searchParamsAwaited = await searchParams;
|
||||
const page = typeof searchParamsAwaited.page === "string" ? parseInt(searchParamsAwaited.page) : 1;
|
||||
const limit = typeof searchParamsAwaited.limit === "string" ? parseInt(searchParamsAwaited.limit) : 50;
|
||||
|
||||
const seriesName = decodeURIComponent(name);
|
||||
|
||||
const [library, booksPage, seriesMeta, metadataLinks, readingStatusLink, prowlarrConfigured, qbConfigured, metadataProviders] = await Promise.all([
|
||||
const [library, seriesMeta, metadataLinks, readingStatusLink, prowlarrConfigured, qbConfigured, metadataProviders] = await Promise.all([
|
||||
fetchLibraries().then((libs) => libs.find((l) => l.id === id)),
|
||||
fetchBooks(id, seriesName, page, limit).catch(() => ({
|
||||
items: [] as BookDto[],
|
||||
total: 0,
|
||||
page: 1,
|
||||
limit,
|
||||
})),
|
||||
fetchSeriesMetadata(id, seriesName).catch(() => null as SeriesMetadataDto | null),
|
||||
getMetadataLink(id, seriesName).catch(() => [] as ExternalMetadataLinkDto[]),
|
||||
getReadingStatusLink(id, seriesName).catch(() => null as AnilistSeriesLinkDto | null),
|
||||
fetchSeriesMetadata(id, seriesId).catch(() => null as SeriesMetadataDto | null),
|
||||
getMetadataLink(id, seriesId).catch(() => [] as ExternalMetadataLinkDto[]),
|
||||
getReadingStatusLink(id, seriesId).catch(() => null as AnilistSeriesLinkDto | null),
|
||||
apiFetch<{ api_key?: string }>("/settings/prowlarr")
|
||||
.then(d => !!(d?.api_key?.trim()))
|
||||
.catch(() => false),
|
||||
@@ -64,6 +56,17 @@ export default async function SeriesDetailPage({
|
||||
apiFetch<{ comicvine?: { api_key?: string } }>("/settings/metadata_providers").catch(() => null),
|
||||
]);
|
||||
|
||||
// Get series name from metadata for display
|
||||
const seriesName = seriesMeta?.series_name ?? "";
|
||||
|
||||
// Fetch books using seriesId for the filter query
|
||||
const booksPage = await fetchBooks(id, seriesId, page, limit).catch(() => ({
|
||||
items: [] as BookDto[],
|
||||
total: 0,
|
||||
page: 1,
|
||||
limit,
|
||||
}));
|
||||
|
||||
const hiddenProviders: string[] = [];
|
||||
if (!metadataProviders?.comicvine?.api_key) hiddenProviders.push("comicvine");
|
||||
|
||||
@@ -228,12 +231,14 @@ export default async function SeriesDetailPage({
|
||||
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<MarkSeriesReadButton
|
||||
seriesId={seriesId}
|
||||
seriesName={seriesName}
|
||||
bookCount={booksPage.total}
|
||||
booksReadCount={booksReadCount}
|
||||
/>
|
||||
<EditSeriesForm
|
||||
libraryId={id}
|
||||
seriesId={seriesId}
|
||||
seriesName={seriesName}
|
||||
currentAuthors={seriesMeta?.authors ?? []}
|
||||
currentPublishers={seriesMeta?.publishers ?? []}
|
||||
@@ -261,13 +266,14 @@ export default async function SeriesDetailPage({
|
||||
/>
|
||||
<ReadingStatusModal
|
||||
libraryId={id}
|
||||
seriesId={seriesId}
|
||||
seriesName={seriesName}
|
||||
readingStatusProvider={library.reading_status_provider ?? null}
|
||||
existingLink={readingStatusLink}
|
||||
/>
|
||||
<DeleteSeriesButton
|
||||
libraryId={id}
|
||||
seriesName={seriesName}
|
||||
seriesId={seriesId}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -75,8 +75,8 @@ export default async function LibrarySeriesPage({
|
||||
<div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-6">
|
||||
{series.map((s) => (
|
||||
<Link
|
||||
key={s.name}
|
||||
href={`/libraries/${id}/series/${encodeURIComponent(s.name)}`}
|
||||
key={s.series_id}
|
||||
href={`/libraries/${id}/series/${s.series_id}`}
|
||||
className="group"
|
||||
>
|
||||
<div className={`bg-card rounded-xl shadow-sm border border-border/60 overflow-hidden hover:shadow-md transition-shadow duration-200 ${s.books_read_count >= s.book_count ? "opacity-50" : ""}`}>
|
||||
@@ -98,6 +98,7 @@ export default async function LibrarySeriesPage({
|
||||
{t("series.readCount", { read: String(s.books_read_count), total: String(s.book_count), plural: s.book_count !== 1 ? "s" : "" })}
|
||||
</p>
|
||||
<MarkSeriesReadButton
|
||||
seriesId={s.series_id}
|
||||
seriesName={s.name}
|
||||
bookCount={s.book_count}
|
||||
booksReadCount={s.books_read_count}
|
||||
|
||||
Reference in New Issue
Block a user