Skip to content

feat(mobile-api): sortable catalog search (title/date) with sort-aware keyset#242

Merged
fabiodalez-dev merged 2 commits into
mainfrom
feat/mobile-catalog-sort
Jul 9, 2026
Merged

feat(mobile-api): sortable catalog search (title/date) with sort-aware keyset#242
fabiodalez-dev merged 2 commits into
mainfrom
feat/mobile-catalog-sort

Conversation

@fabiodalez-dev

Copy link
Copy Markdown
Owner

Backend half of Uwe's app remarks (#238-style): the mobile catalog could only ever show newest-first (hardcoded ORDER BY l.id DESC), with no alphabetical/title order like the web catalog offers.

GET /api/v1/catalog/search now takes a sort param mirroring the web: newest (default), oldest, title_asc, title_desc. The opaque keyset cursor is made sort-aware — it carries the last row's (sort value, id) and pages with (col </> ? OR (col = ? AND id </> ?)) tie-broken on the unique id, so no row is skipped/repeated in any order. A cursor minted under a different sort is ignored, so switching order restarts cleanly.

Author sorts are intentionally deferred (principal author is a per-row subquery, not keyset-friendly). plugin.json 1.2.1 → 1.2.2. Additive + backward compatible: an older server just ignores the param.

Verified against the dev DB: title_asc pages continue alphabetically across the keyset boundary with no overlap, including apostrophe titles (bound params). php -l + PHPStan L5 clean. The Android sort-picker UI that consumes this is a separate PR on Pinakes-Android.

…e keyset

GET /api/v1/catalog/search now accepts a `sort` param mirroring the web catalog:
newest (default), oldest, title_asc, title_desc. Previously the order was
hardcoded to l.id DESC (cataloguing date) with no way to change it, so the app
could only ever show newest-first — the mobile app has no title/alphabetical
order the way the web catalog does.

Keyset (cursor) pagination is made sort-aware: the opaque cursor now carries the
last row's sort anchor (value + id), and the WHERE clause pages with
(col </> ? OR (col = ? AND id </> ?)) tie-broken on the unique id, so no row is
skipped or repeated regardless of the chosen order. A cursor minted under a
different sort is ignored, so switching order restarts cleanly. Author sorts are
intentionally left out for now (the principal author is a per-row subquery, not
keyset-friendly). plugin.json 1.2.1 -> 1.2.2.

Verified against the dev DB: title_asc pages continue alphabetically across the
keyset boundary with no overlap, including titles containing apostrophes (bound
params, not string-built SQL).
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@fabiodalez-dev, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 38 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d43dc4bc-85d6-484c-9bc9-44807c445619

📥 Commits

Reviewing files that changed from the base of the PR and between 0449169 and 0b3b4e1.

📒 Files selected for processing (4)
  • MOBILE_API_SPEC.md
  • storage/plugins/mobile-api/plugin.json
  • storage/plugins/mobile-api/src/Controllers/CatalogController.php
  • storage/plugins/mobile-api/src/Controllers/OpenApiController.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/mobile-catalog-sort

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@fabiodalez-dev fabiodalez-dev merged commit 8fe9723 into main Jul 9, 2026
6 checks passed
@fabiodalez-dev fabiodalez-dev deleted the feat/mobile-catalog-sort branch July 9, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant