Mobile API: real catalogue languages endpoint + tolerant language filter (#282)#285
Mobile API: real catalogue languages endpoint + tolerant language filter (#282)#285fabiodalez-dev wants to merge 2 commits into
Conversation
… language filter Uwe reports (#282) that combining a language with any other filter (category, author, publisher) in the Android app returns no results. Root cause: libri.lingua is unnormalized free text (a dev catalogue holds "italiano", "inglese", "English", "Deutsch", "Français" side by side), but the app's language filter is a hardcoded predefined list. So the app sends e.g. "German" while the row says "Deutsch", the exact-match l.lingua = ? matches nothing, and any filter combined with language collapses to zero. - New GET /api/v1/catalog/languages returns the distinct language values actually present in the (non-deleted) catalogue, each with its book count, ordered by frequency. The app should populate its language filter from this — the real collection values — exactly as it already sources genres/authors/publishers, so a selected language always matches. Read-only, ETag-cached like the other catalog read endpoints; documented in OpenApi; one manifest row added to the idempotency guard. - The search language filter is now case/space-insensitive (LOWER(TRIM(l.lingua)) = LOWER(TRIM(?))) so a value echoed back from the endpoint matches regardless of casing/whitespace. Note: catalog search already supports sort (title/author), so the app's "sort by title/author" request in #282 needs only an app-side UI change; the language-filter fix needs the app to consume the new endpoint. Those app changes ship in the Pinakes-Android repo. Mobile API plugin 1.4.0 -> 1.4.1. Verified: mobile-api-idempotency.spec.js 43/43 (incl. the manifest-covers-every-route guard and 2x /catalog/languages ETag/304), PHPStan clean.
|
Warning Review limit reached
Next review available in: 29 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (11)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Backend part of #282 (HansUwe52's Android-app report). The app-side changes ship in the Pinakes-Android repo (linked separately).
Root cause
Uwe reports that combining a language with any other filter (category / author / publisher) returns no results.
libri.linguais unnormalized free text — a real catalogue holdsitaliano,inglese,English,Deutsch,Françaisside by side — but the app's language filter is a hardcoded predefined list. The app sends e.g.Germanwhile the row saysDeutsch; the exact-matchl.lingua = ?matches nothing, so any filter combined with language collapses to zero. (Category/author/publisher work because the app sources those from the collection.)Changes
GET /api/v1/catalog/languages— distinct language values actually present in the non-deleted catalogue, each with a book count, ordered by frequency. The app populates its language filter from this (real data), exactly as it already does for genres/authors/publishers, so a selected language always matches. Read-only, ETag/304-cached like the sibling catalog reads; documented in OpenApi; one row added to the idempotency manifest.LOWER(TRIM(l.lingua)) = LOWER(TRIM(?)), so a value echoed back from the endpoint matches regardless of casing/whitespace.The sort request
Uwe also asks to sort the home list by title/author.
GET /api/v1/catalog/searchalready supportssort(title/author, keyset-safe) — so that part is purely an app-side UI addition, no backend change needed.Verified
mobile-api-idempotency.spec.js43/43, including the manifest-covers-every-exposed-route guard and2× GET /catalog/languages(idempotent 200 + ETag/304).1.4.0 → 1.4.1.