Skip to content

Add library code lookup, reviews API, and album update#212

Draft
jakebromberg wants to merge 4 commits intomainfrom
feature/library-code-lookup-reviews
Draft

Add library code lookup, reviews API, and album update#212
jakebromberg wants to merge 4 commits intomainfrom
feature/library-code-lookup-reviews

Conversation

@jakebromberg
Copy link
Member

Summary

  • Implement the library code lookup TODO at library.controller.ts:105-108 -- query library_artist_view by code_letters and code_artist_number, with optional code_number and genre_name filters
  • Add reviews API: GET /library/reviews?album_id=123 and PUT /library/reviews with upsert semantics
  • Add album update endpoint: PATCH /library for updating label and album_title fields
  • All endpoints use existing catalog:read/catalog:write permissions

Part of the library-scanner project. See WXYC/library-scanner for the iPhone app that consumes these endpoints.

Test plan

  • Unit tests for lookupByLibraryCode() (4 tests)
  • Unit tests for updateAlbumFields() (3 tests)
  • Unit tests for getReviewByAlbumId() and upsertReview() (5 tests)
  • All 188 existing tests continue to pass
  • Integration test with Docker DB (manual)

Jake Bromberg added 4 commits February 28, 2026 10:09
Implement the library code lookup TODO at library.controller.ts:105-108:
- lookupByLibraryCode() queries library_artist_view by code_letters,
  code_artist_number, with optional code_number and genre_name filters

Add reviews API (GET/PUT /library/reviews):
- getReviewByAlbumId() returns review for an album
- upsertReview() uses onConflictDoUpdate on album_id unique constraint

Add album update endpoint (PATCH /library):
- updateAlbumFields() updates label and/or album_title on a library row

All endpoints use existing catalog:read/catalog:write permissions.
Includes unit tests for all new service functions.
The code lookup endpoint is now implemented via lookupByLibraryCode(),
so the test should expect 200 with valid album data instead of 501.

Replaces the single 501 stub test with three tests: successful lookup
by code_letters + code_artist_number, narrowed lookup with code_number,
and empty result for non-existent codes.
Use seed data code_letters 'BU' / code_artist_number 60 (Built to
Spill) instead of 'BUI' / 1 which doesn't exist in the CI database.
Run Prettier on files modified in the previous commit.
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