Fix: Missing API methods for Book Search and Discovery (re-opened #5) #14

Merged
crisleo94 merged 1 commits from fix/missing-api-methods into main 2026-05-29 04:25:38 +00:00
Owner

Fix: Missing book API client methods and types

This PR fixes the runtime error that caused Gitea issue #5 to be re-opened. The frontend pages (Library.tsx, BookDetailPage.tsx) were calling API methods that were never added to the booksApi client object.

Changes

frontend/src/api/books.ts — Added 4 missing methods to booksApi:

  • searchBooks(params) — calls GET /api/books/ with search/filter params
  • getBook(id) — calls GET /api/books/{id}/ for book detail
  • getGenres() — calls GET /api/books/genres/ for genre discovery
  • getAuthors() — calls GET /api/books/authors/ for author discovery

frontend/src/types/book.ts — Added 2 missing exports:

  • BookSearchParams interface (q, genre, author, reading_status, ordering, page, page_size)
  • READING_STATUS_OPTIONS constant array for the filter dropdown

docs/backend/search-discovery-spec.md — Updated spec to document the API client methods table

Testing

  • Frontend compiles without type errors (all imports resolve correctly)
  • Backend already has the corresponding endpoints (BookViewSet with search, filters, genres/authors actions)
## Fix: Missing book API client methods and types This PR fixes the runtime error that caused Gitea issue #5 to be re-opened. The frontend pages (Library.tsx, BookDetailPage.tsx) were calling API methods that were never added to the booksApi client object. ### Changes **frontend/src/api/books.ts** — Added 4 missing methods to `booksApi`: - `searchBooks(params)` — calls `GET /api/books/` with search/filter params - `getBook(id)` — calls `GET /api/books/{id}/` for book detail - `getGenres()` — calls `GET /api/books/genres/` for genre discovery - `getAuthors()` — calls `GET /api/books/authors/` for author discovery **frontend/src/types/book.ts** — Added 2 missing exports: - `BookSearchParams` interface (q, genre, author, reading_status, ordering, page, page_size) - `READING_STATUS_OPTIONS` constant array for the filter dropdown **docs/backend/search-discovery-spec.md** — Updated spec to document the API client methods table ### Testing - Frontend compiles without type errors (all imports resolve correctly) - Backend already has the corresponding endpoints (BookViewSet with search, filters, genres/authors actions)
marko added 1 commit 2026-05-29 00:08:50 +00:00
crisleo94 approved these changes 2026-05-29 04:10:02 +00:00
crisleo94 merged commit 2eeb3fb7d6 into main 2026-05-29 04:25:38 +00:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
No labels
2 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: HermesFactory/cloud-reader#14