Library
How a student reserves a book, how the desk lends it and takes it back, and what each refusal means.
Each campus runs its own library. Every route needs Feature.LIBRARY and starts with /api/v1/library/campuses/:campusId.
| Who | Permission | Uses |
|---|---|---|
| Students and staff borrowing | list or read on library_catalogue | The borrow routes |
| Library staff | read, list, create, update or delete on library_management | Catalogue, desk, labels, loans, settings, report |
| A paired phone | Its device session, no sign-in | Scanning and photographing books |
assertLibraryAccess and assertManages pin the permission to the campus in the path.
Borrowing a book
The student screen is /student/library (LibraryFilesBrowser). A book page shows one button:
| Button | When | Does | Success says |
|---|---|---|---|
| Reserve | A copy is on the shelf | Holds it as ready until the same time tomorrow. Students get today plus the campus loan days; staff pick a return day | "Held for you. Collect it from the library." |
| Want it next | None on the shelf, some out, and the queue isn't longer than the copies out | A waiting hold | "You are next for this book." |
| Keep longer | You have it | Asks the librarian for a later day (one request at a time) | "Asked the librarian to keep it longer." |
My books lists open loans and live holds.
Reserve and want-next lock the title and rebalance holds. Library notifications (LIBRARY_HOLD_READY, _HOLD_LAPSED, _DUE_SOON, _OVERDUE, _RENEWAL_DECIDED) open /student/library for students and the campus library for staff.
At the desk
Scan (scanLibraryCode). A label or accession number on this campus is a copy; a valid ISBN is an isbn; anything else is unknown.
Check (checkLibraryLend). Warns about an overdue loan, or that the free copies are held for others, and suggests a due day. It doesn't lend.
Lend (lendLibraryCopy). The copy must be on the shelf and the due day today or later. Writes the loan, marks the copy on_loan, and marks the borrower's hold collected. An overdue loan is a warning, not a refusal.
Take back (returnLibraryCopy). Closes the loan as returned and puts the copy on the shelf, or marks it damaged. Rebalancing then offers it to the next person waiting.
Keep longer at the desk sets a new due day after today and clears the request and reminders. Mark lost closes the loan as lost and the copy as lost.
The OpenAPI 400 sentences on desk routes are shorter than what the service throws, and several real refusals are 404 or 409. Trust the service messages.
Phone at the desk. POST .../desk/device (startLibraryDevice) starts the paired phone as a desk scanner (LIBRARY_DESK) or to add books (LIBRARY_CAPTURE) for a 12-hour workday. No paired phone gives 409 Pair a phone first. See Device pairing.
The catalogue
| Action | Rule |
|---|---|
| Edit a book | Needs a title; a valid, unused ISBN |
| Delete a book | Only with no copies left. Lapses its holds |
| Add copies | Numbered from the next free accession number (deleted copies count), under a campus lock |
| Damaged | Only from the shelf |
| Lost, delete a copy | Not while on loan |
| Back on shelf | Rebalances holds |
| Cover photo | Upload, take with the paired phone, or restore the original |
Labels, loans and settings
| Area | What to know |
|---|---|
| Labels | listLibraryLabels shows unprinted copies (or printed=true to reprint). Printing makes library-labels.pdf, up to 420 at a time: a QR, the accession number and the title |
| Loans tabs | Out (soonest due first), Overdue (most late first, Kampala days), Renewals (a requested day). counts returns overdue plus renewals; a loan can be in both |
| Holds | Ready ones first. Cancelling lapses it and offers the next person |
| Renewal answer | Accept, change (needs a later day) or refuse. If someone else answered first: This request was already decided. |
| Loan days | studentLoanDays, 1 to 60, default 4. Staff pick their own day |
| Categories | Ten defaults are added on first read and can't be renamed or deleted. A category or shelf with books can't be deleted |
Term report
getLibraryReport and downloadLibraryReportPdf need read on library_management and a termId or campusAcademicYearId. Loans, books added, late returns, lost and damaged are counted on Kampala days in the period; overdue and stock are as of today. Lists stop at 10. The PDF waits up to 35 seconds for its render.
Routes
Every library route, generated from apps/server/src/app/library/controllers at API fbb63d51. Except for the paired phone, every controller requires the library feature and staff, and the borrower controller also allows students. Who is the extra check on each route. Prefix every path with /api/v1.