feat: author pages with /authors/:id route (0.16.0)

- `GET /v1/authors/:id` returns `AuthorWithCount` (id, name, manga_count).
- `GET /v1/authors/:id/mangas` paged works by that author.
- `GET /v1/authors?search=` autocomplete (already used by Phase 1 forms;
  now formally exposed).
- New `/authors/:id` page on the frontend; author chips on the manga
  detail page (added in Phase 1) now link to a real page.
- Extracts `lib/components/MangaCard.svelte` — already used by the home
  page, ready for the collection page in Phase 3.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-05-17 14:39:11 +02:00
parent 59d380b6d7
commit 5e92a2c450
12 changed files with 739 additions and 96 deletions

View File

@@ -0,0 +1,24 @@
import { error } from '@sveltejs/kit';
import { ApiError } from '$lib/api/client';
import { getAuthor, listAuthorMangas } from '$lib/api/authors';
import type { PageLoad } from './$types';
export const ssr = false;
export const load: PageLoad = async ({ params }) => {
try {
const [author, mangas] = await Promise.all([
getAuthor(params.id),
listAuthorMangas(params.id, { limit: 50 })
]);
return { author, mangas: mangas.items, total: mangas.page.total };
} catch (e) {
// 404 surfaces as a real SvelteKit error so the framework shell
// renders the standard not-found page instead of the route's
// happy-path markup with undefined data.
if (e instanceof ApiError && e.status === 404) {
error(404, 'Author not found');
}
throw e;
}
};