Repository navigation
Mobile API: GET /me names the patron type, staff copies carry consultation_only - #516
Closed
fabiodalez-dev wants to merge 1 commit into
Closed
fabiodalez-dev wants to merge 1 commit into
fabiodalez-dev wants to merge 1 commit into
Conversation
…ation_only
The Android app reads both and the server sent neither.
GET /me gains patron_type {id, code, name}: the patron type whose rules
govern the reader, their own or the library default
(CirculationPolicy::patronTypeOf()), null with circulation_rules off,
before the migration or when no type exists. A failed lookup never takes
the profile down.
Staff copies (detail, book copy list, scanned copy) carry
consultation_only, read from copie.solo_consultazione when
features.consultation_only is on and the 0.9.0 column exists, false
otherwise. PUT /staff/copies/{id} accepts consultation_only (boolean,
422 otherwise) and applies it through CopyController::toggleConsultation(),
the book page's own toggle: a copy held by a loan, a pickup or a request is
refused (409 conflict with the core message) and a copy made lendable again
promotes the waitlist. Status and notes sent in the same call are applied
after it. With the module off it answers 404 feature_disabled.
OpenAPI, the plugin changelog (v1.9.0, unreleased) and CHANGELOG updated.
tests/mobile-api-patron-consultation-090.unit.php: 17 checks against the
database; 15 fail without this change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Q7hZ3Sw9KSZbwUyZA34hB
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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 |
Owner
Author
|
Superseded by #518: I brought this commit into the 0.9.0-rc.2 release branch, with one single patron_type lookup in GET /me (this one) and the changelog lines moved to the rc.2 entry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on
feat/090-feature-toggles. The Android app (fabiodalez-dev/Pinakes-Android#55 and #56) reads two 0.9.0 fields the Mobile API never sent: the reader's patron type on the profile, and the consultation-only flag of a copy in the staff copy editor.What changes
GET /me→patron_type{id, code, name}: the patron type whose rules govern the reader, their own or the library default (CirculationPolicy::patronTypeOf()).nullwithcirculation_rulesoff, before the migration, or when no type exists. A failed lookup never takes the profile down.consultation_only(copy detail, a book's copy list, a scanned copy): read fromcopie.solo_consultazionewhenfeatures.consultation_onlyis on and the 0.9.0 column exists,falseotherwise.PUT /staff/copies/{id}acceptsconsultation_only(boolean, 422 otherwise). It goes throughCopyController::toggleConsultation(), the book page's own toggle, so a copy held by a loan, a pickup or a request is refused with the same message (409conflict), and a copy made lendable again promotes the waitlist. Status and notes sent in the same call are applied after it. With the module off: 404feature_disabled./me,StaffCopy, the PUT body), the plugin changelog (v1.9.0, unreleased) andCHANGELOG.md.Tests
tests/mobile-api-patron-consultation-090.unit.php, 17 checks against the database: own type, default type,nullwith the rules off, the entity in the type name decoded; the flag on a copy, in the book list, set and cleared, notes in the same call, a copy on loan refused with nothing stored, a non-boolean refused, the module off (reads false, 404 on change, status and notes still work). 15 of them fail without this change.Locally on MariaDB 10.11 with this branch's
schema.sql,data_it_IT.sqlandtriggers.sql:scripts/ci-run-unit-tests.shwithCI_STRICT_TESTS=1: 324 passed.circulation-sweep-auditandstack-090-settings-flexibilityfailed only for the DB user's privileges here, and pass with a privileged user (37/37, 41/41).sitemap-cache-invalidationandupdater-preflight-writablefail or skip because the container runs as root; neither touches the Mobile API.Generated by Claude Code