bugfix: /bookmarks renders manga title and cover
The bookmarks list was rendering "Manga bookmark <date>" with no indication of which manga the bookmark referred to. The data is already in the DB — the list query just wasn't pulling it. Backend: - BookmarkSummary gains manga_title (String) and manga_cover_image_path (Option<String>). Populated by an INNER JOIN on `mangas` in `repo::bookmark::list_for_user`. The JOIN is INNER because `bookmarks.manga_id` has ON DELETE CASCADE, so a bookmark cannot outlive its manga. Chapter LEFT JOIN unchanged. - The existing list_me_enriches_chapter_bookmarks_with_chapter_number test now also asserts manga_title is populated for both chapter- and manga-level bookmarks, and that manga_cover_image_path is null when no cover was uploaded. Frontend: - Bookmark type carries optional manga_title and manga_cover_image_path (optional because POST /bookmarks returns the bare Bookmark, not the enriched summary). - /bookmarks page redesigned as a grid: cover thumbnail (64×96 with a placeholder when no cover) on the left, then the manga title (as the primary link), then either "Chapter N — page M" linked to the reader, "(chapter removed)" for orphan chapter bookmarks, or "Whole manga" for manga-level bookmarks. Bookmark date moves to a subdued footer. - E2E fixtures track the enriched shape returned by the list endpoint (vs. the bare Bookmark returned by POST). The toggle test now asserts the manga title appears on the bookmarks card after the bookmark is created. Also: tighten .gitignore. `/data` only catches the compose volume root; the dev backend writes to `/backend/data` (default STORAGE_DIR is `./data/storage` relative to backend cwd), so local uploads were showing as untracked. Adding `/backend/data` keeps test uploads out of the index. Lockstep version bump to 0.11.1. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,9 +23,18 @@ const bookmarkFixture = {
|
||||
page: null,
|
||||
created_at: '2026-01-01T00:00:00Z'
|
||||
};
|
||||
// /me/bookmarks responses are enriched (`BookmarkSummary` on the wire),
|
||||
// while POST /bookmarks returns the bare `Bookmark`. The mock layer
|
||||
// returns the bare fixture on POST and the enriched one in the list.
|
||||
const enrichedBookmarkFixture = {
|
||||
...bookmarkFixture,
|
||||
manga_title: 'Berserk',
|
||||
manga_cover_image_path: null,
|
||||
chapter_number: null
|
||||
};
|
||||
|
||||
async function setupAuthenticatedBookmarkFlow(page: Page) {
|
||||
let bookmarks: typeof bookmarkFixture[] = [];
|
||||
let bookmarks: typeof enrichedBookmarkFixture[] = [];
|
||||
|
||||
await page.route('**/api/v1/auth/me', (route) =>
|
||||
route.fulfill({
|
||||
@@ -67,7 +76,11 @@ async function setupAuthenticatedBookmarkFlow(page: Page) {
|
||||
);
|
||||
await page.route('**/api/v1/bookmarks', (route) => {
|
||||
if (route.request().method() === 'POST') {
|
||||
bookmarks = [bookmarkFixture, ...bookmarks];
|
||||
// List endpoint is enriched (BookmarkSummary), POST returns
|
||||
// the bare Bookmark — but the in-memory list we surface to
|
||||
// /me/bookmarks uses the enriched fixture so the rendered
|
||||
// card has the manga title.
|
||||
bookmarks = [enrichedBookmarkFixture, ...bookmarks];
|
||||
route.fulfill({
|
||||
status: 201,
|
||||
contentType: 'application/json',
|
||||
@@ -101,7 +114,10 @@ test('authed user toggles a manga bookmark and sees it in /bookmarks', async ({
|
||||
|
||||
// The /bookmarks list reflects it.
|
||||
await page.goto('/bookmarks');
|
||||
await expect(page.getByTestId('bookmark-list')).toContainText('Manga bookmark');
|
||||
// The /bookmarks page now renders a real card with the manga
|
||||
// title — the fixture title is "Berserk" (see mangaFixture above).
|
||||
await expect(page.getByTestId('bookmark-title')).toContainText('Berserk');
|
||||
await expect(page.getByTestId('bookmark-list')).toContainText('Whole manga');
|
||||
|
||||
// Toggle off from the manga page.
|
||||
await page.goto(`/manga/${mangaId}`);
|
||||
|
||||
Reference in New Issue
Block a user