Skip to content

Paginate album/artist/author list endpoints via parsePagination (#2840)#2863

Open
atomantic wants to merge 1 commit into
mainfrom
claim/issue-2840
Open

Paginate album/artist/author list endpoints via parsePagination (#2840)#2863
atomantic wants to merge 1 commit into
mainfrom
claim/issue-2840

Conversation

@atomantic

Copy link
Copy Markdown
Owner

Summary

GET / on server/routes/albums.js, artists.js, and authors.js returned the full unbounded collection, unlike notes/mood-board/loras list endpoints which use the shared parsePagination/paginateArray helpers. This adopts the same convention on all three endpoints for a uniform API contract.

  • Each GET / now returns the full array by default (backward-compatible) and switches to the shared { items, total, limit, offset } envelope the moment a limit or offset query param is present (via isPaginationRequested + paginateArray, defaultLimit: 50, maxLimit: 500).
  • No new helper — reuses the existing shared helpers in server/lib/validation.js.
  • Follows CLAUDE.md conventions (no try/catch in handlers; helpers imported from lib/validation.js).

Test plan

  • Added a "returns a bounded envelope when pagination is requested" test to each of albums.test.js, artists.test.js, and authors.test.js, asserting the items/total/limit/offset shape, plus the existing default-array tests confirm backward compatibility.
  • cd server && npx vitest run routes/albums.test.js routes/artists.test.js routes/authors.test.js — 30 passed.

Closes #2840

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.

Paginate album/artist list endpoints (adopt shared parsePagination)

1 participant