Skip to content

Mobile API: GET /me names the patron type, staff copies carry consultation_only - #516

Closed
fabiodalez-dev wants to merge 1 commit into
feat/090-feature-togglesfrom
feat/mobile-api-patron-type-consultation
Closed

fabiodalez-dev wants to merge 1 commit into
feat/090-feature-togglesfrom
feat/mobile-api-patron-type-consultation

Conversation

@fabiodalez-dev

Copy link
Copy Markdown
Owner

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()). null with circulation_rules off, before the migration, or when no type exists. A failed lookup never takes the profile down.
  • Staff copies → consultation_only (copy detail, a book's copy list, a scanned copy): 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). It goes through CopyController::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 (409 conflict), 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: 404 feature_disabled.
  • OpenAPI (/me, StaffCopy, the PUT body), the plugin changelog (v1.9.0, unreleased) and CHANGELOG.md.

Tests

tests/mobile-api-patron-consultation-090.unit.php, 17 checks against the database: own type, default type, null with 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.sql and triggers.sql:

  • PHPStan on the CI paths: no errors.
  • scripts/ci-run-unit-tests.sh with CI_STRICT_TESTS=1: 324 passed. circulation-sweep-audit and stack-090-settings-flexibility failed only for the DB user's privileges here, and pass with a privileged user (37/37, 41/41). sitemap-cache-invalidation and updater-preflight-writable fail or skip because the container runs as root; neither touches the Mobile API.
  • No Playwright run here.

Generated by Claude Code

…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
@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Copy link
Copy Markdown
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.

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.

2 participants